@unifold/connect-react-native 0.1.50-beta.1 → 0.1.50-beta.3

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 CHANGED
@@ -1,5 +1,5 @@
1
- 'use strict';var hs=require('react'),reactNative=require('react-native'),Yt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),Xf=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),wp=require('@react-native-async-storage/async-storage'),eC=require('expo-constants'),dS=require('react-native-qrcode-svg/src/genMatrix'),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 hs__namespace=/*#__PURE__*/_interopNamespace(hs);var Yt__default=/*#__PURE__*/_interopDefault(Yt);var Xf__default=/*#__PURE__*/_interopDefault(Xf);var wp__default=/*#__PURE__*/_interopDefault(wp);var eC__default=/*#__PURE__*/_interopDefault(eC);var dS__default=/*#__PURE__*/_interopDefault(dS);var Nf=e=>{throw TypeError(e)};var zy=(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 Pu=(e,t,r)=>t.has(e)||Nf("Cannot "+r);var h=(e,t,r)=>(Pu(e,t,"read from private field"),r?r.call(e):t.get(e)),X=(e,t,r)=>t.has(e)?Nf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),z=(e,t,r,o)=>(Pu(e,t,"write to private field"),t.set(e,r),r),ut=(e,t,r)=>(Pu(e,t,"access private method"),r);var gl=(e,t,r,o)=>({set _(n){z(e,t,n);},get _(){return h(e,t,o)}});var Fu={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)"}},Du=Fu;function Vc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function yl(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,T)=>{let m=o?.[p]?.[g];if(m!==void 0)return m;let f=t?.[p]?.[g];return f!==void 0?f: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,c=(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:Vc(s,i)},transferCrypto:{depositAddress:{card:Vc(s,a)}},depositCard:{quoteProvider:{card:Vc(s,l)}},depositTracker:{executionRow:{card:Vc(s,c)}}}}function Vu(e,t,r){let n={...Fu[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Ou=hs.createContext(null);function B(){let e=hs.useContext(Ou);if(!e){let t=Du.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:yl(t,void 0,"dark"),isDark:true}}return e}function bt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=B(),l=s??a.primary,c=i??a.primary,p=hs.useRef(new reactNative.Animated.Value(0)).current,g=hs.useId(),T=hs.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),m=(e-t)/2,f=2*Math.PI*m,w=e/2,k=o??Math.max(0,Math.round(e-t*2-8)),x=(e-k)/2;hs.useEffect(()=>{let I=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),S=requestAnimationFrame(()=>I.start());return ()=>{cancelAnimationFrame(S),I.stop();}},[p]);let v=p.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:v}]},children:jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Yt.Defs,{children:jsxRuntime.jsxs(Yt.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Yt.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(Yt.Circle,{cx:w,cy:w,r:m,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:x+1.5,left:x,width:k,height:k,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Bu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function oa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function po({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.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(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function na({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function er({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.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(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.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 pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Fi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.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 ia({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function xn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.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 dn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Lc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Bc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.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 Cl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.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(Yt.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(Yt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.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(Yt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Yt.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Yt.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function Kf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yf({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Yt__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Yt.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(Yt.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Yt.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 aa({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=hs.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=hs.useMemo(()=>{let m=o?.[l];return Vu(l,m,r)},[l,o,r]),p=hs.useMemo(()=>yl(c,i,l),[c,i,l]),g=hs.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=hs.useMemo(()=>({mode:l,colors:c,fonts:g,components:p,isDark:l==="dark"}),[l,c,g,p]);return jsxRuntime.jsx(Ou.Provider,{value:T,children:e})}var xl={damping:28,stiffness:300,mass:.8},hb=80,gb=500;function _t({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:c=false,borderTopLeftRadius:p=24,borderTopRightRadius:g=24,marginHorizontal:T,marginBottom:m,overlay:f,useModal:w=true}){let{colors:k}=B(),{height:x}=reactNative.useWindowDimensions(),[v,I]=hs.useState(false),S=hs.useRef(e);S.current=e;let R=hs.useRef(0),u=i!=null&&i>=1,d=u||c?0:reactNative.Platform.OS==="ios"?34:24,C=a!=null&&i!=null&&a>i,b=i!=null?(C?a:i)*x:void 0,O=C?(a-i)*x:0,A=l?0:O,F=Xf.useSharedValue(x),_=hs.useRef(null),U=hs.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),S.current||I(false);},[]);hs.useEffect(()=>{e?(_.current&&(clearTimeout(_.current),_.current=null),I(true),F.value=Xf.withSpring(A,xl)):v&&(F.value=Xf.withTiming(x,{duration:250},G=>{G&&Xf.runOnJS(U)();}),_.current=setTimeout(()=>{_.current=null,U();},350));},[e]),hs.useEffect(()=>()=>{_.current&&clearTimeout(_.current);},[]),hs.useEffect(()=>{v&&e&&(F.value=Xf.withSpring(A,xl));},[A,C]);let W=hs.useCallback(()=>{o&&t();},[o,t]),Q=hs.useMemo(()=>{if(!(!n&&!C))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{R.current=F.value;},onPanResponderMove:(G,ne)=>{if(Math.abs(ne.dy)<4)return;let H=R.current+ne.dy;F.value=Math.max(0,H);},onPanResponderRelease:(G,ne)=>{if(!(Math.abs(ne.dy)<4)){if(n&&(ne.dy>hb||ne.vy>gb)){t();return}if(C){let H=O/2,Y=F.value<H?0:O;F.value=Xf.withSpring(Y,xl);}else F.value=Xf.withSpring(A,xl);}},onPanResponderTerminate:()=>{F.value=Xf.withSpring(A,xl);}}).panHandlers},[n,C,O,A,F,t]),ze=Xf.useAnimatedStyle(()=>({transform:[{translateY:F.value}]})),Z=Xf.useAnimatedStyle(()=>({opacity:Xf.interpolate(F.value,[0,x*.5,x],[.5,.25,0],Xf.Extrapolation.CLAMP)}));if(!v)return null;let Ne=jsxRuntime.jsxs(reactNative.View,{style:[Xn.root,!w&&Xn.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(Xf__default.default.View,{style:[Xn.backdrop,Z],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:W})}),jsxRuntime.jsxs(Xf__default.default.View,{style:[Xn.sheet,ze,{height:b,backgroundColor:k.background,borderTopLeftRadius:u?0:p,borderTopRightRadius:u?0:g,...T?{marginHorizontal:T,marginBottom:m??T+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:p,borderBottomRightRadius:g}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:b!=null?Xn.gestureRoot:Xn.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Xn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Xn.handle,{backgroundColor:k.foreground+"33"}]})}),r,d>0&&jsxRuntime.jsx(reactNative.View,{style:{height:d}})]}),Q&&jsxRuntime.jsx(reactNative.View,{...Q,style:Xn.dragOverlay})]})]});return w?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[Ne,f]}):Ne}var tm={position:"absolute",left:0,right:0,top:0,bottom:0},Xn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...tm,zIndex:9999},backdrop:{...tm,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink: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}}),xt=hs__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));xt.displayName="BottomSheetScrollView";function la(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var yb="https://api.unifold.io",Eu="__UnifoldDevApiBaseUrl__",Br="pk_test_123",Wc={};function bb(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Eu];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ar(){return bb()??yb}function Ec(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.'),Br=e.publishableKey;}e.defaultConfig&&(Wc=e.defaultConfig);}function om(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[Eu]=t:delete globalThis[Eu];}function vl(){return ar()}function Mc(){return Br}function Gr(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 qt(e){let t=e.startsWith("/")?e:`/${e}`;return `${ar()}/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+)?/,ar()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ar()}${e}`:`${ar()}/api/public${e}`:""}async function Ao(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Wc.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||Wc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Wc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Br;Gr(n);let s=await fetch(`${ar()}/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 ko(e,t){return e.find(r=>r.chain_type===t)}async function un(e,t,r){let o=t||Br;Gr(o);let n=await fetch(`${ar()}/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 zc(e,t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/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 Le(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 ei(e,t){let r=e||Br;Gr(r);let o=`${ar()}/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 Mu(e,t){let r=t||Br;Gr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${ar()}/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 Uc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function zu(e,t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/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 Uu(e,t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/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 Nu(e,t){let r=t||Br;Gr(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(`${ar()}/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 Rl(e){let t=e||Br;Gr(t);let r=await fetch(`${ar()}/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 Vi(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 Il(e){let t=e||Br;Gr(t);let r=await fetch(`${ar()}/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 Hu(){let e=await fetch(`${ar()}/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 Nc(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 _l(){let e=await fetch(`${ar()}/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 Hc(e){let t=e||Br;Gr(t);let r=await fetch(`${ar()}/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 ju(e,t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/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 $u(e,t){return zc(e.deposit_wallet_id,t)}async function jc(e,t,r,o,n){let s=n||Br;Gr(s);let i=await fetch(`${ar()}/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()}async function qu(e,t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/v1/public/onramps/cashapp/sessions`,{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 create Cash App session: ${o.statusText}`);return o.json()}async function Qu(e="usd",t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Ku(e,t){let r=t||Br;Gr(r);let o=await fetch(`${ar()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function Gu(e){let t=e||Br;Gr(t);let r=await fetch(`${ar()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function Yu(e,t,r){let o=r||Br;Gr(o);let n=await fetch(`${ar()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}function im({size:e=28}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Yt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Yt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Yt.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 ca({size:e=28}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Yt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Yt.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(Yt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Yt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Yt.Defs,{children:jsxRuntime.jsx(Yt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Yt.Rect,{width:28,height:28,fill:"white"})})})]})}function cm({size:e=28}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Yt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Yt.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(Yt.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(Yt.Defs,{children:jsxRuntime.jsx(Yt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Yt.Rect,{width:28,height:28,fill:"white"})})})]})}function pa({size:e=28}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Yt.Defs,{children:[jsxRuntime.jsxs(Yt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Yt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Yt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Yt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Yt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Yt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Yt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Yt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Yt.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(Yt.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(Yt.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 dm({size:e=28}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Yt.G,{children:[jsxRuntime.jsx(Yt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Yt.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 $c=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:im},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:ca},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:cm},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:pa},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:dm}];function qc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Qc(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 fa(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=$c.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=$c.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Qt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=B(),i=r==="back",a=i?jsxRuntime.jsx(na,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(wt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Oi.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:Oi.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Oi.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Oi.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Oi.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Oi.headerWithTitle:Oi.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Oi.headerSpacer}),!i&&l]})}var Kc={paddingTop:8,paddingBottom:8},Oi=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Kc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Kc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function wo({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=B();return e?jsxRuntime.jsx(reactNative.Text,{style:[um.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[um.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var um=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function pn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(hs.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 rp({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=hs.useState(false),{colors:a,components:l}=B(),c=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=qc(r);return jsxRuntime.jsxs(hs.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:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(pt,{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 Gc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ma({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=B(),s=e.toLowerCase(),i=Gc[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 Yc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=B(),c=qt(`/icons/currencies/png/${e.toLowerCase()}.png`),p=fa(r);return jsxRuntime.jsxs(reactNative.View,{style:[Go.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:Go.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Go.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Go.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Go.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Go.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Go.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Go.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Go.tokenIcon,{backgroundColor:Gc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Go.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Go.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Go.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Go=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 In(){let{colors:e,fonts:t,components:r}=B(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return hs.useMemo(()=>{let l=i.borderRadius,c={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"}},p={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}:{}}},g={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)),m={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}:{}}},f={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"}},w={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:c,quote:g,pm:m,wallet:f,flow:w,amount:p}},[e,t,o,n,s,i,a])}var mm="",hm;function Jc(e){mm=e;}function Zc(e){hm=e;}function xo(){let e=mm||Mc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function vo(){return hm??vl()}async function Xc(){let e=`${vo()}/v1/public/onramps/headless/stripe/config`,t=xo(),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 op(e){let t=await fetch(`${vo()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":xo(),"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 gm(e,t){let r=await fetch(`${vo()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":xo(),"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 np(e,t){let r=await fetch(`${vo()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":xo(),"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 ym(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(`${vo()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":xo(),"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 bm(e,t){let r=await fetch(`${vo()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":xo(),"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 ti(e,t){let r=`${vo()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":xo(),"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 wm(e){let t=`${vo()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":xo(),"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 Cm(e,t){let r=`${vo()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":xo(),"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 ip(e,t){let r=await fetch(`${vo()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":xo(),"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 sp(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(`${vo()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":xo(),"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 ap(e,t){let r=await fetch(`${vo()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":xo(),"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 Sm(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(`${vo()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":xo(),"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 Li(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 Tm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${vo()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":xo()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function $b({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Yt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Yt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Yt.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(Yt.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(Yt.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 qb({size:e=24}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Yt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Yt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Yt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Qb({size:e=24}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Yt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Yt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Yt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Yt.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(Yt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Yt.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(Yt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Yt.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(Yt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Yt.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(Yt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Yt.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(Yt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Yt.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 cp({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(oa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx($b,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(qb,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Qb,{size:t}):jsxRuntime.jsx(oa,{size:t*.75,color:r,strokeWidth:1.75})}function ed(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 up={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function pp(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 Im({status:e,colors:t,fontFamily:r}){let o=pp(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:up[e]??e})})}function _m({count:e=4}){let{colors:t,components:r}=B(),o=hs.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return hs.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:ha.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ha.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ha.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ha.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ha.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ha.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ha=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 Pm({active:e,interval:t=15e3,color:r}){let o=hs.useRef(new reactNative.Animated.Value(0)).current;return hs.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 Fm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=B(),[s,i]=hs.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=pp(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",m=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,w=Li(f?.icon_urls,f?.icon_url),k=fa(l?.destination_network??""),x=l?.wallet_address?qc(l.wallet_address):null,v=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,I=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,S=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):null,R=[{label:"Amount",value:g},{label:"Received",value:`${T} ${m}`},...S?[{label:"Payment",value:S}]:[],{label:"Network",value:k},...x?[{label:"Wallet",value:x}]:[],...v?[{label:"Network Fee",value:v}]:[],...I?[{label:"Transaction Fee",value:I}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Qt,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(xt,{style:Mr.scroll,contentContainerStyle:Mr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Mr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ma,{currency:m||"USD",tokenIconUrl:w,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Mr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx(po,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(wt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Mr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Mr.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:up[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Mr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:ed(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Mr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Mr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.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:[Mr.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(pt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(ln,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),R.map(u=>jsxRuntime.jsx(hs__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Mr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:u.label}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:u.value})]})},u.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Mr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Mr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Mr=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 Vm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=B(),[i,a]=hs.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:Pn.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Pn.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(Qf,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Pn.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Pn.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:Pn.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(po,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Pn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Pn.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(bo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Pn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Pn.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(Kf,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Pn.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Pn=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 aw=[50,100,500],lw=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Lm(e){return e.charAt(0).toUpperCase()+e.slice(1)}function cw(e){return e.card?`${Lm(e.card.brand)} ${Lm(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function nd({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:T,onConfirm:m,onCancel:f,sheetBorderTopLeftRadius:w,sheetBorderTopRightRadius:k,accessToken:x,showHistoryProgressBar:v=true,onLogout:I,onRequestKYC:S,showSwitchAccount:R=true,inputDisabled:u=false}){let d=In(),{colors:C,components:b,fonts:O}=B(),A=w??b.card.borderRadius,F=k??b.card.borderRadius,[_,U]=hs.useState(e),[W,Q]=hs.useState(r?"apple_pay":g.length>0?g[0].id:null),ze=hs.useRef(false),Z=P=>{ze.current=true,Q(P);};hs.useEffect(()=>{ze.current||r||g.length>0&&Q(g[0].id);},[g,r]);let[Ne,G]=hs.useState(false),[ne,H]=hs.useState("select"),[Y,me]=hs.useState(null),J=hs.useRef(false);hs.useEffect(()=>{l&&c&&/saving/i.test(c)&&H("card");},[l,c]);let Te=s,qe=Te!=null&&Te>0,be=hs.useMemo(()=>{if(o)return [];let P=aw.map(y=>({label:`$${y}`,amount:String(y),disabled:false}));return P.push({label:"MAX",amount:qe?String(Te):"0",disabled:!qe}),P},[o,qe,Te]),He=P=>{if(P==="\u232B"){U(y=>y.slice(0,-1));return}if(P==="."){if(_.includes("."))return;U(y=>y===""?"0.":y+".");return}U(y=>{let L=y.indexOf(".");return L!==-1&&y.length-L>2?y:y==="0"&&P!=="."?P:y+P});},Ke=_===""?"0":_,je=parseFloat(_),Ge=n!=null&&!isNaN(je)&&je>0&&je<n,et=Te!=null&&Te>0&&!isNaN(je)&&je>Te,Ve=_!==""&&!isNaN(je)&&je>0&&!Ge&&!et,Ee=r||g.length>0,_e=i==="header",we=hs.useMemo(()=>{let P=[];r&&P.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let y of g)P.push({id:y.id,label:cw(y),hint:y.card?`Expires ${y.card.exp_month}/${y.card.exp_year}`:y.type,brand:y.card?.brand,isApplePay:false});return P},[r,g]),xe=we.find(P=>P.id===W),se=W!=null&&W!=="apple_pay",Ye=xe?xe.label:se&&Y?Y:se?"Card":"Pay With",Xt=xe?!xe.isApplePay:se,Oe=xe?.brand??Y??void 0,[Re,Pe]=hs.useState(false),[tt,Ae]=hs.useState([]),[fe,Ce]=hs.useState(false),[Dt,Wt]=hs.useState(null),[ft,st]=hs.useState(null),Ut=hs.useRef(null);Ut.current=ft;let We=hs.useRef(false);We.current=Re;let ce=hs.useCallback(async(P=false)=>{if(x){P||(Ce(true),Wt(null));try{let y=await wm(x);if(!We.current)return;let L=Array.isArray(y.data)?y.data:Array.isArray(y)?y:[];Ae(L),P||Wt(null);let D=Ut.current?.id;if(D){let N=L.find(M=>M.id===D);N&&st(N);}}catch(y){if(!We.current)return;P||Wt(y?.message??"Failed to load history");}finally{!P&&We.current&&Ce(false);}}},[x]),Fe=hs.useCallback(()=>{Pe(true),ce();},[ce]);hs.useEffect(()=>{if(!Re||!x)return;let P=setInterval(()=>ce(true),15e3);return ()=>clearInterval(P)},[Re,x,ce]);let ae=hs.useCallback(P=>{switch(P){case "history":Fe();break;case "kyc":S?.();break;case "logout":I?.();break}},[Fe,S,I]),j=!!x||!!S||!!I?jsxRuntime.jsx(Vm,{onSelect:ae,showKycOption:!!S,showSwitchAccount:R&&!!I}):void 0,Se=Ee?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[_e?d.amount.paymentRowHeader:d.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(H("select"),G(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:d.amount.paymentLeft,children:[xe?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:d.amount.applePayIcon,children:"\uF8FF"}):Xt?jsxRuntime.jsx(cp,{sublabel:Oe,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:d.amount.paymentLabel,children:Ye}),jsxRuntime.jsx(er,{size:12,color:d.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:d.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:f,title:"Enter amount",leftAction:j}),_e&&Se,jsxRuntime.jsxs(reactNative.View,{style:d.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.amountText,Ke==="0"&&d.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ke]}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.currencyLabel,children:t.toUpperCase()}),Ge&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.minAmountText,{color:C.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),et&&Te!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.minAmountText,{color:C.warning}],children:["Maximum amount is $",Te.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!_e&&Se,be.length>0&&jsxRuntime.jsx(reactNative.View,{style:d.amount.quickRow,children:be.map(P=>{let y=!P.disabled&&_===P.amount&&_!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.amount.quickPill,y&&{backgroundColor:C.primary},P.disabled&&{opacity:.4}],activeOpacity:.7,disabled:P.disabled||l,onPress:()=>U(P.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[d.amount.quickPillText,y&&{color:C.primaryForeground}],children:P.label})},P.label)})}),jsxRuntime.jsx(reactNative.View,{style:d.amount.numpad,children:lw.map((P,y)=>jsxRuntime.jsx(reactNative.View,{style:d.amount.numpadRow,children:P.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.amount.numpadKey,(l||u)&&{opacity:.3}],onPress:()=>He(L),activeOpacity:.6,disabled:l||u,children:jsxRuntime.jsx(reactNative.Text,{style:L==="\u232B"?d.amount.backspaceText:d.amount.numpadKeyText,children:L})},L))},y))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.form.continueBtn,(!Ve||l||u)&&d.form.continueBtnDisabled],onPress:()=>Ve&&!l&&!u&&m(_,W),disabled:!Ve||l||u,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[d.form.continueBtnText,(!Ve||u)&&d.form.continueBtnTextDisabled],children:"Continue"})}),!Ne&&p?jsxRuntime.jsx(reactNative.Text,{style:d.amount.inlineError,children:p}):!Ne&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(_t,{visible:Ne,onClose:()=>{l||(G(false),H("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:A,borderTopRightRadius:F,children:jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetContent,children:ne==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(false),activeOpacity:.7,style:d.amount.sheetCloseBtn,children:jsxRuntime.jsx(wt,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(xt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[we.map(P=>{let y=W===P.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[d.amount.sheetOption,y&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{Z(P.id),me(P.isApplePay?null:P.label),G(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetOptionIcon,children:P.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:d.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(cp,{sublabel:P.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionLabel,children:P.label}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionHint,children:P.hint})]})]}),y&&jsxRuntime.jsx(pt,{size:18,color:C.primary,strokeWidth:2.5})]},P.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:d.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!J.current){J.current=true;try{let P=await T?.();P&&(Z(P.token),me(P.sublabel),G(!1));}finally{J.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||H("select");},activeOpacity:.7,style:d.amount.sheetBackBtn,children:jsxRuntime.jsx(na,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:d.form.continueBtn,onPress:()=>{a&&Ve&&a(false,_);},children:jsxRuntime.jsx(reactNative.Text,{style:d.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(_t,{visible:Re,onClose:()=>{Pe(false),st(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:A,borderTopRightRadius:F,children:ft?jsxRuntime.jsx(Fm,{session:ft,onBack:()=>st(null)}):jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetContent,children:[jsxRuntime.jsx(Qt,{onPress:()=>Pe(false),title:"Purchase History"}),v&&jsxRuntime.jsx(Pm,{active:Re&&!fe&&tt.length>0,color:C.primary}),fe?jsxRuntime.jsx(_m,{}):Dt?jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetErrorText,children:Dt})}):tt.length===0?jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[d.amount.sheetStatusText,{color:C.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(xt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:tt.map(P=>{let y=P.transaction_details,L=y?.source_amount?`$${parseFloat(y.source_amount).toFixed(2)}`:"\u2014",D=(y?.destination_currency??"").toUpperCase(),N=y?.destination_amount?`${parseFloat(y.destination_amount).toFixed(2)} ${D}`:"",M=ed(P.created),Ie=P.destination_token_metadata,Je=Li(Ie?.icon_urls,Ie?.icon_url),ro=Li(Ie?.chain?.icon_urls,Ie?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:d.amount.sheetOption,activeOpacity:.7,onPress:()=>st(P),children:[jsxRuntime.jsx(ma,{currency:D||"USD",tokenIconUrl:Je,networkIconUrl:ro,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionLabel,children:L}),N?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionHint,children:N}):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(Im,{status:P.status,colors:C,fontFamily:O.regular}),M?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:C.foregroundMuted,fontFamily:O.regular},children:M}):null]}),jsxRuntime.jsx(_r,{size:14,color:C.foregroundMuted,strokeWidth:2})]})]},P.id)})})]})})]})}function id({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=In(),{colors:i,fonts:a,components:l}=B(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[T,m]=hs.useState(1),[f,w]=hs.useState(e.firstName??""),[k,x]=hs.useState(e.lastName??""),[v,I]=hs.useState(e.dobMonth??""),[S,R]=hs.useState(e.dobDay??""),[u,d]=hs.useState(e.dobYear??""),[C,b]=hs.useState(e.addressLine1??""),[O,A]=hs.useState(e.addressLine2??""),[F,_]=hs.useState(e.city??""),[U,W]=hs.useState(e.state??""),[Q,ze]=hs.useState(e.postalCode??""),[Z,Ne]=hs.useState(e.country??"US"),[G,ne]=hs.useState(e.idNumber??""),H=hs.useRef(null),Y=hs.useRef(null),me=hs.useRef(null),J=hs.useRef(null),Te=hs.useRef(null),qe=hs.useRef(null),be=hs.useRef(null),He=hs.useRef(null),Ke=p[T-1],je=()=>{switch(Ke){case "name":return f.trim().length>0&&k.trim().length>0;case "dob":return v.length===2&&S.length===2&&u.length===4;case "address":return C.trim().length>0&&F.trim().length>0&&U.trim().length>0&&Q.trim().length>0;case "ssn":return G.trim().length>0;default:return false}},Ge=()=>{je()&&(T<g?m(we=>we+1):o({firstName:f,lastName:k,idNumber:G,dobMonth:v,dobDay:S,dobYear:u,addressLine1:C,addressLine2:O,city:F,state:U,postalCode:Q,country:Z}));},et=()=>{T>1?m(we=>we-1):n();},Ve={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:Ee}=Ve[Ke],_e=[Sr.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:Sr.header,children:[jsxRuntime.jsx(reactNative.View,{style:Sr.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Sr.iconButton,onPress:et,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(bl,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:Sr.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:_e,children:[T," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:Sr.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Sr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(wt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:Sr.progressTrack,children:Array.from({length:g}).map((we,xe)=>jsxRuntime.jsx(reactNative.View,{style:[Sr.progressSegment,{backgroundColor:xe<T||xe+1===T?i.primary:i.border}]},xe))}),jsxRuntime.jsx(xt,{style:s.form.flex,contentContainerStyle:Sr.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:Ee}),Ke==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(oi,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:w,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>H.current?.focus()})}),jsxRuntime.jsx(oi,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:H,style:s.form.input,placeholder:"Doe",placeholderTextColor:c,value:k,onChangeText:x,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ge})})]}),Ke==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:Sr.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:Sr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Sr.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,Sr.dobInput],placeholder:"MM",placeholderTextColor:c,value:v,onChangeText:we=>{let xe=we.replace(/\D/g,"").slice(0,2);I(xe),xe.length===2&&Y.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Sr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Sr.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[s.form.input,Sr.dobInput],placeholder:"DD",placeholderTextColor:c,value:S,onChangeText:we=>{let xe=we.replace(/\D/g,"").slice(0,2);R(xe),xe.length===2&&me.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Sr.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Sr.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:me,style:[s.form.input,Sr.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:u,onChangeText:we=>{let xe=we.replace(/\D/g,"").slice(0,4);d(xe);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ge})]})]}),Ke==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(oi,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:C,onChangeText:b,returnKeyType:"next",onSubmitEditing:()=>J.current?.focus()})}),jsxRuntime.jsx(oi,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:O,onChangeText:A,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})}),jsxRuntime.jsx(oi,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:F,onChangeText:_,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>qe.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:Sr.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(oi,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:qe,style:s.form.input,placeholder:"CA",placeholderTextColor:c,value:U,onChangeText:we=>W(we.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>be.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(oi,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:be,style:s.form.input,placeholder:"94001",placeholderTextColor:c,value:Q,onChangeText:ze,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>He.current?.focus()})})})]}),jsxRuntime.jsx(oi,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:He,style:s.form.input,placeholder:"US",placeholderTextColor:c,value:Z,onChangeText:we=>Ne(we.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ge})})]}),Ke==="ssn"&&jsxRuntime.jsxs(oi,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:G,onChangeText:ne,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ge}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,Sr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&T>=g?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(bt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!je()&&s.form.continueBtnDisabled],onPress:Ge,disabled:!je(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!je()&&s.form.continueBtnTextDisabled],children:T>=g?"Submit":"Continue"})})})]})})}function oi({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 Sr=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 Cp="@unifold/stripe_oauth";async function Am(){try{let e=await wp__default.default.getItem(Cp);return e?JSON.parse(e):null}catch{return null}}async function Sp(e){try{await wp__default.default.setItem(Cp,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ba(){try{await wp__default.default.removeItem(Cp);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var yw=5,Ui=null,Tp=false,kp={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function sd(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:c,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[m,f]=hs.useState(r),[w,k]=hs.useState(!!e?.externalUserId),[x,v]=hs.useState(false),[I,S]=hs.useState(false),[R,u]=hs.useState(""),[d,C]=hs.useState(null),[b,O]=hs.useState(e?.email??""),[A,F]=hs.useState(e?.phone??""),[_,U]=hs.useState(""),[W,Q]=hs.useState("US"),[ze,Z]=hs.useState(""),[Ne,G]=hs.useState(""),ne=hs.useRef(""),H=hs.useRef(""),Y=hs.useRef(""),[me,J]=hs.useState(false),[Te,qe]=hs.useState(false),be=hs.useRef(0),He=hs.useRef(false),Ke=hs.useRef(false),je=hs.useRef(false),Ge=hs.useRef(false),et=hs.useRef(e?.email??""),Ve=hs.useRef(false),Ee=hs.useRef(null),_e=hs.useRef(""),we=hs.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),xe=hs.useRef(null),[nt,se]=hs.useState(0),[Ye,Xt]=hs.useState(kp),[Oe,Re]=hs.useState(e?.defaultWalletAddress??""),[Pe,tt]=hs.useState(""),[Ae,fe]=hs.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ce,Dt]=hs.useState(e?.defaultSourceAmount??"100"),[Wt,ft]=hs.useState(e?.defaultSourceCurrency??"usd"),[st,Ut]=hs.useState(e?.defaultDestinationCurrency??"usdc"),[We,ce]=hs.useState(null),[Fe,ae]=hs.useState(),[Ue,j]=hs.useState(),[Se,P]=hs.useState(false),y=hs.useRef(null),L=hs.useRef(false),D=hs.useRef(0),N=hs.useRef(e?.onComplete),M=hs.useRef(e?.onError),Ie=hs.useRef(e?.onStepChange),Je=hs.useRef(r);hs.useEffect(()=>{N.current=e?.onComplete;},[e?.onComplete]),hs.useEffect(()=>{M.current=e?.onError;},[e?.onError]),hs.useEffect(()=>{Ie.current=e?.onStepChange;},[e?.onStepChange]);let ro=hs.useRef(r);hs.useEffect(()=>{m!==ro.current&&(Ie.current?.(m,ro.current),ro.current=m),Je.current=m;},[m]),hs.useEffect(()=>{I&&m!=="email"&&S(false);},[I,m]),hs.useEffect(()=>{w&&m!==r&&k(false);},[w,m,r]);let te=hs.useCallback((V,E,de)=>{let De={code:V,message:E,step:Je.current,stripeErrorCode:de};C(De),u(""),M.current?.(De);},[]),Xs=hs.useCallback(V=>{let E={sessionId:V.id,status:V.status,sourceAmount:V.transaction_details.source_amount,sourceCurrency:V.transaction_details.source_currency,destinationAmount:V.transaction_details.destination_amount,destinationCurrency:V.transaction_details.destination_currency,destinationNetwork:V.transaction_details.destination_network,walletAddress:V.transaction_details.wallet_address,fees:{networkFee:V.transaction_details.fees.network_fee_amount,transactionFee:V.transaction_details.fees.transaction_fee_amount}};return N.current?.(E),E},[]),Bt=hs.useCallback(()=>C(null),[]),Me=V=>V.refresh_token??V.refresh?.refresh_token??"",Vt=hs.useCallback((V,E,de,De,ve)=>{H.current=E,ne.current=de,e?.externalUserId&&Sp({accessToken:E,refreshToken:de,customerId:V,externalUserId:e.externalUserId,email:ve||b,expiresAt:Date.now()+De*1e3});},[e?.externalUserId,b]),at=hs.useCallback(async()=>{let V=ne.current;if(!V)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let E=await np(V,Y.current??void 0),de=E.access_token,De=Me(E)||V;return G(de),Vt(Y.current,de,De,E.expires_in??3600),de}catch(E){return console.error("[tryRefreshAccessToken] refresh failed:",E?.message),await ba(),Ui=null,xe.current=null,H.current="",ne.current="",Y.current="",G(""),Z(""),null}},[Vt]),rt=hs.useCallback(async V=>{try{return await V(H.current)}catch(E){let de=E?.message??"";if(de.includes("stripe_onramp_forbidden")||de.includes("403")){let De=await at();if(!De)throw te("authorization_error","Session expired. Please sign in again."),f("email"),E;return await V(De)}throw E}},[at,te]);hs.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){P(false);return}let E=false;return stripeReactNative.isPlatformPaySupported().then(de=>{E||P(de);}),()=>{E=true;}},[e?.merchantIdentifier]),hs.useEffect(()=>(L.current=false,()=>{L.current=true,y.current&&clearTimeout(y.current);}),[]);let uo=hs.useRef(false);hs.useEffect(()=>{if(uo.current)return;if(!e?.externalUserId){ba(),Ui=null,xe.current=null,k(false);return}let V=false;return (async()=>{try{let E=await Am();if(V||!E){V||k(!1);return}if(E.externalUserId!==e.externalUserId){await ba(),Ui=null,xe.current=null,V||k(!1);return}let de=Date.now()>=E.expiresAt,De=E.accessToken,ve=E.refreshToken;if(de)try{let mt=await np(E.refreshToken,E.customerId);if(V)return;De=mt.access_token,ve=mt.refresh_token??mt.refresh?.refresh_token??E.refreshToken,await Sp({accessToken:De,refreshToken:ve,customerId:E.customerId,externalUserId:e.externalUserId,email:E.email,expiresAt:Date.now()+(mt.expires_in??3600)*1e3});}catch(mt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",mt?.message),await ba(),Ui=null,xe.current=null,V||k(!1);return}if(V)return;if(uo.current=!0,Z(E.customerId),Y.current=E.customerId,G(De),H.current=De,ne.current=ve,E.email&&(O(E.email),et.current=E.email),Ui===E.customerId)xe.current=Promise.resolve({error:void 0});else {let mt=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:E.customerId});mt.error?console.error("[useStripeOnramp] restore configureSDK error:",mt.error.message):Ui=E.customerId,xe.current=Promise.resolve(mt);}if(V)return;let lt=()=>new Promise(mt=>{let ir=()=>{Ve.current&&_e.current?mt():setTimeout(ir,200);};ir();});try{if(await Promise.race([lt(),new Promise((ir,St)=>setTimeout(()=>St(new Error("timeout")),1e4))]),V)return;let mt=_e.current.toLowerCase();await p(mt,we.current);}catch(mt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",mt?.message);}if(V)return;try{let ir=(await ti(Y.current,H.current)).kyc_tiers??[],St=ir.find(Lo=>Lo.tier==="l0"),Lr=ir.find(Lo=>Lo.tier==="l1"),oo=ir.find(Lo=>Lo.tier==="l2"),Kr=St?.verification_status==="verified",an=Lr?.verification_status==="verified",sr=oo?.verification_status==="verified",Jn=!!St?.verification_status&&St.verification_status!=="not_started";f(Kr||an||sr?"session_params":Jn?"kyc_offer":"kyc");}catch{f("kyc");}}finally{V||k(false);}})(),()=>{V=true;}},[]),hs.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||me)return;let V=false;qe(true);async function E(){try{let[de,De]=await Promise.all([Sm({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?Tm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(sr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",sr?.message),null)):Promise.resolve(null)]);if(V)return;let ve=e?.destinationChainType??"ethereum",lt=de.data.find(sr=>sr.chain_type===ve);if(lt?.address){let sr=lt.address.toLowerCase();Re(sr),_e.current=sr,lt.recipient_address&&tt(lt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",ve,"in",de.data?.length,"wallets");let mt={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},ir={8453:"base",1:"ethereum",137:"polygon"},St=De?.destination_network,Lr="none";if(St&&mt[St])fe(mt[St]),we.current=mt[St],Lr=St+" (from default_token API)";else if(e?.destinationChainId&&ir[e.destinationChainId]){let sr=ir[e.destinationChainId];mt[sr]&&(fe(mt[sr]),we.current=mt[sr]),Lr=sr+" (from chain_id "+e.destinationChainId+")";}else mt[ve]&&(fe(mt[ve]),we.current=mt[ve],Lr=ve+" (from chain_type fallback)");De?.destination_currency&&Ut(De.destination_currency.toLowerCase());let oo=De?.destination_token_metadata,Kr=Li(oo?.icon_urls,oo?.icon_url),an=Li(oo?.chain?.icon_urls,oo?.chain?.icon_url);Kr&&ae(Kr),an&&j(an),J(!0),Ve.current=!0;}catch(de){if(V)return;console.error("[resolveWallet] Failed to resolve wallet:",de?.message),J(true),Ve.current=true;}finally{V||qe(false);}}return Ee.current=E(),()=>{V=true;}},[e?.publishableKey,e?.externalUserId,nt]);let Gt=hs.useCallback(async()=>{if(xe.current)return xe.current;let V=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(E=>(E.error&&(console.error("[useStripeOnramp] configureSDK error:",E.error.message,E.error.code),xe.current=null),E)).catch(E=>{throw console.error("[useStripeOnramp] configureSDK threw:",E?.message??E),xe.current=null,E});return xe.current=V,V},[o,e?.merchantDisplayName]);hs.useEffect(()=>{e?.externalUserId||Gt();},[]);let Qr=hs.useCallback(async V=>{if(!He.current){He.current=true,v(true),Bt(),u("Creating auth intent...");try{let E=await op(V);u("Waiting for authorization...");let de=await i(E);if(de?.error){te("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(de?.status==="Denied"){te("authorization_error","Authorization denied by user."),f("email");return}if(de?.status!=="Consented"||!de.customerId){te("authorization_error","Authorization was canceled."),f("email");return}u("Exchanging tokens...");let De=de.customerId,ve=await gm(E,De),lt=ve.access_token,mt=Me(ve);O(V),et.current=V,Z(De),Y.current=De,Ui=De,G(lt),Vt(De,lt,mt,ve.expires_in??3600,V),u("Checking verification status...");try{let St=(await ti(De,lt)).kyc_tiers??[],Lr=St.find(yo=>yo.tier==="l0"),oo=St.find(yo=>yo.tier==="l1"),Kr=St.find(yo=>yo.tier==="l2"),an=Lr?.verification_status==="verified",sr=oo?.verification_status==="verified",Jn=Kr?.verification_status==="verified",Lo=!!Lr?.verification_status&&Lr.verification_status!=="not_started";if(u(""),an||sr||Jn){Ee.current&&(u("Resolving wallet..."),await Ee.current,u(""));let yo=_e.current;if(yo)try{let Pi=yo.toLowerCase(),Dc=we.current,Zn=await p(Pi,Dc);Zn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",Zn.error.message),te("wallet_error",Zn.error.message,Zn.error.code),f("wallet")):f("session_params");}catch(Pi){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Pi?.message),f("wallet");}else f("wallet");}else Lo?(await Yn(),u(""),f("kyc_offer")):f("kyc");}catch(ir){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",ir?.message),u(""),f("kyc");}}catch(E){te("authorization_error",E?.message??String(E)),f("email");}finally{He.current=false,v(false);}}},[i,Bt,te,Vt,p,Ae]),Er=hs.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!b){te("validation_error","Please enter an email address.");return}v(true),Bt(),u("");try{u("Configuring...");let V=await Gt();if(V.error){te("configuration_error",V.error.message,V.error.code);return}u("Checking Link account...");let E=await n(b);if(E.error){te("authorization_error",E.error.message,E.error.code);return}E.hasLinkAccount?await Qr(b):(u(""),f("disclaimer"));}catch(V){te("unknown_error",V?.message??String(V));}finally{v(false);}},[Bt,Gt,b,te,n,Qr]),ea=hs.useCallback(async()=>{if(!je.current){if(!A){te("validation_error","Please enter your phone number.");return}je.current=true,v(true),Bt(),u("");try{u("Creating Link account...");let V=await s({email:b,phone:A,fullName:_||b,country:W||"US"});if(V.error){te("registration_error",V.error.message,V.error.code);return}await Qr(b);}catch(V){te("registration_error",V?.message??String(V));}finally{je.current=false,v(false);}}},[Bt,W,b,te,_,A,s,Qr]);hs.useEffect(()=>{if(m!=="email")return;let V=Ge.current||Tp;if(V&&(Ge.current=false,Tp=false),!e?.email||w)return;if(V){S(true);return}let E=++be.current,de=false,De=()=>de||be.current!==E;return e?.phone?(async()=>{v(true),Bt();try{u("Configuring...");let ve=await Gt();if(De())return;if(ve.error){te("configuration_error",ve.error.message,ve.error.code);return}u("Checking Link account...");let lt=await n(e.email);if(De())return;if(lt.error){te("authorization_error",lt.error.message,lt.error.code);return}if(lt.hasLinkAccount){if(De())return;await Qr(e.email);}else {if(De())return;u(""),f("disclaimer");}}catch(ve){De()||te("unknown_error",ve?.message??String(ve));}finally{v(false);}})():(async()=>{v(true),Bt();try{u("Configuring...");let ve=await Gt();if(De())return;if(ve.error){te("configuration_error",ve.error.message,ve.error.code);return}u("Checking Link account...");let lt=await n(e.email);if(De())return;if(lt.error){te("authorization_error",lt.error.message,lt.error.code);return}if(lt.hasLinkAccount){if(De())return;await Qr(e.email);}else {if(De())return;u(""),f("disclaimer");}}catch(ve){De()||te("unknown_error",ve?.message??String(ve));}finally{v(false);}})(),()=>{de=true;}},[m,e?.email,e?.phone,w]);let Yn=hs.useCallback(async()=>{Ee.current&&(u("Resolving wallet..."),await Ee.current);let V=_e.current;if(V)try{u("Registering wallet...");let E=V.toLowerCase(),de=we.current;await p(E,de);}catch(E){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",E?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Ic=hs.useCallback(async(V,E)=>{v(true),Bt(),u(""),Xt(lt=>({...lt,...V}));let de=!E,De=E??"kyc_offer",ve=E?"kyc_l1":"kyc";try{let lt=V.dobDay&&V.dobMonth&&V.dobYear,mt=V.firstName&&V.lastName,ir={};mt&&(ir.firstName=V.firstName,ir.lastName=V.lastName),V.addressLine1&&(ir.address={line1:V.addressLine1,line2:V.addressLine2||void 0,city:V.city,state:V.state,postalCode:V.postalCode,country:V.country}),V.idNumber&&(ir.idNumber=V.idNumber),lt&&(ir.dateOfBirth={day:parseInt(V.dobDay,10),month:parseInt(V.dobMonth,10),year:parseInt(V.dobYear,10)});let St=await a(ir);if(St?.error?.message&&(/no active link consumer/i.test(St.error.message)||/not be verified/i.test(St.error.message))){if(u("Verifying identity..."),!await bs()){te("kyc_error","Please verify your identity to continue."),f(ve);return}St=await a(ir);}if(St?.error){let sr=de?"l0":"l1";try{let Lo=(await ti(Y.current,H.current)).kyc_tiers?.find(yo=>yo.tier===sr);if(Lo?.verification_status==="verified"){let yo=de?"session_params":De;await Yn(),u(""),f(yo);return}if(Lo?.verification_status==="rejected"){if(de){await Yn(),u(""),f(De);return}te("kyc_error","Something went wrong. Please try again."),f(ve);return}}catch(Jn){console.warn("[attachKyc] could not fetch verification status:",Jn?.message);}if(de){await Yn(),u(""),f(De);return}te("kyc_error",St.error.message,St.error.stripeErrorCode??St.error.code),f(ve);return}if(!(St&&Object.keys(St).length>0&&!St.error)){let sr=de?"l0":"l1";if(u("Verifying identity..."),(!Y.current||!H.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${sr} \u2014 missing customerIdRef or accessTokenRef`),!de)){te("kyc_error","Unable to verify identity. Please try again."),f(ve);return}let Jn=Y.current,Lo=H.current,yo=10,Pi=!1;if(Jn&&Lo)for(let Dc=0;Dc<yo;Dc++){try{let _u=(await ti(Jn,Lo)).kyc_tiers?.find(My=>My.tier===sr);if(_u?.verification_status==="verified"){Pi=!0;break}if(_u?.verification_status==="rejected"){if(de)break;console.warn(`[attachKyc] \u274C ${sr} rejected:`,_u?.verification_errors),te("kyc_error","KYC verification was rejected. Please try again."),f(ve);return}}catch(Zn){console.warn(`[attachKyc] ${sr} poll error:`,Zn?.message);}await new Promise(Zn=>setTimeout(Zn,2e3));}if(!Pi&&!de){console.warn(`[attachKyc] \u274C ${sr} verification timed out after`,yo,"attempts"),te("kyc_error","Identity verification is taking longer than expected. Please try again."),f(ve);return}await Yn(),u(""),f(de&&Pi?"session_params":De);return}u("Please review your KYC information...");let Kr=await l(null);if(Kr?.error){te("kyc_error",Kr.error.message,Kr.error.stripeErrorCode??Kr.error.code),f(ve);return}if(Kr?.status==="UpdateAddress"){te("kyc_error","Please update your address and resubmit."),f(ve);return}await Yn(),u(""),f(de?"session_params":De);}catch(lt){te("kyc_error",lt?.message??String(lt)),f(ve);}finally{v(false);}},[a,Bt,te,l,Yn]),bs=hs.useCallback(async()=>{let V=et.current||e?.email;if(!V)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(et.current),"config.email:",e?.email),false;try{let E=await op(V),de=await i(E);return de?.status==="Consented"&&de.customerId?(Y.current=de.customerId,Z(de.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",de?.status),!1)}catch(E){return console.warn("[reestablishLinkSession] failed:",E?.message),false}},[i,e?.email]),_c=hs.useCallback(async()=>{if(!Ke.current){Ke.current=true,v(true),Bt(),u("Launching identity verification...");try{let V=await c();if(V?.error?.message&&(/no active link consumer/i.test(V.error.message)||/not be verified/i.test(V.error.message))){if(u("Verifying identity..."),!await bs()){te("identity_error","Please verify your identity to continue.");return}V=await c();}if(V?.error){let de=V.error.message??"";if(/cancel/i.test(de)){u("");return}te("identity_error",de,V.error.code);return}u(""),ws.current?(ws.current=!1,f("session_params")):f("wallet");}catch(V){te("identity_error",V?.message??String(V));}finally{Ke.current=false,v(false);}}},[Bt,te,bs,c]),ws=hs.useRef(false);hs.useEffect(()=>{m==="identity"&&!x&&_c();},[m]);let Pc=hs.useCallback(async()=>{if(!Oe){te("validation_error","Please enter a wallet address.");return}v(true),Bt(),u("");try{let V=Oe.toLowerCase(),E=await p(V,Ae);if(E?.error){console.warn("[registerWallet] error:",E.error.message),te("wallet_error",E.error.message,E.error.code);return}u(""),f("kyc_offer");}catch(V){console.error("[registerWallet] exception:",V?.message??String(V)),te("wallet_error",V?.message??String(V));}finally{v(false);}},[Bt,te,Oe,Ae,p]);hs.useEffect(()=>{m==="wallet"&&me&&Oe&&Pc();},[m,me,Oe]);let ta=hs.useCallback(V=>{L.current=false,D.current=0;let E=0,de=async()=>{E+=1;let De=H.current;try{let ve=await Cm(V,De);if(L.current)return;D.current=0,ve.status==="fulfillment_complete"?(ce(ve),f("success")):y.current=setTimeout(de,3e3);}catch(ve){if(L.current)return;let lt=ve?.message??"";if((lt.includes("stripe_onramp_forbidden")||lt.includes("403"))&&await at()&&!L.current){y.current=setTimeout(de,1e3);return}if(D.current+=1,console.error(`[pollSessionStatus] poll #${E} error:`,lt),D.current>=yw){te("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}y.current=setTimeout(de,5e3);}};y.current=setTimeout(de,3e3);},[te,at]),Ru=hs.useCallback(()=>{if(Je.current==="processing"&&We?.id){if(!H.current){te("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Bt(),D.current=0,y.current&&(clearTimeout(y.current),y.current=null),ta(We.id);}},[Bt,te,ta,We?.id]),Ii=hs.useCallback(async V=>{v(true),Bt(),u("");try{u("Confirming purchase...");let E=await rt(de=>bm(V,de));ce(E),f("processing"),u(""),ta(E.id);}finally{v(false);}},[Bt,ta,rt]),hl=hs.useRef(false),Iu=hs.useCallback(async()=>{if(!(!We||hl.current)){hl.current=true;try{v(!0),Bt(),u("Refreshing quote...");let V=await rt(E=>ip(We.id,E));ce(V),await Ii(V.id);}catch{te("session_error","Something went wrong. Please try again."),f("quote");}finally{v(false),hl.current=false;}}},[Bt,te,Ii,We,rt]),pe=hs.useCallback(async(V=false,E,de)=>{let De=E??Ce;if(!De||isNaN(Number(De))||Number(De)<=0){te("validation_error","Please enter a valid amount.");return}E&&Dt(E),v(true),Bt(),u("");try{let ve=await Gt();if(ve.error){te("configuration_error",ve.error.message,ve.error.code);return}let lt;if(de)lt=de;else if(V){if(!e?.merchantIdentifier?.trim()){te("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),f("session_params");return}u("Opening Apple Pay...");let St={applePay:{merchantCountryCode:"US",currencyCode:Wt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${st.toUpperCase()} purchase + fees`,amount:De}]}},Lr=await g("PlatformPay",St);if(Lr?.error){let Kr=Lr.error.message??"",an=Lr.error.code??"";/cancel/i.test(Kr)||/cancel/i.test(an)||(te("payment_error",Kr,an),f("session_params"));return}if(!Lr?.displayData)return;u("Creating payment token...");let oo=await T();if(oo?.error){te("payment_error",oo.error.message,oo.error.code),f("session_params");return}lt=oo.cryptoPaymentToken;}else {u("Select a payment method...");let St=await g("Card");if(St?.error){let oo=St.error.message??"",Kr=St.error.code??"";/cancel/i.test(oo)||/cancel/i.test(Kr)||(te("payment_error",oo,Kr),f("session_params"));return}if(!St?.displayData)return;u("Creating payment token...");let Lr=await T();if(Lr?.error){te("payment_error",Lr.error.message,Lr.error.code),f("session_params");return}lt=Lr.cryptoPaymentToken;}u("Creating onramp session...");let mt=_e.current||Oe;if(!mt){te("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let ir=await rt(St=>ym({cryptoCustomerId:Y.current,paymentToken:lt,sourceAmount:Number(De),sourceCurrency:Wt,destinationCurrency:st,walletAddress:mt,destinationNetwork:Ae},St));ce(ir),u(""),V?await Ii(ir.id):f("quote");}catch{te("session_error","Something went wrong. Please try again."),f("session_params");}finally{v(false),u("");}},[Bt,Gt,g,T,st,te,Ii,Dt,Ce,Wt,Oe,Ae,rt,e?.merchantIdentifier]),Qe=hs.useCallback(async()=>{v(true),Bt(),u("Select a payment method...");try{let V=await Gt();if(V.error)return te("configuration_error",V.error.message,V.error.code),null;let E=await g("Card");if(E?.error?.message&&(/no active link consumer/i.test(E.error.message)||/not be verified/i.test(E.error.message))){if(!await bs())return te("authorization_error","Please verify your identity to add a payment method."),null;E=await g("Card");}if(E?.error){let lt=E.error.message??"",mt=E.error.code??"";return /cancel/i.test(lt)||/cancel/i.test(mt)||te("payment_error",lt,mt),null}if(!E?.displayData)return null;let De=E.displayData;u("Saving payment method...");let ve=await T();return ve?.error?(te("payment_error",ve.error.message,ve.error.code),null):{token:ve.cryptoPaymentToken,sublabel:De.sublabel??""}}catch(V){return te("session_error",V?.message??String(V)),null}finally{v(false),u("");}},[Bt,Gt,g,T,te,bs]),hr=hs.useCallback(async()=>{if(We){v(true),Bt(),u("");try{let V=await rt(E=>ip(We.id,E));ce(V);}catch{te("session_error","Something went wrong. Please try again.");}finally{v(false);}}},[Bt,te,We,rt]),kn=hs.useCallback(()=>{L.current=true,D.current=0,y.current&&(clearTimeout(y.current),y.current=null),f(r),v(false),S(false),u(""),C(null),O(e?.email??""),et.current=e?.email??"",F(e?.phone??""),U(""),Q("US"),Z(""),Y.current="",G(""),H.current="",ne.current="",J(false),qe(false),Ee.current=null,se(V=>V+1),Xt(kp),Re(""),_e.current="",Ve.current=false,fe(stripeReactNative.Onramp.CryptoNetwork.ethereum),Dt(e?.defaultSourceAmount??"100"),ft(e?.defaultSourceCurrency??"usd"),Ut(e?.defaultDestinationCurrency??"usdc"),tt(""),ae(void 0),j(void 0),ce(null),be.current+=1,He.current=false,Ke.current=false,je.current=false;},[e,r]),Fc=hs.useCallback(()=>{ws.current=true,f("kyc_offer");},[]),_i=hs.useCallback(async()=>{await ba(),Ui=null,xe.current=null,Tp=true,Ge.current=true,L.current=true,D.current=0,y.current&&(clearTimeout(y.current),y.current=null),be.current+=1,He.current=false,Ke.current=false,je.current=false,H.current="",ne.current="",Y.current="",_e.current="",Ve.current=false,Ee.current=null,G(""),Z(""),O(e?.email??""),et.current=e?.email??"",F(e?.phone??""),U(""),Q("US"),ce(null),C(null),v(false),S(false),u(""),Xt(kp),Re(""),J(false),qe(false),se(V=>V+1),tt(""),ae(void 0),j(void 0),f(r);},[e?.email,e?.phone,r]);return {step:m,restoring:w,loading:x,status:R,error:d,email:b,phone:A,fullName:_,country:W,customerId:ze,accessToken:Ne,session:We,kycData:Ye,walletAddress:Oe,resolvedRecipientAddress:Pe,walletNetwork:Ae,sourceAmount:Ce,sourceCurrency:Wt,destinationCurrency:st,tokenIconUrl:Fe,networkIconUrl:Ue,applePaySupported:Se,walletReady:me,walletLoading:Te,setStep:f,setStatus:u,setEmail:O,setPhone:F,setFullName:U,setCountry:Q,setWalletAddress:Re,setWalletNetwork:fe,setSourceAmount:Dt,setSourceCurrency:ft,setDestinationCurrency:Ut,checkEmail:Er,register:ea,attachKyc:Ic,verifyIdentity:_c,requestKYCUpgrade:Fc,kycUpgradeMode:ws,logout:_i,registerWallet:Pc,collectPaymentMethod:pe,addPaymentMethod:Qe,refreshQuote:hr,confirmCheckout:Iu,reset:kn,clearError:Bt,emitComplete:Xs,resumeFulfillmentPolling:Ru,amountFirst:t,switchingAccount:I}}function Wm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=In(),{colors:a,fonts:l,components:c}=B(),p=c.input.placeholderColor,[g,T]=hs.useState(e.dobMonth??""),[m,f]=hs.useState(e.dobDay??""),[w,k]=hs.useState(e.dobYear??""),[x,v]=hs.useState(e.idNumber??""),[I,S]=hs.useState(null),R=hs.useRef(null),u=hs.useRef(null),d=hs.useRef(null),C=g.length===2&&m.length===2&&w.length===4&&x.trim().length>0,b=()=>{if(!C)return;let A=parseInt(g,10),F=parseInt(m,10),_=parseInt(w,10),U=new Date().getFullYear();if(A<1||A>12){S("Please enter a valid month (01\u201312).");return}if(F<1||F>31){S("Please enter a valid day (01\u201331).");return}if(_<1900||_>U){S(`Please enter a valid year (1900\u2013${U}).`);return}S(null),o({dobMonth:g,dobDay:m,dobYear:w,idNumber:x});},O=I||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(Qt,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(xt,{style:i.form.flex,contentContainerStyle:Vn.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:Vn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:Vn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:Vn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,Vn.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:A=>{let F=A.replace(/\D/g,"").slice(0,2);T(F),F.length===2&&R.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Vn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:R,style:[i.form.input,Vn.dobInput],placeholder:"DD",placeholderTextColor:p,value:m,onChangeText:A=>{let F=A.replace(/\D/g,"").slice(0,2);f(F),F.length===2&&u.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Vn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:[i.form.input,Vn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:w,onChangeText:A=>{let F=A.replace(/\D/g,"").slice(0,4);k(F),F.length===4&&d.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Vn.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:p,value:x,onChangeText:v,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:b,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."})]}),O?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:O}):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(bt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!C&&i.form.continueBtnDisabled],onPress:b,disabled:!C,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!C&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Vn=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 Em({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=hs.useRef(new reactNative.Animated.Value(.3)).current;return hs.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:[Ot.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:Ot.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Ot.skeletonLine,{width:"60%"}]})]})}function Mm({onRefresh:e,colors:t,fonts:r}){let[o,n]=hs.useState(10),s=hs.useRef(null);hs.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=hs.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:Ot.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(sa,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[Ot.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function Hm({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:T=false,currentLimit:m}){let f=In(),{colors:w,fonts:k,components:x}=B(),v=[Ot.card,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius??12,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],I=[...v,{opacity:.5}],S=l==="verified",R=l==="pending",u=l==="rejected",d=c==="verified",C=c==="pending",b=S&&d,O=!S,A=!d,F=S,_=(T||S)&&!b,U=W=>`$${W.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:f.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Ot.content,children:[m!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[Ot.limitBadge,{backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth,borderRadius:x.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.limitLabel,{color:w.foregroundMuted,fontFamily:k.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ot.limitValue,{color:w.foreground,fontFamily:k.semibold}],children:[U(m)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.subtitle,{color:w.foregroundMuted,fontFamily:k.regular}],children:i?"Checking your verification status...":b?"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(Em,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth}),jsxRuntime.jsx(Em,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[O&&(R?jsxRuntime.jsxs(reactNative.View,{style:v,children:[jsxRuntime.jsxs(reactNative.View,{style:Ot.pendingHeader,children:[jsxRuntime.jsx(bo,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardTitle,{color:w.foreground,fontFamily:k.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(Mm,{onRefresh:n,colors:w,fonts:k}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ot.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardBody,{color:w.foregroundMuted,fontFamily:k.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(bt,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[v,Ot.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(bo,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ot.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardTitle,{color:w.foreground,fontFamily:k.semibold}],children:u?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardBody,{color:w.foregroundMuted,fontFamily:k.regular}],children:u?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(_r,{size:18,color:w.foregroundMuted,strokeWidth:2})]})),A&&(C?jsxRuntime.jsxs(reactNative.View,{style:v,children:[jsxRuntime.jsxs(reactNative.View,{style:Ot.pendingHeader,children:[jsxRuntime.jsx(Lc,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardTitle,{color:w.foreground,fontFamily:k.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(Mm,{onRefresh:n,colors:w,fonts:k}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ot.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardBody,{color:w.foregroundMuted,fontFamily:k.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(bt,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):F?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[v,Ot.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Lc,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ot.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardTitle,{color:w.foreground,fontFamily:k.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardBody,{color:w.foregroundMuted,fontFamily:k.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(_r,{size:18,color:w.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[I,Ot.cardRow],children:[jsxRuntime.jsx(Lc,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ot.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardTitle,{color:w.foregroundMuted,fontFamily:k.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.cardBody,{color:w.foregroundMuted,fontFamily:k.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ot.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:Ot.loaderRow,children:[jsxRuntime.jsx(bt,{size:24,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):b?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.continueBtnText,children:"Done"})}):_?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Ot=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 cd={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 $m({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=B(),a=[gn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:gn.logoRow,children:jsxRuntime.jsx(Yf,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:gn.scroll,contentContainerStyle:gn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[gn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[gn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[gn.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:[gn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[gn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[gn.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(cd.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(cd.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(cd.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(cd.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:gn.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 gn=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 qm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=B();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(bt,{size:56,strokeWidth:3}),jsxRuntime.jsx(wo,{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(Qt,{onPress:c}),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(bt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.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(wo,{error:n,progress:s,loading:o})]})]})})}function Km({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{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(bt,{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(wo,{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 Ym({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:g}=B(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx(Qt,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:Kc}),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(bt,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.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(Yc,{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(wo,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Jm({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=B(),g=t.transaction_details,T=Qc(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:c??l,title:"Review your purchase",variant:c?"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(ma,{currency:g.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(pn,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(pn,{quote:e.quote,label:"You receive",value:`${T} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(pn,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(pn,{quote:e.quote,label:"Transaction fee",value:`$${g.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(bt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.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(wo,{error:o,progress:n,loading:r})]})]})}function Zm({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:c}){let p=B(),{colors:g,fonts:T,components:m}=p,[f,w]=hs.useState("");hs.useEffect(()=>{if(t)return;let v=f?`+1${f}`:"";a(v);},[f,a,t]);let k=hs.useCallback(v=>{w(v.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(bt,{size:56,strokeWidth:3}),jsxRuntime.jsx(wo,{error:o,progress:n,loading:r})]})]});let x=f.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(Qt,{onPress:c}),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:Ul.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ul.countryPrefix,{backgroundColor:m.card.backgroundColor,borderColor:m.input.borderColor,borderRadius:m.input.borderRadius,borderWidth:m.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Ul.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Ul.dialCode,{color:g.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Ul.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:k,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>x&&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(bt,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!x&&e.form.continueBtnDisabled],onPress:l,disabled:!x,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!x&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wo,{error:o,progress:n,loading:r})]})]})})}var Ul=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 qw({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=B(),n=e.toLowerCase(),s=Gc[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:[An.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[An.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[An.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(pt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Xm({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:c}=B(),p=t.transaction_details,g=Qc(p.destination_amount,p.destination_currency),T=r||o||"";fa(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(xt,{style:e.form.flex,contentContainerStyle:An.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:An.iconSection,children:[jsxRuntime.jsx(qw,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:An.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[An.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[An.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[An.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Yc,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.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},An.detailCard],children:[jsxRuntime.jsx(pn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(pn,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(pn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(pn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(rp,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(rp,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(pn,{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 An=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 eh({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:g}){let{colors:T,components:m}=B();if(t){let f=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Qt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!f&&jsxRuntime.jsx(bt,{size:56,strokeWidth:3}),jsxRuntime.jsx(wo,{error:o,progress:n,loading:r})]}),f&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,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(Qt,{onPress:g}),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:m.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:$c.map(f=>{let w=i===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,w&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(f.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,w&&e.wallet.rowTextSelected],children:f.label}),w&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(pt,{size:14,color:m.container.buttonTitleColor,strokeWidth:2.5})})]},f.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(bt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wo,{error:o,progress:n,loading:r})]})]})})}function hd({config:e,onClose:t}){let r=B(),o=In(),{step:n,restoring:s,loading:i,status:a,error:l,email:c,phone:p,session:g,kycData:T,walletAddress:m,resolvedRecipientAddress:f,walletNetwork:w,sourceAmount:k,sourceCurrency:x,destinationCurrency:v,tokenIconUrl:I,networkIconUrl:S,applePaySupported:R,setStep:u,setEmail:d,setPhone:C,setWalletAddress:b,setWalletNetwork:O,setSourceAmount:A,setDestinationCurrency:F,checkEmail:_,register:U,attachKyc:W,verifyIdentity:Q,registerWallet:ze,collectPaymentMethod:Z,addPaymentMethod:Ne,confirmCheckout:G,reset:ne,emitComplete:H,resumeFulfillmentPolling:Y,amountFirst:me,customerId:J,accessToken:Te,requestKYCUpgrade:qe,kycUpgradeMode:be,logout:He,clearError:Ke,switchingAccount:je}=sd(e),Ge=!!e?.email&&!je,et=!!e?.phone,Ve=!!e?.publishableKey&&!!e?.externalUserId,[Ee,_e]=hs.useState(void 0),[we,xe]=hs.useState(void 0),[nt,se]=hs.useState([]),[Ye,Xt]=hs.useState(false),[Oe,Re]=hs.useState(false),[Pe,tt]=hs.useState(null),[Ae,fe]=hs.useState(null),[Ce,Dt]=hs.useState(null),[Wt,ft]=hs.useState(false),st=hs.useCallback(async()=>{await He(),t?.();},[He,t]);hs.useEffect(()=>{n!=="kyc_offer"||!J||!Te||(ft(true),ti(J,Te).then(ae=>{let Ue=ae.kyc_tiers??[],j=Ue.find(y=>y.tier==="l0"),Se=Ue.find(y=>y.tier==="l1"),P=Ue.find(y=>y.tier==="l2");j?.verification_status&&tt(j.verification_status),Se?.verification_status&&fe(Se.verification_status),P?.verification_status&&Dt(P.verification_status);}).catch(ae=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",ae?.message);}).finally(()=>ft(false)),m&&sp({destinationNetwork:w||"ethereum",walletAddress:m,accessToken:Te,cryptoCustomerId:J}).then(ae=>{let Ue=ae.limits?.usd;if(Ue?.card?.length){let j=Math.max(...Ue.card.map(Se=>Se.limit));_e(j);}}).catch(ae=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",ae?.message);}));},[n,J,Te,m,w]),hs.useEffect(()=>{if(s||n!=="session_params"||!J||!Te)return;let ae=j=>{let Se=j?.message??"";return Se.includes("stripe_onramp_forbidden")||Se.includes("403")},Ue=j=>{ae(j)&&st();};ti(J,Te).then(j=>{let Se=j.kyc_tiers??[],P=Se.find(M=>M.tier==="l0"),y=Se.find(M=>M.tier==="l1"),L=Se.find(M=>M.tier==="l2"),D=!!y?.verification_status&&y.verification_status!=="not_started",N=L?.verification_status==="verified";Xt(D),Re(!!N),P?.verification_status&&tt(P.verification_status),y?.verification_status&&fe(y.verification_status),L?.verification_status&&Dt(L.verification_status);}).catch(j=>{console.warn("[OnrampScreen] customer fetch error:",j?.message),Ue(j);}),ap(J,Te).then(j=>{se(j.data??[]);}).catch(j=>{console.warn("[OnrampScreen] payment_tokens error:",j?.message),Ue(j);}),m&&sp({destinationNetwork:w||"ethereum",walletAddress:m,accessToken:Te,cryptoCustomerId:J}).then(j=>{let Se=j.limits?.usd;if(Se?.card?.length){let P=Math.max(...Se.card.map(y=>y.limit));_e(P);}}).catch(j=>{console.warn("[OnrampScreen] transaction_limits error:",j?.message),Ue(j);}),Rl(e?.publishableKey).then(j=>{let Se=j.data?.find(P=>P.currency_code==="usd");Se&&xe(Se.minimum_amount);}).catch(j=>{console.warn("[OnrampScreen] fiat_currencies error:",j?.message);});},[s,n,J,Te,m,w,ne,st]);let Ut=async()=>{if(!(!J||!Te))try{let ae=await ap(J,Te);se(ae.data??[]);}catch(ae){console.warn("[OnrampScreen] payment_tokens refresh error:",ae?.message);let Ue=ae?.message??"";(Ue.includes("stripe_onramp_forbidden")||Ue.includes("403"))&&st();}},We=async()=>{let ae=await Ne();return ae&&await Ut(),ae},ce=e?.skipSuccessConfirmation===true;hs.useEffect(()=>{n==="success"&&ce&&g&&(H(g),ne(),t?.());},[n,ce,g,H,ne,t]),hs.useEffect(()=>{n==="register"&&et&&U();},[n,et,U]);let Fe=()=>{ne(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[Xw.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(bt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx($m,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>u("register"),onClose:()=>u("email")});if(n==="email")return jsxRuntime.jsx(qm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Ge,loading:i,error:l,status:a,email:c,setEmail:d,checkEmail:_,onClose:Fe});if(n==="register")return jsxRuntime.jsx(Zm,{styles:o,hasPrefilledPhone:et,loading:i,error:l,status:a,email:c,phone:p,setPhone:C,register:U,onClose:Fe});if(n==="kyc")return jsxRuntime.jsx(id,{initialData:T,loading:i,onComplete:W,onCancel:Fe});if(n==="kyc_offer"){let j=Pe==="verified"||Ae==="verified"||Ce==="verified",Se=()=>{be.current&&(be.current=false),u("session_params");};return jsxRuntime.jsx(Hm,{onSelectL1:()=>u("kyc_l1"),onSelectL2:()=>{be.current=true,u("identity");},onSkip:Se,onClose:()=>{be.current?(be.current=false,u("session_params")):j?Se():Fe();},onRefresh:()=>{!J||!Te||(ft(true),ti(J,Te).then(L=>{let D=L.kyc_tiers??[],N=D.find(Je=>Je.tier==="l0"),M=D.find(Je=>Je.tier==="l1"),Ie=D.find(Je=>Je.tier==="l2");N?.verification_status&&tt(N.verification_status),M?.verification_status&&fe(M.verification_status),Ie?.verification_status&&Dt(Ie.verification_status);}).catch(L=>{console.warn("[OnrampScreen] refresh customer fetch error:",L?.message);}).finally(()=>ft(false)));},loading:i,loadingTiers:Wt,error:l?.message,l1Status:Ae??"not_started",l2Status:Ce??"not_started",l1Completed:Ye,l2Completed:Oe,canPurchase:j,currentLimit:j?Ee:void 0})}if(n==="kyc_l1"){let ae=be.current?"session_params":"wallet";return jsxRuntime.jsx(Wm,{initialData:T,loading:i,error:l?.message,onComplete:Ue=>{be.current&&(be.current=false),W(Ue,ae);},onCancel:()=>{Ke(),u("kyc_offer");},onClose:Fe})}return n==="identity"?jsxRuntime.jsx(Km,{styles:o,loading:i,status:a,error:l,verifyIdentity:Q,onClose:()=>{be.current?(be.current=false,u("session_params")):Fe();}}):n==="wallet"?jsxRuntime.jsx(eh,{styles:o,hasAutoWallet:Ve,loading:i,error:l,status:a,walletAddress:m,walletNetwork:w,setWalletAddress:b,setWalletNetwork:O,setDestinationCurrency:F,registerWallet:ze,onClose:Fe}):n==="session_params"?jsxRuntime.jsx(nd,{initialAmount:k,currency:x,applePaySupported:R,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:we,maxAmount:Ee,paymentTokens:nt,onAddPaymentMethod:We,onCollectPayment:(ae,Ue)=>{Z(ae,Ue);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(ae,Ue)=>{if(me&&!J)A(ae),u("email");else {let j=Ue==="apple_pay";Z(j,ae,!j&&Ue?Ue:void 0);}},onCancel:Fe,accessToken:Te,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:st,onRequestKYC:qe,showSwitchAccount:!Ge,inputDisabled:(Pe!==null||Ae!==null)&&Pe!=="verified"&&Ae!=="verified"&&Ce!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(Jm,{styles:o,session:g,loading:i,error:l,status:a,confirmCheckout:G,tokenIconUrl:I,networkIconUrl:S,onClose:Fe,onBack:()=>u("session_params")}):n==="processing"?jsxRuntime.jsx(Ym,{styles:o,error:l,status:a,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??v,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:I,networkIconUrl:S,onClose:Fe,onRetryStatusCheck:Y}):n==="success"&&g&&!ce?jsxRuntime.jsx(Xm,{styles:o,session:g,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:I,networkIconUrl:S,onDone:()=>{H(g),ne(),t?.();}}):null}var Xw=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function th(){try{let e=eC__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 gd({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:g,onClose:T,merchantIdentifier:m="",urlScheme:f="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:k=false,appName:x}){let{colors:v,fonts:I,components:S}=B(),R=e||Mc(),u=hs.useMemo(()=>{let F=m.trim();return F.length>0?F:th()??""},[m]),[d,C]=hs.useState("loading"),[b,O]=hs.useState(null);hs.useEffect(()=>{let F=false;async function _(){try{R&&(Jc(R),Zc(vl()));let U=await Xc();if(F)return;let W=u.trim();if(await stripeReactNative.initStripe({publishableKey:U,urlScheme:f,...W?{merchantIdentifier:W}:{}}),F)return;C("ready");}catch(U){if(F)return;console.error("[StripeOnramp] Init failed:",U),O(U?.message??"Failed to load Stripe configuration"),C("error");}}return _(),()=>{F=true;}},[R,u,f]);let A=hs.useMemo(()=>{let F={publishableKey:R,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:c,onError:p,onStepChange:g};return a&&(F.destinationTokenAddress=a),l&&(F.recipientAddress=l),t&&(F.email=t),r&&(F.phone=r),n&&(F.flowOrder=n),w&&(F.paymentSelectorPosition=w),F.skipSuccessConfirmation=k,F.merchantIdentifier=u,x&&(F.merchantDisplayName=x),F},[R,o,s,i,a,l,t,r,n,w,k,u,x,c,p,g]);return d==="error"?jsxRuntime.jsxs(reactNative.View,{style:[xa.centered,{backgroundColor:v.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[xa.errorText,{color:v.error,fontFamily:I.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[xa.errorDetail,{color:v.foregroundMuted,fontFamily:I.regular}],children:b}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[xa.retryBtn,{backgroundColor:S.button.primaryBackground,borderRadius:S.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[xa.retryBtnText,{color:S.button.primaryText,fontFamily:I.medium}],children:"Go Back"})})]}):d==="loading"?jsxRuntime.jsx(reactNative.View,{style:[xa.centered,{backgroundColor:v.background}],children:jsxRuntime.jsx(bt,{size:56,strokeWidth:3,gradientFrom:v.primary,gradientTo:v.primary})}):jsxRuntime.jsx(hd,{config:A,onClose:T})}var xa=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 ih(){let{configure:e}=stripeReactNative.useOnramp(),t=hs.useRef(false);return hs.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 sh="__unifold_stripe_onramp__";function yd(e){globalThis[sh]=e;}function ah(){return globalThis[sh]}yd(gd);var ji=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 Is,$i,va,lh,cC=(lh=class extends ji{constructor(){super();X(this,Is);X(this,$i);X(this,va);z(this,va,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){h(this,$i)||this.setEventListener(h(this,va));}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,$i))==null||t.call(this),z(this,$i,void 0));}setEventListener(t){var r;z(this,va,t),(r=h(this,$i))==null||r.call(this),z(this,$i,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){h(this,Is)!==t&&(z(this,Is,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof h(this,Is)=="boolean"?h(this,Is):globalThis.document?.visibilityState!=="hidden"}},Is=new WeakMap,$i=new WeakMap,va=new WeakMap,lh),bd=new cC;var dC={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Wn,_s,ch,uC=(ch=class{constructor(){X(this,Wn,dC);X(this,_s,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&h(this,_s)&&e!==h(this,Wn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:h(this,Wn),provider:e}),z(this,Wn,e),process.env.NODE_ENV!=="production"&&z(this,_s,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,_s,true),h(this,Wn).setTimeout(e,t)}clearTimeout(e){h(this,Wn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,_s,true),h(this,Wn).setInterval(e,t)}clearInterval(e){h(this,Wn).clearInterval(e);}},Wn=new WeakMap,_s=new WeakMap,ch),Nl=new uC;function dh(e){setTimeout(e,0);}var fh=typeof window>"u"||"Deno"in globalThis;function Po(){}function mh(e,t){return typeof e=="function"?e(t):e}function hh(e){return typeof e=="number"&&e>=0&&e!==1/0}function gh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Hl(e,t){return typeof e=="function"?e(t):e}function yh(e,t){return typeof e=="function"?e(t):e}function Pp(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==jl(i,t.options))return false}else if(!_a(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 Fp(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Ra(t.options.mutationKey)!==Ra(s))return false}else if(!_a(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function jl(e,t){return (t?.queryKeyHashFn||Ra)(e)}function Ra(e){return JSON.stringify(e,(t,r)=>_p(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function _a(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>_a(e[r],t[r])):false}var pC=Object.prototype.hasOwnProperty;function Ip(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=uh(e)&&uh(t);if(!o&&!(_p(e)&&_p(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):{},c=0;for(let p=0;p<a;p++){let g=o?p:i[p],T=e[g],m=t[g];if(T===m){l[g]=T,(o?p<s:pC.call(e,g))&&c++;continue}if(T===null||m===null||typeof T!="object"||typeof m!="object"){l[g]=m;continue}let f=Ip(T,m,r+1);l[g]=f,f===T&&c++;}return s===a&&c===s?e:l}function uh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function _p(e){if(!ph(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!ph(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ph(e){return Object.prototype.toString.call(e)==="[object Object]"}function bh(e){return new Promise(t=>{Nl.setTimeout(t,e);})}function wh(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 Ip(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 Ip(e,t)}return t}function Ch(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Sh(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Ia=Symbol();function wd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ia&&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===Ia?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Th(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 Cd=(()=>{let e=()=>fh;return {isServer(){return e()},setIsServer(t){e=t;}}})();function kh(){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 fC=dh;function mC(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=fC,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 Wr=mC();var Pa,qi,Fa,xh,hC=(xh=class extends ji{constructor(){super();X(this,Pa,true);X(this,qi);X(this,Fa);z(this,Fa,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(){h(this,qi)||this.setEventListener(h(this,Fa));}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,qi))==null||t.call(this),z(this,qi,void 0));}setEventListener(t){var r;z(this,Fa,t),(r=h(this,qi))==null||r.call(this),z(this,qi,t(this.setOnline.bind(this)));}setOnline(t){h(this,Pa)!==t&&(z(this,Pa,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return h(this,Pa)}},Pa=new WeakMap,qi=new WeakMap,Fa=new WeakMap,xh),Da=new hC;function gC(e){return Math.min(1e3*2**e,3e4)}function Dp(e){return (e??"online")==="online"?Da.isOnline():true}var Sd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Td(e){let t=false,r=0,o,n=kh(),s=()=>n.status!=="pending",i=w=>{if(!s()){let k=new Sd(w);T(k),e.onCancel?.(k);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>bd.isFocused()&&(e.networkMode==="always"||Da.isOnline())&&e.canRun(),p=()=>Dp(e.networkMode)&&e.canRun(),g=w=>{s()||(o?.(),n.resolve(w));},T=w=>{s()||(o?.(),n.reject(w));},m=()=>new Promise(w=>{o=k=>{(s()||c())&&w(k);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),f=()=>{if(s())return;let w,k=r===0?e.initialPromise:void 0;try{w=k??e.fn();}catch(x){w=Promise.reject(x);}Promise.resolve(w).then(g).catch(x=>{if(s())return;let v=e.retry??(Cd.isServer()?0:3),I=e.retryDelay??gC,S=typeof I=="function"?I(r,x):I,R=v===true||typeof v=="number"&&r<v||typeof v=="function"&&v(r,x);if(t||!R){T(x);return}r++,e.onFail?.(r,x),bh(S).then(()=>c()?void 0:m()).then(()=>{t?T(x):f();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():m().then(f),n)}}var Ps,vh,kd=(vh=class{constructor(){X(this,Ps);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),hh(this.gcTime)&&z(this,Ps,Nl.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Cd.isServer()?1/0:300*1e3));}clearGcTimeout(){h(this,Ps)!==void 0&&(Nl.clearTimeout(h(this,Ps)),z(this,Ps,void 0));}},Ps=new WeakMap,vh);function Ih(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,c=async()=>{let p=false,g=f=>{Th(f,()=>t.signal,()=>p=true);},T=wd(t.options,t.fetchOptions),m=async(f,w,k)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&f.pages.length)return Promise.resolve(f);let v=(()=>{let u={client:t.client,queryKey:t.queryKey,pageParam:w,direction:k?"backward":"forward",meta:t.options.meta};return g(u),u})(),I=await T(v),{maxPages:S}=t.options,R=k?Sh:Ch;return {pages:R(f.pages,I,S),pageParams:R(f.pageParams,w,S)}};if(n&&s.length){let f=n==="backward",w=f?yC:Rh,k={pages:s,pageParams:i},x=w(o,k);a=await m(k,x,f);}else {let f=e??s.length;do{let w=l===0?i[0]??o.initialPageParam:Rh(o,a);if(l>0&&w==null)break;a=await m(a,w),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Rh(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 yC(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Va,Fs,Oa,tn,Ds,Xr,$l,Vs,No,Vh,si,Fh,Dh=(Fh=class extends kd{constructor(t){super();X(this,No);X(this,Va);X(this,Fs);X(this,Oa);X(this,tn);X(this,Ds);X(this,Xr);X(this,$l);X(this,Vs);z(this,Vs,false),z(this,$l,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,Ds,t.client),z(this,tn,h(this,Ds).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Fs,Ph(this.options)),this.state=t.state??h(this,Fs),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return h(this,Va)}get promise(){return h(this,Xr)?.promise}setOptions(t){if(this.options={...h(this,$l),...t},t?._type&&z(this,Va,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Ph(this.options);r.data!==void 0&&(this.setState(_h(r.data,r.dataUpdatedAt)),z(this,Fs,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&h(this,tn).remove(this);}setData(t,r){let o=wh(this.state.data,t,this.options);return ut(this,No,si).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){ut(this,No,si).call(this,{type:"setState",state:t});}cancel(t){let r=h(this,Xr)?.promise;return h(this,Xr)?.cancel(t),r?r.then(Po).catch(Po):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return h(this,Fs)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>yh(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ia||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Hl(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:!gh(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),h(this,Xr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),h(this,Xr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),h(this,tn).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(h(this,Xr)&&(h(this,Vs)||ut(this,No,Vh).call(this)?h(this,Xr).cancel({revert:true}):h(this,Xr).cancelRetry()),this.scheduleGc()),h(this,tn).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ut(this,No,si).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&h(this,Xr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(h(this,Xr))return h(this,Xr).continueRetry(),h(this,Xr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.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=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(z(this,Vs,true),o.signal)});},s=()=>{let c=wd(this.options,r),g=(()=>{let T={client:h(this,Ds),queryKey:this.queryKey,meta:this.meta};return n(T),T})();return z(this,Vs,false),this.options.persister?this.options.persister(c,g,this):c(g)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:h(this,Ds),state:this.state,fetchFn:s};return n(c),c})();(h(this,Va)==="infinite"?Ih(this.options.pages):this.options.behavior)?.onFetch(a,this),z(this,Oa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&ut(this,No,si).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),z(this,Xr,Td({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof Sd&&c.revert&&this.setState({...h(this,Oa),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{ut(this,No,si).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{ut(this,No,si).call(this,{type:"pause"});},onContinue:()=>{ut(this,No,si).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await h(this,Xr).start();if(c===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(c),h(this,tn).config.onSuccess?.(c,this),h(this,tn).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof Sd){if(c.silent)return h(this,Xr).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw ut(this,No,si).call(this,{type:"error",error:c}),h(this,tn).config.onError?.(c,this),h(this,tn).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Va=new WeakMap,Fs=new WeakMap,Oa=new WeakMap,tn=new WeakMap,Ds=new WeakMap,Xr=new WeakMap,$l=new WeakMap,Vs=new WeakMap,No=new WeakSet,Vh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},si=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,...bC(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,..._h(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return z(this,Oa,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),Wr.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),h(this,tn).notify({query:this,type:"updated",action:t});});},Fh);function bC(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Dp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function _h(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Ph(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 ql,En,fo,Os,Mn,Qi,Oh,Lh=(Oh=class extends kd{constructor(t){super();X(this,Mn);X(this,ql);X(this,En);X(this,fo);X(this,Os);z(this,ql,t.client),this.mutationId=t.mutationId,z(this,fo,t.mutationCache),z(this,En,[]),this.state=t.state||wC(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){h(this,En).includes(t)||(h(this,En).push(t),this.clearGcTimeout(),h(this,fo).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){z(this,En,h(this,En).filter(r=>r!==t)),this.scheduleGc(),h(this,fo).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){h(this,En).length||(this.state.status==="pending"?this.scheduleGc():h(this,fo).remove(this));}continue(){return h(this,Os)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{ut(this,Mn,Qi).call(this,{type:"continue"});},o={client:h(this,ql),meta:this.options.meta,mutationKey:this.options.mutationKey};z(this,Os,Td({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{ut(this,Mn,Qi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{ut(this,Mn,Qi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>h(this,fo).canRun(this)}));let n=this.state.status==="pending",s=!h(this,Os).canStart();try{if(n)r();else {ut(this,Mn,Qi).call(this,{type:"pending",variables:t,isPaused:s}),h(this,fo).config.onMutate&&await h(this,fo).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&ut(this,Mn,Qi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await h(this,Os).start();return await h(this,fo).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await h(this,fo).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),ut(this,Mn,Qi).call(this,{type:"success",data:i}),i}catch(i){try{await h(this,fo).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 h(this,fo).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 ut(this,Mn,Qi).call(this,{type:"error",error:i}),i}finally{h(this,fo).runNext(this);}}},ql=new WeakMap,En=new WeakMap,fo=new WeakMap,Os=new WeakMap,Mn=new WeakSet,Qi=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),Wr.batch(()=>{h(this,En).forEach(o=>{o.onMutationUpdate(t);}),h(this,fo).notify({mutation:this,type:"updated",action:t});});},Oh);function wC(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ai,yn,Ql,Bh,Ah=(Bh=class extends ji{constructor(t={}){super();X(this,ai);X(this,yn);X(this,Ql);this.config=t,z(this,ai,new Set),z(this,yn,new Map),z(this,Ql,0);}build(t,r,o){let n=new Lh({client:t,mutationCache:this,mutationId:++gl(this,Ql)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){h(this,ai).add(t);let r=xd(t);if(typeof r=="string"){let o=h(this,yn).get(r);o?o.push(t):h(this,yn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(h(this,ai).delete(t)){let r=xd(t);if(typeof r=="string"){let o=h(this,yn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&h(this,yn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=xd(t);if(typeof r=="string"){let n=h(this,yn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=xd(t);return typeof r=="string"?h(this,yn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Wr.batch(()=>{h(this,ai).forEach(t=>{this.notify({type:"removed",mutation:t});}),h(this,ai).clear(),h(this,yn).clear();});}getAll(){return Array.from(h(this,ai))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Fp(r,o))}findAll(t={}){return this.getAll().filter(r=>Fp(t,r))}notify(t){Wr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Wr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Po))))}},ai=new WeakMap,yn=new WeakMap,Ql=new WeakMap,Bh);function xd(e){return e.options.scope?.id}var zn,Wh,Eh=(Wh=class extends ji{constructor(t={}){super();X(this,zn);this.config=t,z(this,zn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??jl(n,r),i=this.get(s);return i||(i=new Dh({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){h(this,zn).has(t.queryHash)||(h(this,zn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=h(this,zn).get(t.queryHash);r&&(t.destroy(),r===t&&h(this,zn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Wr.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return h(this,zn).get(t)}getAll(){return [...h(this,zn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Pp(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Pp(t,o)):r}notify(t){Wr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Wr.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Wr.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},zn=new WeakMap,Wh);var xr,Ki,Gi,La,Ba,Yi,Aa,Wa,Mh,Vp=(Mh=class{constructor(e={}){X(this,xr);X(this,Ki);X(this,Gi);X(this,La);X(this,Ba);X(this,Yi);X(this,Aa);X(this,Wa);z(this,xr,e.queryCache||new Eh),z(this,Ki,e.mutationCache||new Ah),z(this,Gi,e.defaultOptions||{}),z(this,La,new Map),z(this,Ba,new Map),z(this,Yi,0);}mount(){gl(this,Yi)._++,h(this,Yi)===1&&(z(this,Aa,bd.subscribe(async e=>{e&&(await this.resumePausedMutations(),h(this,xr).onFocus());})),z(this,Wa,Da.subscribe(async e=>{e&&(await this.resumePausedMutations(),h(this,xr).onOnline());})));}unmount(){var e,t;gl(this,Yi)._--,h(this,Yi)===0&&((e=h(this,Aa))==null||e.call(this),z(this,Aa,void 0),(t=h(this,Wa))==null||t.call(this),z(this,Wa,void 0));}isFetching(e){return h(this,xr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return h(this,Ki).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return h(this,xr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=h(this,xr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Hl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return h(this,xr).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=h(this,xr).get(o.queryHash)?.state.data,i=mh(t,s);if(i!==void 0)return h(this,xr).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return Wr.batch(()=>h(this,xr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return h(this,xr).get(t.queryHash)?.state}removeQueries(e){let t=h(this,xr);Wr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=h(this,xr);return Wr.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Wr.batch(()=>h(this,xr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Po).catch(Po)}invalidateQueries(e,t={}){return Wr.batch(()=>(h(this,xr).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=Wr.batch(()=>h(this,xr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Po)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Po)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=h(this,xr).build(this,t);return r.isStaleByTime(Hl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Po).catch(Po)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Po).catch(Po)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Da.isOnline()?h(this,Ki).resumePausedMutations():Promise.resolve()}getQueryCache(){return h(this,xr)}getMutationCache(){return h(this,Ki)}getDefaultOptions(){return h(this,Gi)}setDefaultOptions(e){z(this,Gi,e);}setQueryDefaults(e,t){h(this,La).set(Ra(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...h(this,La).values()],r={};return t.forEach(o=>{_a(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){h(this,Ba).set(Ra(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...h(this,Ba).values()],r={};return t.forEach(o=>{_a(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...h(this,Gi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=jl(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===Ia&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...h(this,Gi).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){h(this,xr).clear(),h(this,Ki).clear();}},xr=new WeakMap,Ki=new WeakMap,Gi=new WeakMap,La=new WeakMap,Ba=new WeakMap,Yi=new WeakMap,Aa=new WeakMap,Wa=new WeakMap,Mh);var zh=hs__namespace.createContext(void 0);var Op=({client:e,children:t})=>(hs__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(zh.Provider,{value:e,children:t}));var Ma=new Map;function Uh({width:e,height:t,borderRadius:r,color:o}){let n=hs.useRef(new reactNative.Animated.Value(.3)).current;return hs.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 Co({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=B(),[c,p]=hs.useState(false),[g,T]=hs.useState(false),[m,f]=hs.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let R=Ma.get(e);return R?{uri:e,xml:R}:null}),w=e?.toLowerCase().endsWith(".svg"),k=w&&e&&m?.uri===e?m.xml:null;hs.useEffect(()=>{p(false),T(false);},[e]),hs.useEffect(()=>{if(!w||!e)return;if(Ma.has(e)){f({uri:e,xml:Ma.get(e)});return}let R=false;return fetch(e).then(u=>{if(!u.ok)throw new Error(`HTTP ${u.status}`);return u.text()}).then(u=>{R||(Ma.set(e,u),f({uri:e,xml:u}));}).catch(()=>{R||p(true);}),()=>{R=true;}},[e,w]);let x=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:x},a]});let v={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},I=t-n*2,S=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[v,{backgroundColor:i||x}]}):w?jsxRuntime.jsxs(reactNative.View,{style:v,children:[!!!k&&jsxRuntime.jsx(Uh,{width:I,height:S,borderRadius:o,color:x}),k?jsxRuntime.jsx(Yt.SvgXml,{xml:k,width:I,height:S,onError:()=>p(true)}):jsxRuntime.jsx(Yt.SvgUri,{uri:e,width:I,height:S,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:v,children:[!g&&jsxRuntime.jsx(Uh,{width:I,height:S,borderRadius:o,color:x}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:I,height:S},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function Gl(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Ma.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Ma.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function zr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:g,publishableKey:T,projectName:m,leftIcon:f,onLeftAction:w}){let{colors:k,fonts:x,components:v}=B(),[I,S]=hs.useState(null),[R,u]=hs.useState(false),d=hs.useState(()=>new reactNative.Animated.Value(0))[0];hs.useEffect(()=>{if(!R)return;let b=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(d,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(d,{toValue:0,duration:700,useNativeDriver:true})]));return b.start(),()=>b.stop()},[R,d]),hs.useEffect(()=>{if(!a||!l||!c||!p||!g||!T){S(null),u(false);return}let b=false;return u(true),jc(l,c,p,g,T).then(O=>{if(b)return;let A=O.balance,F=null;A&&(A.amount_usd!=null&&A.amount_usd!==""?F=`$${A.amount_usd}`:F="$0.00"),S(F);}).catch(()=>{b||S(null);}).finally(()=>{b||u(false);}),()=>{b=true;}},[a,l,c,p,g,T]);let C=d.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:mo.header,children:[jsxRuntime.jsx(reactNative.View,{style:mo.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[mo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bl,{size:20,color:v.header.buttonColor,strokeWidth:2})}):f&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[mo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsxRuntime.jsx(reactNative.View,{style:mo.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:mo.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:mo.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mo.title,{color:v.header.titleColor,fontFamily:x.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[mo.titleBadge,{backgroundColor:k.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[mo.titleBadgeText,{color:k.foregroundMuted,fontFamily:x.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[mo.balanceText,{color:k.foregroundMuted,fontFamily:x.regular}],children:t}):null,a&&(R?jsxRuntime.jsx(reactNative.Animated.View,{style:[mo.balanceSkeleton,{backgroundColor:k.cardHover,opacity:C}]}):I!=null?jsxRuntime.jsxs(reactNative.Text,{style:[mo.balanceText,{color:k.foregroundMuted,fontFamily:x.regular}],children:[m?`${m} `:"","Balance: ",I]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:mo.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[mo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:v.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:mo.spacer})})]})}var mo=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 vr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=B(),a=s??i.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[$h.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[$h.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:g,children:e}):jsxRuntime.jsx(reactNative.View,{style:g,children:e})]})}var $h=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Yl({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(vr,{cardTokens:i,onPress:e,style:Un.wrapper,contentStyle:Un.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Un.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Un.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Bu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Un.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Un.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Un.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Un.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Un.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Un.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(Co,{uri:oe(p),width:20,height:20})},l.name)})})})]})}var Un=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 Zl({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card;return jsxRuntime.jsxs(vr,{cardTokens:i,onPress:e,style:li.wrapper,contentStyle:li.container,children:[jsxRuntime.jsxs(reactNative.View,{style:li.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[li.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(oa,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:li.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[li.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[li.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:li.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:li.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsxRuntime.jsx(Co,{uri:oe(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var li=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 Xl({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card;return jsxRuntime.jsx(vr,{cardTokens:i,onPress:e,style:ci.wrapper,contentStyle:ci.container,children:jsxRuntime.jsxs(reactNative.View,{style:ci.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ci.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(po,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[ci.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ci.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:ci.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ci.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ci.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var ci=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 tc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=B(),s=n.depositMenu.card;return jsxRuntime.jsxs(vr,{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(Bc,{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 BC="#00D632";function rc({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=B(),s=n.depositMenu.card,[i,a]=hs.useState(false),l=qt("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(vr,{cardTokens:s,onPress:e,style:Hn.wrapper,contentStyle:Hn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Hn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Hn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[Hn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Hn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Hn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Hn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Hn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Hn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Hn=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",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:BC,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function oc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card;return jsxRuntime.jsxs(vr,{cardTokens:i,onPress:e,style:jn.wrapper,contentStyle:jn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:jn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[jn.iconContainer,{backgroundColor:i.iconBackgroundColor,borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gf,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:jn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[jn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[jn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:jn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:jn.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[jn.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(Co,{uri:oe(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var jn=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},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});var Ws="#00D632",eg=5,zC=[25,50,100,500],ja=120,UC=5e3,NC=2e3,HC=300;function nc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function tg(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function jC(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function rg(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function $C(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function og(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function qC(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function QC(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function Fd({size:e,faded:t=false,withBackground:r=false}){let[o,n]=hs.useState(false),s=qt("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Ws,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Ws}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Dd({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:g}=B();hs.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,m]=hs.useState("amountInput"),[f,w]=hs.useState("25"),[k,x]=hs.useState(null),[v,I]=hs.useState(null),[S,R]=hs.useState(true),[u,d]=hs.useState(null),[C,b]=hs.useState(false),[O,A]=hs.useState(null),[F,_]=hs.useState(ja),[U,W]=hs.useState(null),[Q,ze]=hs.useState(false),[Z,Ne]=hs.useState("pending"),G=hs.useRef(null),ne=hs.useRef(null),H=hs.useRef(null),Y=hs.useRef("pending"),me=hs.useRef(null),J=hs.useRef("amountInput"),Te=hs.useRef(ja),qe=hs.useRef(null),be=hs.useRef(null),He=hs.useRef(false),Ke=hs.useRef(true),je=v?.minimum_amount??eg,Ge=v?.maximum_amount,et=parseFloat(f)||0,Ve=!isNaN(et)&&et>=je&&(Ge==null||et<=Ge),Ee=Ge?`$${nc(je)} \u2013 $${nc(Ge)}`:`$${nc(je)} minimum`,_e=T==="amountInput"?"Pay with Cash App":`Pay $${tg(f)} via Cash App`,we=T==="waitingForPayment";hs.useEffect(()=>(Ke.current=true,R(true),Qu("usd",t).then(y=>{Ke.current&&I(y);}).catch(()=>{}).finally(()=>{Ke.current&&R(false);}),()=>{Ke.current=false,nt();}),[t]);function xe(y,L=v){if(A(null),!y){x(null);return}let D=parseFloat(y);if(isNaN(D)){x("Enter a valid number");return}let N=L?.minimum_amount??eg,M=L?.maximum_amount;D<N?x(`$${nc(N)} minimum`):M!=null&&D>M?x(`$${nc(M)} maximum`):x(null);}function nt(){G.current&&clearInterval(G.current),ne.current&&clearInterval(ne.current),H.current&&clearInterval(H.current),G.current=null,ne.current=null,H.current=null;}function se(){nt(),d(null),me.current=null,W(null),ze(false),A(null),Y.current="pending",Ne("pending"),_(ja),Te.current=ja,qe.current=null,He.current=false,m("amountInput"),J.current="amountInput";}async function Ye(){if(!(!Ve||C)){b(true),A(null),nt(),qe.current=null;try{let y=await qu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:f},t);me.current=y,Y.current=y.status,d(y),b(!1),m("waitingForPayment"),J.current="waitingForPayment",Xt(),Oe(),reactNative.Linking.openURL(y.url).catch(()=>{});}catch(y){b(false),A(y instanceof Error?y.message:"Failed to create session");}}}function Xt(){Te.current=ja,_(ja),H.current&&clearInterval(H.current),H.current=setInterval(()=>{Te.current-=1,_(Te.current),Te.current<=0&&(clearInterval(H.current),H.current=null,Y.current==="pending"&&(m("softExpired"),J.current="softExpired"));},1e3);}function Oe(){G.current&&clearInterval(G.current),G.current=setInterval(()=>{Re();},UC);}async function Re(){if(!Ke.current)return;let y=me.current;if(!y)return;let L=y.external_id??y.id;try{let D=await Ku(L,t),N=Y.current;switch(Y.current=D.status,Ne(D.status),D.status){case "processing":(J.current==="amountInput"||J.current==="softExpired"||J.current==="waitingForPayment")&&(m("paymentReceived"),J.current="paymentReceived",H.current&&(clearInterval(H.current),H.current=null));break;case "completed":G.current&&(clearInterval(G.current),G.current=null),H.current&&(clearInterval(H.current),H.current=null),N!=="completed"&&(m("paymentReceived"),J.current="paymentReceived",tt());break;case "failed":G.current&&(clearInterval(G.current),G.current=null),H.current&&(clearInterval(H.current),H.current=null),J.current!=="amountInput"&&(m("failed"),J.current="failed");break;case "expired":G.current&&(clearInterval(G.current),G.current=null),H.current&&(clearInterval(H.current),H.current=null),J.current!=="amountInput"&&(m("softExpired"),J.current="softExpired");break;default:break}}catch{}}let Pe=6e5;function tt(){ne.current&&clearInterval(ne.current);let y=Date.now()+Pe;ne.current=setInterval(()=>{if(Date.now()>y){clearInterval(ne.current),ne.current=null;let L=Y.current;L==="completed"||L==="processing"?(m("paymentReceived"),J.current="paymentReceived"):(m("failed"),J.current="failed");return}Ae();},NC);}async function Ae(){if(Ke.current)try{let y=await un(e,t,"deposit"),L=Date.now(),D=[...y.data].sort((Ie,Je)=>{let ro=Ie.created_at?new Date(Ie.created_at).getTime():0;return (Je.created_at?new Date(Je.created_at).getTime():0)-ro}),N=qe.current,M=N?D.find(Ie=>Ie.id===N):D.find(Ie=>{if(!Ie.created_at)return !1;let Je=new Date(Ie.created_at).getTime();return L-Je<HC*1e3});M&&(qe.current||(qe.current=M.id),M.status==="succeeded"?(ne.current&&(clearInterval(ne.current),ne.current=null),W(M),m("depositComplete"),J.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:M.id,transaction:M})):(M.status==="failed"||M.status==="refunded")&&(ne.current&&(clearInterval(ne.current),ne.current=null),W(M),m("failed"),J.current="failed"));}catch{}}function fe(){if(T==="waitingForPayment"){H.current&&(clearInterval(H.current),H.current=null),m("amountInput"),J.current="amountInput";return}i();}function Ce(){nt(),a();}function Dt(){let y=me.current??u;y&&reactNative.Linking.openURL(y.url).catch(()=>{});}function Wt(y){let L=y.destination_amount_base_unit;if(!L)return "\u2014";let D=y.destination_token_metadata?.decimals??6;return jC(L,D)}function ft(y){return $C(y.destination_currency)}function st(y){let L=y.destination_token_metadata;return L?L.icon_urls&&L.icon_urls.length>0?Vi(L.icon_urls,"png")??L.icon_url??null:L.icon_url??null:null}function Ut(){return jsxRuntime.jsxs(reactNative.View,{style:q.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[q.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[q.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function We(y,L){return jsxRuntime.jsxs(reactNative.View,{style:q.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:y}),jsxRuntime.jsx(reactNative.Text,{style:[q.detailValue,{color:c.foreground,fontFamily:p.medium}],children:L})]},y)}function ce(y,L,D){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[q.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(D).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.txLabel,{color:c.foreground,fontFamily:p.medium}],children:y}),jsxRuntime.jsxs(reactNative.View,{style:q.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.txHash,{color:c.foregroundMuted}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[q.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},y)}function Fe(){let y=Math.max(60-f.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:q.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:q.flex,contentContainerStyle:q.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{He.current||(He.current=true,setTimeout(()=>be.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:q.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:q.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.amountDollar,{color:c.foreground,fontSize:y}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:be,value:f,onChangeText:L=>{w(L),xe(L);},keyboardType:"decimal-pad",style:[q.amountInput,{color:c.foreground,fontSize:y}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),k?jsxRuntime.jsx(reactNative.Text,{style:[q.amountError,{color:c.warning,fontFamily:p.regular}],children:k}):S?jsxRuntime.jsx(reactNative.View,{style:[q.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[q.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Ee})]}),jsxRuntime.jsx(reactNative.View,{style:q.quickAmountsRow,children:zC.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[q.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let D=String(L);w(D),xe(D);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[q.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",L]})},L))}),O&&jsxRuntime.jsxs(reactNative.View,{style:[q.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:q.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[q.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:O})]})]}),jsxRuntime.jsx(reactNative.View,{style:q.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[q.continueButton,{backgroundColor:Ws,borderRadius:g.button.borderRadius,opacity:!Ve||C?.4:1}],onPress:Ye,disabled:!Ve||C,activeOpacity:.8,children:[C&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:q.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[q.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:C?"Loading...":"Continue"})]})})]})}function ae(){return jsxRuntime.jsxs(reactNative.View,{style:q.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:q.centeredContent,children:[jsxRuntime.jsx(Fd,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
- This page will update automatically.`}),F>0&&jsxRuntime.jsxs(reactNative.Text,{style:[q.expiryText,{color:F<=30?c.warning:c.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",QC(F)]})]}),jsxRuntime.jsx(reactNative.View,{style:q.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[q.continueButton,{backgroundColor:Ws,borderRadius:g.button.borderRadius}],onPress:Dt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:q.cashAppButtonIcon,children:jsxRuntime.jsx(Fd,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[q.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function Ue(){let y=Z==="processing",L=y?"Payment processing":"Payment received",D=y?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:q.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:q.centeredContent,children:[jsxRuntime.jsx(bt,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(Fd,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:D})]})})}function j(){if(!U)return Ue();let y=U,L=["pending","waiting","delayed"].includes(y.status),D=st(y),N=qC(y.created_at);return jsxRuntime.jsxs(reactNative.View,{style:q.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:q.flex,contentContainerStyle:q.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:q.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:D?jsxRuntime.jsx(reactNative.Image,{source:{uri:D,cache:"force-cache"},style:q.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[q.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[q.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[q.statusBadge,{backgroundColor:L?c.warning:c.success}],children:jsxRuntime.jsx(reactNative.Text,{style:q.statusBadgeText,children:L?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.statusDot,{backgroundColor:L?c.warning:c.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[q.statusText,{color:c.foreground,fontFamily:p.semibold}],children:L?"In Progress":"Completed"})]}),N?jsxRuntime.jsx(reactNative.Text,{style:[q.dateText,{color:c.foregroundMuted,fontFamily:p.regular}],children:N}):null,jsxRuntime.jsxs(reactNative.View,{style:[q.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[We("Amount Sent",`$${tg(f)} USD`),We("Amount Received",`${Wt(y)} ${ft(y)}`),y.source_amount_usd?We("USD Value",`$${parseFloat(y.source_amount_usd).toFixed(2)}`):null,y.source_chain_id?We("Source Network",rg(y.source_chain_type??"",y.source_chain_id)):null,y.destination_chain_id?We("Destination Network",rg(y.destination_chain_type??"",y.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:q.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),ze(M=>!M);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.seeMoreText,{color:c.foreground,fontFamily:p.medium}],children:Q?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[q.seeMoreChevron,{color:c.foregroundMuted}],children:Q?"\u25B2":"\u25BC"})]}),Q&&jsxRuntime.jsxs(reactNative.View,{style:q.txHashSection,children:[y.explorer_url?ce("Deposit Tx",og(y.transaction_hash),y.explorer_url):null,!L&&y.destination_explorer_url&&y.destination_transaction_hashes?.[0]?ce("Completion Tx",og(y.destination_transaction_hashes[0]),y.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:q.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[q.continueButton,{backgroundColor:Ws,borderRadius:g.button.borderRadius}],onPress:Ce,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[q.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function Se(){return jsxRuntime.jsxs(reactNative.View,{style:q.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:q.centeredContent,children:[jsxRuntime.jsx(Fd,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[q.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
- `,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:q.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[q.continueButton,{backgroundColor:Ws,borderRadius:g.button.borderRadius}],onPress:se,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[q.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function P(){return jsxRuntime.jsxs(reactNative.View,{style:q.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:q.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[q.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[q.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[q.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:q.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[q.continueButton,{backgroundColor:Ws,borderRadius:g.button.borderRadius}],onPress:se,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[q.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),Ut()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[q.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(zr,{title:_e,showBack:we,onBack:fe,onClose:Ce}),T==="amountInput"&&Fe(),T==="waitingForPayment"&&ae(),T==="paymentReceived"&&Ue(),T==="depositComplete"&&j(),T==="softExpired"&&Se(),T==="failed"&&P()]})}var q=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var ag=5e3,lg=2500,cg=5e3,dg=6e4;function wn(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:g,setTrackedExecutions:T,setLatestExecution:m,setShowStatusSheet:f,onDepositSuccess:w,onExecutionsChange:k,onDepositError:x}=e,[v,I]=hs.useState(false),[S,R]=hs.useState(false);return hs.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;I(false),t==="auto_ui"&&R(false);let d=setTimeout(()=>{I(true),t==="auto_ui"&&R(true);},ag);return ()=>clearTimeout(d)},[r,t,o,n]),hs.useEffect(()=>{if(!r||!s||!a)return;let d=new Date(a.getTime()-dg),C=setInterval(async()=>{try{let A=[...(await un(s,i,"deposit")).data??[]].sort((_,U)=>{let W=_.created_at?new Date(_.created_at).getTime():0;return (U.created_at?new Date(U.created_at).getTime():0)-W}),F=null;for(let _ of A){let U=_.created_at?new Date(_.created_at):null;if(!U||U<=d)continue;let W=p.get(_.id);if(!W){F=_;break}if(["pending","waiting","delayed"].includes(W)&&_.status==="succeeded"){F=_;break}}if(F){let _=F;g(U=>{let W=U.findIndex(Q=>Q.id===_.id);if(W>=0){let Q=[...U];return Q[W]=_,Q}return [...U,_]}),T(U=>{let W=new Map(U);return W.set(_.id,_.status),W}),m(_),f(!0),_.status==="succeeded"&&w?.({message:"Deposit completed successfully",executionId:_.id}),k?.([...c,_]);}}catch(b){x?.({message:"Failed to check deposit status",error:b});}},lg);return ()=>clearInterval(C)},[r,s,i,a,p,c,k,w,x]),hs.useEffect(()=>{if(!r||!v||!l)return;let d=async()=>{try{await zc(l,i);}catch{}};d();let C=setInterval(d,cg);return ()=>clearInterval(C)},[r,v,l,i]),{pollingEnabled:v,showWaitingUi:S,handleIveDeposited:()=>{I(true),R(true);}}}function pg({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(sc,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(Yp,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function sc({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=B(),n=hs.useRef(new reactNative.Animated.Value(0)).current;hs.useEffect(()=>{if(e&&!t){n.setValue(0);let i=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Od.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:s}]},children:jsxRuntime.jsx(wl,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Od.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function Yp({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=B();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Od.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Od.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var Od=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Ld(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return oe(t||r||e.icon_url)}function rS(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=reactNative.Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var Bd=18,Ad=12,oS=2;function nS({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),s=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(Co,{uri:e,width:r,height:r,borderRadius:10}),s?jsxRuntime.jsxs(reactNative.View,{style:ui.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[ui.badge,ui.backBadge],children:jsxRuntime.jsx(pa,{size:Ad})}),jsxRuntime.jsx(reactNative.View,{style:[ui.badge,ui.frontBadge],children:jsxRuntime.jsx(ca,{size:Ad})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[ui.badge,ui.singleBadge],children:jsxRuntime.jsx(ca,{size:Ad})}):n?jsxRuntime.jsx(reactNative.View,{style:[ui.badge,ui.singleBadge],children:jsxRuntime.jsx(pa,{size:Ad})}):null]})}var ui=reactNative.StyleSheet.create({badge:{width:Bd,height:Bd,borderRadius:Bd/2,borderWidth:oS,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function Wd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,onBack:i,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:g,onShowStatusSheet:T}){let{colors:m,fonts:f,components:w}=B(),k=hs.useRef(true),x=hs.useRef(false),[v,I]=hs.useState("selectWallet"),[S,R]=hs.useState([]),[u,d]=hs.useState(true),[C,b]=hs.useState(null),[O,A]=hs.useState(null),[F,_]=hs.useState(null),[U,W]=hs.useState(null),[Q,ze]=hs.useState(null),[Z,Ne]=hs.useState([]),[G,ne]=hs.useState(false),[H,Y]=hs.useState(null),[me,J]=hs.useState([]),[Te,qe]=hs.useState(new Map),[be]=hs.useState(()=>new Date),[He,Ke]=hs.useState(null),[je,Ge]=hs.useState(false),[et,Ve]=hs.useState(null),Ee=v==="waitingForDeposit",_e=U||F||O?.chain_types[0]||o||"ethereum",we=ko(Z,_e),xe=we?.address||"",nt=we?.id??"",se=`${_e}:${n||""}`;hs.useEffect(()=>(k.current=true,()=>{k.current=false;}),[]),hs.useEffect(()=>{Xt();},[t]),hs.useEffect(()=>{He&&g?.(He);},[He]),hs.useEffect(()=>{je&&(T?.(true),Ge(false));},[je]),hs.useEffect(()=>{p?.(me);},[me]);let{showWaitingUi:Ye}=wn({depositConfirmationMode:"auto_ui",enabled:Ee,depositAddress:xe,chain:se,externalUserId:e,publishableKey:t,modalOpenedAt:et??be,depositWalletId:nt,depositExecutions:me,trackedExecutions:Te,setDepositExecutions:J,setTrackedExecutions:qe,setLatestExecution:Ke,setShowStatusSheet:Ge,onDepositSuccess:l,onExecutionsChange:p,onDepositError:c});async function Xt(){d(true),b(null);try{let ce=await Gu(t);if(!k.current)return;let Fe=ce.data.filter(rS),ae=Fe.map(Ld).filter(Boolean);if(ae.length>0&&await Gl(ae),!k.current)return;R(Fe);}catch(ce){if(!k.current)return;b(ce instanceof Error?ce.message:"Failed to load wallets");}finally{k.current&&d(false);}}function Oe(ce){A(ce),W(null),Y(null),ce.chain_types.length>1?(_(null),I("selectNetwork")):Pe(ce);}function Re(ce){_(ce),O&&Pe(O,ce);}async function Pe(ce,Fe){if(x.current)return;x.current=true,ne(true),I("connecting");let ae=Fe||ce.chain_types[0]||null;try{let Ue=await Ao({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:s,recipient_address:r},t);if(!k.current)return;Ne(Ue.data);let j=Ue.data.map(M=>({chain_type:M.chain_type,address:M.address})),Se=ae?j.filter(M=>M.chain_type===ae):j,P=Se.length>0,y=P?Se:j,L=P?ae:y[0]?.chain_type??ae;W(L??null);let D=await Yu(ce.id,y,t);if(!k.current)return;if(ze(D),ne(!1),!D.supported||!D.deeplink&&!D.pay_url){Y(`${ce.name} doesn't support in-app browser on this device`),I("failed");return}let N=D.deeplink||D.pay_url;try{await reactNative.Linking.openURL(N);}catch{if(!k.current)return;Y(`Could not open ${ce.name}. Make sure it is installed.`),I("failed");return}if(!k.current)return;Ve(new Date),I("waitingForDeposit");}catch(Ue){if(!k.current)return;ne(false),Y(Ue instanceof Error?Ue.message:"Failed to connect wallet"),I("failed");}}function tt(){if(!Q)return;let ce=Q.deeplink||Q.pay_url;reactNative.Linking.openURL(ce).catch(()=>{});}function Ae(){x.current=false,A(null),_(null),W(null),ze(null),Ne([]),Ve(null),Y(null),ne(false),I("selectWallet");}function fe(){return u?jsxRuntime.jsx(reactNative.View,{style:gt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:m.primary})}):C?jsxRuntime.jsxs(reactNative.View,{style:gt.centeredContainer,children:[jsxRuntime.jsx(Fi,{size:48,color:m.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[gt.errorTitle,{color:m.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.errorSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:C}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Xt,style:[gt.retryButton,{backgroundColor:m.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[gt.retryButtonText,{color:m.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):S.length===0?jsxRuntime.jsxs(reactNative.View,{style:gt.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.errorTitle,{color:m.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.errorSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:gt.walletList,contentContainerStyle:gt.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.pickerSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),S.map(ce=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Oe(ce),activeOpacity:.7,disabled:G,style:[gt.walletRow,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor,opacity:G?.5:1}],children:[jsxRuntime.jsx(nS,{uri:Ld(ce),chainTypes:ce.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:gt.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.walletName,{color:m.foreground,fontFamily:f.medium}],children:ce.name}),jsxRuntime.jsx(reactNative.Text,{style:[gt.walletChains,{color:m.foregroundMuted,fontFamily:f.regular}],children:ce.chain_types.map(Fe=>Fe.charAt(0).toUpperCase()+Fe.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(_r,{size:16,color:m.foregroundMuted,strokeWidth:2})]},ce.id))]})}function Ce(){if(!O)return null;let ce=Ld(O),Fe=O.chain_types.map(ae=>({id:ae,name:ae.charAt(0).toUpperCase()+ae.slice(1),Icon:ae==="ethereum"?ca:pa}));return jsxRuntime.jsxs(reactNative.View,{style:gt.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:gt.networkPickerHeader,children:[jsxRuntime.jsx(Co,{uri:ce,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[gt.statusTitle,{color:m.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.statusSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",O.name]})]}),jsxRuntime.jsx(reactNative.View,{style:gt.networkList,children:Fe.map(({id:ae,name:Ue,Icon:j})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Re(ae),activeOpacity:.7,disabled:G,style:[gt.networkRow,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor,opacity:G?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:gt.networkIconContainer,children:jsxRuntime.jsx(j,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[gt.networkName,{color:m.foreground,fontFamily:f.medium}],children:Ue}),jsxRuntime.jsx(_r,{size:16,color:m.foregroundMuted,strokeWidth:2})]},ae))})]})}function Dt(){return jsxRuntime.jsxs(reactNative.View,{style:gt.centeredContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:m.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.statusTitle,{color:m.foreground,fontFamily:f.semibold}],children:["Opening ",O?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[gt.statusSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function Wt(){let ce=O?.name??"your wallet",Fe=O?Ld(O):null;return jsxRuntime.jsxs(reactNative.View,{style:gt.centeredContainer,children:[Fe?jsxRuntime.jsx(bt,{size:80,children:jsxRuntime.jsx(Co,{uri:Fe,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:m.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.statusTitle,{color:m.foreground,fontFamily:f.semibold}],children:["Continue in ",ce]}),jsxRuntime.jsx(reactNative.Text,{style:[gt.statusSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:tt,activeOpacity:.8,style:[gt.primaryButton,{backgroundColor:m.primary,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:[jsxRuntime.jsx(Ko,{size:16,color:m.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.primaryButtonText,{color:m.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",ce]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(sc,{showWaitingUi:Ye,latestExecution:He})})]})}function ft(){return jsxRuntime.jsxs(reactNative.View,{style:gt.centeredContainer,children:[jsxRuntime.jsx(Fi,{size:48,color:m.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[gt.statusTitle,{color:m.foreground,fontFamily:f.semibold}],children:H||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.statusSubtitle,{color:m.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Ae,activeOpacity:.8,style:[gt.primaryButton,{backgroundColor:m.primary,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[gt.primaryButtonText,{color:m.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function st(){switch(v){case "selectWallet":return fe();case "selectNetwork":return Ce();case "connecting":return Dt();case "waitingForDeposit":return Wt();case "failed":return ft()}}let Ut=v==="selectWallet"||v==="selectNetwork"||v==="failed";function We(){v==="selectNetwork"?(x.current=false,A(null),_(null),W(null),I("selectWallet")):i();}return jsxRuntime.jsxs(reactNative.View,{style:gt.container,children:[jsxRuntime.jsx(zr,{title:v==="selectNetwork"?`${O?.name??"Select Network"}`:"Connect Wallet",showBack:Ut,onBack:We,onClose:a}),st()]})}var gt=reactNative.StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}});var fi=7,pi=4,$a=4;function uS(e,t,r){return e<fi&&t<fi||e<fi&&t>=r-fi||e>=r-fi&&t<fi}function ns({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=B(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,g=hs.useMemo(()=>{try{return dS__default.default(e||"placeholder","H")}catch{return null}},[e]),T=g?g.length:0,m=T?(t-pi*2)/T:0,f=m*.38,w=o+12,k=w/2+4,x=t/2,v=t/2,I=T?[{x:pi,y:pi},{x:pi+(T-fi)*m,y:pi},{x:pi,y:pi+(T-fi)*m}]:[],S=fi*m,R=5*m,u=m,d=3*m,C=2*m;return jsxRuntime.jsxs(reactNative.View,{style:[Xp.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Yt__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Yt.Rect,{x:0,y:0,width:t,height:t,fill:l}),g?.map((b,O)=>b.map((A,F)=>{if(!A||uS(O,F,T))return null;let _=pi+F*m+m/2,U=pi+O*m+m/2;if(r){let W=_-x,Q=U-v;if(Math.sqrt(W*W+Q*Q)<k)return null}return jsxRuntime.jsx(Yt.Circle,{cx:_,cy:U,r:f,fill:c},`${O}-${F}`)})),I.map((b,O)=>jsxRuntime.jsxs(hs__namespace.default.Fragment,{children:[jsxRuntime.jsx(Yt.Rect,{x:b.x,y:b.y,width:S,height:S,rx:$a,ry:$a,fill:c}),jsxRuntime.jsx(Yt.Rect,{x:b.x+u,y:b.y+u,width:R,height:R,rx:$a-1,ry:$a-1,fill:l}),jsxRuntime.jsx(Yt.Rect,{x:b.x+C,y:b.y+C,width:d,height:d,rx:$a-1.5,ry:$a-1.5,fill:c})]},`finder-${O}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[Xp.logoContainer,{width:w,height:w,top:v-w/2,left:x-w/2,backgroundColor:p,borderRadius:w/2}],children:[jsxRuntime.jsx(Co,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[Xp.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(Co,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var Xp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var gS=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Qa=(e,t)=>`${t}:${e}`,yS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Ud({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:m,onLatestExecution:f,onShowStatusSheet:w,onSelectedTokenIconUrl:k,borderTopLeftRadius:x,borderTopRightRadius:v,sheetBorderRadius:I}){let{colors:S,fonts:R,components:u}=B(),d=a&&l?`${a}:${l}`:"solana:mainnet",[C,b]=hs.useState("USDC"),[O,A]=hs.useState(d),[F,_]=hs.useState([]),[U,W]=hs.useState(true),[Q,ze]=hs.useState([]),[Z,Ne]=hs.useState(true),[G,ne]=hs.useState(false),[H,Y]=hs.useState(false),[me,J]=hs.useState(false),[Te,qe]=hs.useState(false),[be,He]=hs.useState([]),[Ke,je]=hs.useState(new Map),[Ge]=hs.useState(()=>new Date),[et,Ve]=hs.useState(null),[Ee,_e]=hs.useState(false),[we,xe]=hs.useState(null),[nt,se]=hs.useState(false);hs.useEffect(()=>{we&&f?.(we);},[we]),hs.useEffect(()=>{Ee&&(w?.(true),_e(false));},[Ee]);let Ye=new Map;Q.forEach(P=>{P.chains.forEach(y=>{let L=`${y.chain_type}:${y.chain_id}`;Ye.has(L)||Ye.set(L,y);});});let Xt=Array.from(Ye.values()),Oe=yS(O),Pe=Xt.find(P=>P.chain_type===Oe.chainType&&P.chain_id===Oe.chainId)?.chain_type||"ethereum",tt=ko(F,Pe),Ae=tt?.address||"",fe=hs.useRef(false);hs.useEffect(()=>{async function P(){try{Ne(!0),Ve(null);let L=await ei(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(ze(L.data),L.data.length>0&&!fe.current){fe.current=!0;let D,N;if(a&&l)if(c)for(let M of L.data){let Ie=M.chains.find(Je=>Je.chain_type===a&&Je.chain_id===l&&Je.token_address.toLowerCase()===c.toLowerCase());if(Ie){D=M,N=Ie;break}}else {let M=Je=>Je.chain_type===a&&Je.chain_id===l,Ie=L.data.find(Je=>Je.symbol==="USDC"&&Je.chains.some(M));if(Ie)D=Ie,N=Ie.chains.find(M);else for(let Je of L.data){let ro=Je.chains.find(M);if(ro){D=Je,N=ro;break}}}if(!D&&s)for(let M of L.data){let Ie=M.chains.find(Je=>Je.token_address.toLowerCase()===s.toLowerCase());if(Ie){D=M,N=Ie;break}}D||(D=L.data.find(M=>M.symbol==="USDC"),D&&D.chains.length>0&&(N=D.chains[0])),D||(D=L.data.find(M=>M.symbol==="USDT"),D&&D.chains.length>0&&(N=D.chains[0])),D||(D=L.data[0],D.chains.length>0&&(N=D.chains[0])),D&&b(D.symbol),N&&A(Qa(N.chain_id,N.chain_type));}}catch(y){console.error("Error fetching supported tokens:",y),Ve("Failed to load supported tokens"),m?.({message:"Failed to load supported tokens",error:y});}finally{Ne(false);}}P();},[t,m,a,l,c,s,n,o]),hs.useEffect(()=>{async function P(){try{W(!0),Ve(null);let y=await Ao({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);_(y.data);}catch(y){console.error("Error fetching wallets:",y),Ve("Failed to load wallets"),m?.({message:"Failed to load wallets",error:y});}finally{W(false);}}P();},[e,r,o,n,s,t,m]);let Ce=tt?.id??"",{showWaitingUi:Dt,handleIveDeposited:Wt}=wn({depositConfirmationMode:p,depositAddress:Ae,chain:O,externalUserId:e,publishableKey:t,modalOpenedAt:Ge,depositWalletId:Ce,depositExecutions:be,trackedExecutions:Ke,setDepositExecutions:He,setTrackedExecutions:je,setLatestExecution:xe,setShowStatusSheet:_e,onDepositSuccess:T,onExecutionsChange:g,onDepositError:m});hs.useEffect(()=>{if(!Q.length)return;let P=Q.find(L=>L.symbol===C);if(!P||P.chains.length===0){let L=Q.find(D=>D.symbol==="USDC")||Q[0];L&&(b(L.symbol),L.chains.length>0&&A(Qa(L.chains[0].chain_id,L.chains[0].chain_type)));return}if(!P.chains.some(L=>Qa(L.chain_id,L.chain_type)===O)){let L=P.chains[0];A(Qa(L.chain_id,L.chain_type));}},[C,Q,O]);let ft=Q.find(P=>P.symbol===C),st=Le(ft,"png")||void 0;hs.useEffect(()=>{k?.(st);},[st]);let Ut=ft?.chains||[],We=Ut.find(P=>Qa(P.chain_id,P.chain_type)===O),ce=async()=>{if(Ae)try{reactNative.Clipboard.setString(Ae),ne(!0),setTimeout(()=>ne(!1),2e3);}catch(P){console.error("Failed to copy:",P);}},Fe=We?.estimated_price_impact_percent??0,ae=We?.max_slippage_percent??.25,Ue=We?.minimum_deposit_amount_usd??3;if(Z)return jsxRuntime.jsxs(reactNative.View,{style:$.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[$.loadingText,{color:S.foregroundMuted,fontFamily:R.regular}],children:"Loading currencies..."})]});if(et&&Q.length===0)return jsxRuntime.jsxs(reactNative.View,{style:$.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.errorText,{color:S.error,fontFamily:R.regular}],children:et}),jsxRuntime.jsx(reactNative.Text,{style:[$.errorHint,{color:S.foregroundMuted,fontFamily:R.regular}],children:"Please check your network connection and try again."})]});let j=()=>jsxRuntime.jsxs(_t,{visible:me,onClose:()=>J(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:I?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:I?.tokenSelector?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[$.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:$.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[$.sheetTitle,{color:u.header.titleColor,fontFamily:R.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(false),style:$.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(xt,{style:$.sheetList,contentContainerStyle:$.sheetListContent,showsVerticalScrollIndicator:false,children:Q.map(P=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{b(P.symbol),J(false);},activeOpacity:.7,style:[$.sheetItem,{backgroundColor:C===P.symbol?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(P,"png"))},style:$.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:$.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.sheetItemTitle,{color:u.card.titleColor,fontFamily:R.medium}],children:P.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[$.sheetItemSubtitle,{color:u.card.subtitleColor,fontFamily:R.regular}],children:[P.chains.length," network",P.chains.length!==1?"s":""," available"]})]}),C===P.symbol&&jsxRuntime.jsx(pt,{size:20,color:S.primary,strokeWidth:2})]},P.symbol))})]}),Se=()=>jsxRuntime.jsxs(_t,{visible:Te,onClose:()=>qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:I?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:I?.chainSelector?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[$.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:$.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[$.sheetTitle,{color:u.header.titleColor,fontFamily:R.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qe(false),style:$.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(xt,{style:$.sheetList,contentContainerStyle:$.sheetListContent,showsVerticalScrollIndicator:false,children:Ut.map(P=>{let y=Qa(P.chain_id,P.chain_type),L=O===y;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{A(y),qe(false);},activeOpacity:.7,style:[$.sheetItem,{backgroundColor:L?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(P,"png"))},style:$.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:$.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.sheetItemTitle,{color:u.card.titleColor,fontFamily:R.medium}],children:P.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[$.sheetItemSubtitle,{fontFamily:R.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:u.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:S.warning},children:["$",P.minimum_deposit_amount_usd]})]})]}),L&&jsxRuntime.jsx(pt,{size:20,color:S.primary,strokeWidth:2})]},y)})})]});return jsxRuntime.jsxs(reactNative.View,{style:$.container,children:[jsxRuntime.jsxs(reactNative.View,{style:$.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.selectorLabel,{color:u.card.labelColor,fontFamily:R.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(true),style:[$.selector,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[ft&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(ft,"png"))},style:$.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[$.selectorText,{color:u.card.titleColor,fontFamily:R.medium}],children:C}),jsxRuntime.jsx(er,{size:16,color:u.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:$.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[$.selectorLabel,{color:u.card.labelColor,fontFamily:R.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[$.minDeposit,{color:S.warning,fontFamily:R.regular}],children:["($",Ue," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qe(true),style:[$.selector,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[We&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(We,"png"))},style:$.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[$.selectorText,{color:u.card.titleColor,fontFamily:R.medium}],numberOfLines:1,children:We?.chain_name||"Select network"}),jsxRuntime.jsx(er,{size:16,color:u.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.intentAddressLabel,{color:S.foregroundMuted,fontFamily:R.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:$.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[$.qrWrapper,{backgroundColor:S.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:U?jsxRuntime.jsxs(reactNative.View,{style:$.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[$.loadingText,{color:S.foregroundMuted,fontFamily:R.regular}],children:"Loading..."})]}):Ae?jsxRuntime.jsx(ns,{value:Ae,size:160,logoUri:oe(Le(We,"png")||qt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:$.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[$.errorText,{color:S.error,fontFamily:R.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:ce,disabled:U||!Ae,style:$.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.addressTruncated,{color:S.foregroundMuted,fontFamily:R.regular}],numberOfLines:1,children:U?"Loading...":Ae?gS(Ae):"No address"}),G?jsxRuntime.jsx(pt,{size:16,color:S.success,strokeWidth:2}):jsxRuntime.jsx(ln,{size:16,color:S.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(sc,{showWaitingUi:Dt,latestExecution:we}),jsxRuntime.jsxs(reactNative.View,{style:[$.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Y(!H),style:$.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:$.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(po,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[$.detailsLabel,{color:u.card.titleColor,fontFamily:R.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:$.chevronContainer,children:H?jsxRuntime.jsx(xn,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(er,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),H&&jsxRuntime.jsxs(reactNative.View,{style:$.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:$.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(cn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$.detailsLabel,{color:u.card.titleColor,fontFamily:R.regular}],children:["Price impact: ",Fe.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>se(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(dn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:$.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$.detailsLabel,{color:u.card.titleColor,fontFamily:R.regular}],children:["Slippage: Auto \u2022 ",ae.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>se(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(dn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:$.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ia,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$.detailsLabel,{color:u.card.titleColor,fontFamily:R.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),style:$.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(dn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[$.detailsLabel,{color:S.primary,fontFamily:R.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(Yp,{depositConfirmationMode:p,depositAddress:Ae,showWaitingUi:Dt,onIveDeposited:Wt}),j(),Se(),jsxRuntime.jsxs(_t,{visible:nt,onClose:()=>se(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:I?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:I?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[$.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:$.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[$.sheetTitle,{color:u.header.titleColor,fontFamily:R.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>se(false),style:$.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:$.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[$.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:$.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[$.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(cn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[$.infoCardTitle,{color:u.card.titleColor,fontFamily:R.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[$.infoCardValue,{color:u.card.titleColor,fontFamily:R.medium}],children:[Fe.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.infoCardDescription,{color:u.card.descriptionColor,fontFamily:R.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:[$.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:$.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[$.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[$.infoCardTitle,{color:u.card.titleColor,fontFamily:R.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[$.infoCardValue,{color:u.card.titleColor,fontFamily:R.medium}],children:[ae.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.infoCardDescription,{color:u.card.descriptionColor,fontFamily:R.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."})]})]})]})]})}var $=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"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},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},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 Nd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=B();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Es.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Es.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Es.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(e,"png"))},style:Es.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Es.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Es.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Es.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(pt,{size:16,color:o.primary,strokeWidth:2})]})}var Es=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 dc({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=B();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Sg.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Sg.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(Nd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Sg=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function jd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=B(),[g,T]=hs.useState(""),m=o.map(S=>r.find(R=>R.currency_code.toLowerCase()===S.toLowerCase())).filter(S=>S!==void 0),f=r.filter(S=>!o.includes(S.currency_code.toLowerCase())),w=S=>{if(!g)return S;let R=g.toLowerCase();return S.filter(u=>u.name.toLowerCase().includes(R)||u.currency_code.toLowerCase().includes(R))},k=w(m),x=w(f),v=S=>{s(S),t(false),T("");},I=()=>{t(false),T("");};return jsxRuntime.jsxs(_t,{visible:e,onClose:I,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(zr,{title:"Currency",showBack:false,onClose:I}),jsxRuntime.jsx(reactNative.View,{style:Ms.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ms.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(xt,{style:Ms.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Ms.listContent,children:[jsxRuntime.jsx(dc,{title:"Popular currencies",currencies:k,selectedCurrency:n,onSelect:v}),k.length>0&&x.length>0&&jsxRuntime.jsx(reactNative.View,{style:Ms.sectionSpacer}),jsxRuntime.jsx(dc,{title:"All currencies",currencies:x,selectedCurrency:n,onSelect:v}),k.length===0&&x.length===0&&jsxRuntime.jsx(reactNative.View,{style:Ms.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Ms.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Ms=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 nf(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 Qd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:g,onLatestExecution:T,onShowStatusSheet:m,onSelectedTokenIconUrl:f,borderTopLeftRadius:w,borderTopRightRadius:k,sheetBorderRadius:x}){let{colors:v,fonts:I,components:S}=B(),[R,u]=hs.useState(""),[d,C]=hs.useState("usd"),[b,O]=hs.useState(false),[A,F]=hs.useState(false),[_,U]=hs.useState([]),[W,Q]=hs.useState(false),[ze,Z]=hs.useState(null),[Ne,G]=hs.useState(null),[ne,H]=hs.useState("amount"),[Y,me]=hs.useState(null),[J,Te]=hs.useState(true),[qe,be]=hs.useState(null),[He,Ke]=hs.useState(false),je=hs.useRef(null),Ge=hs.useRef(false);hs.useEffect(()=>{je.current=Y;},[Y]),hs.useEffect(()=>{Ge.current=He;},[He]);let[et,Ve]=hs.useState([]),[Ee,_e]=hs.useState(true),[we,xe]=hs.useState(60),[nt,se]=hs.useState([]),[Ye,Xt]=hs.useState([]),[Oe,Re]=hs.useState(null),[Pe,tt]=hs.useState(null),[Ae,fe]=hs.useState(true),[Ce,Dt]=hs.useState(null),[Wt,ft]=hs.useState(false),[st,Ut]=hs.useState(null),[We,ce]=hs.useState(false),[Fe,ae]=hs.useState(false),[Ue,j]=hs.useState(false),[Se,P]=hs.useState(null),y=r??ne,L=hs.useRef(null),D=nt.find(pe=>pe.currency_code.toLowerCase()===d.toLowerCase()),N=hs.useCallback(pe=>{H(pe),pe==="quotes"?o?.(pe,_.length):o?.(pe);},[_.length,o]);hs.useEffect(()=>{async function pe(){try{let Qe=await _l();tt(Qe);}catch(Qe){console.error("Error fetching user IP:",Qe);}finally{fe(false);}}pe();},[]),hs.useEffect(()=>{async function pe(){try{let Qe=await Ao({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);Ve(Qe.data);}catch(Qe){console.error("Error fetching wallets:",Qe),Z("Failed to load wallet addresses");}finally{_e(false);}}pe();},[e,s,i,a,l,t]);let M=n||Oe?.symbol.toUpperCase()||"USDC",Ie=Vi(Oe?.icon_urls,"png")||Oe?.icon_url,Je=Vi(Oe?.chain_icon_urls,"png")||Oe?.chain_icon_url,[ro,te]=hs.useState([]),[Xs,Bt]=hs.useState(new Map),[Me]=hs.useState(()=>new Date),[Vt,at]=hs.useState(null),[rt,uo]=hs.useState(false),[Gt,Qr]=hs.useState(null);hs.useEffect(()=>{y==="onramp"&&!Gt&&Qr(new Date);},[y,Gt]);let Er=Ce?.destination_token_metadata?.chain_type||i||"ethereum",ea=Ce?.destination_token_metadata?.chain_id||a||"",Yn=`${Er}:${ea}`,Ic=ko(et,Er),bs=Ic?.address||"",_c=Ic?.id??"";hs.useEffect(()=>{Vt&&T?.(Vt);},[Vt]),hs.useEffect(()=>{rt&&(m?.(true),uo(false));},[rt]),hs.useEffect(()=>{f?.(Ie||void 0);},[Ie]),hs.useEffect(()=>{g?.(ro);},[ro]),wn({depositConfirmationMode:"auto_silent",enabled:y==="onramp",depositAddress:bs,chain:Yn,externalUserId:e,publishableKey:t,modalOpenedAt:Gt??Me,depositWalletId:_c,depositExecutions:ro,trackedExecutions:Xs,setDepositExecutions:te,setTrackedExecutions:Bt,setLatestExecution:at,setShowStatusSheet:uo,onDepositSuccess:c,onExecutionsChange:g,onDepositError:p}),hs.useEffect(()=>{async function pe(){try{let Qe=await Rl(t);se(Qe.data),Xt(Qe.preferred||[]);}catch(Qe){console.error("Error fetching fiat currencies:",Qe);}}pe();},[t]),hs.useEffect(()=>{if(b||nt.length===0||!Pe?.alpha2)return;let pe=Pe.alpha2.toUpperCase(),Qe=nt.find(hr=>hr.country_codes.includes(pe));if(Qe)C(Qe.currency_code.toLowerCase()),!R&&!A&&u(String(Qe.default_amount??100));else if(!R&&!A){let hr=nt.find(kn=>kn.currency_code.toLowerCase()==="usd");hr&&u(String(hr.default_amount??100));}},[nt,Pe,b,R,A]),hs.useEffect(()=>{if(nt.length!==0){if(L.current!==null&&L.current!==d){let pe=nt.find(Qe=>Qe.currency_code.toLowerCase()===d.toLowerCase());pe&&u(String(pe.default_amount??100));}L.current=d;}},[d,nt]),hs.useEffect(()=>{async function pe(){try{let Qe=await Mu({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Re(Qe);}catch(Qe){console.error("Error fetching supported tokens:",Qe);}}pe();},[i,a,l,t]),hs.useEffect(()=>{async function pe(){if(!(!l||!a||!i)&&!Ae){ft(true);try{let Qe=await Nu({country_code:Pe?.alpha2?.toUpperCase()||"US",subdivision_code:Pe?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Dt(Qe);}catch(Qe){console.error("Error fetching default onramp token:",Qe);}finally{ft(false);}}}pe();},[l,a,i,Pe,Ae,t]),hs.useEffect(()=>{let pe=parseFloat(R);if(isNaN(pe)||pe<=0){U([]),G(null);return}if(!Ce||Wt){U([]),me(null);return}let Qe=nt.find(kn=>kn.currency_code.toLowerCase()===d.toLowerCase());if(Qe){if(pe<Qe.minimum_amount){U([]),me(null),G(`Minimum amount is ${nf(d)}${Qe.minimum_amount.toLocaleString()}`);return}if(pe>Qe.maximum_amount){U([]),me(null),G(`Maximum amount is ${nf(d)}${Qe.maximum_amount.toLocaleString()}`);return}}G(null);let hr=setTimeout(()=>{ws(pe);},500);return ()=>clearTimeout(hr)},[R,d,t,Ce,Wt,nt]);let ws=async pe=>{if(!Ce){Z("Loading token information...");return}Q(true),Z(null);try{let Qe={country_code:Pe?.alpha2?.toUpperCase()||"US",source_amount:pe.toString(),source_currency:d.toLowerCase(),destination_currency:Ce.destination_currency,destination_network:Ce.destination_network,subdivision_code:Pe?.state||void 0},hr=await zu(Qe,t);U(hr.data);let kn=Ge.current,Fc=je.current;if(kn&&Fc){let _i=hr.data.find(V=>V.service_provider===Fc.service_provider);if(_i){if(me(_i),hr.data.length>0){let V=hr.data[0];qe||be(V.service_provider),Te(_i.service_provider===qe);}}else if(hr.data.length>0){let V=hr.data[0];me(V),be(V.service_provider),Te(!0),Ke(!1);}}else if(hr.data.length>0){let _i=hr.data[0];me(_i),be(_i.service_provider),Te(!0);}xe(60);}catch(Qe){console.error("Failed to fetch quotes:",Qe),Z("Failed to fetch quotes. Please try again."),U([]);}finally{Q(false);}};hs.useEffect(()=>{if(_.length===0)return;let pe=setInterval(()=>{xe(Qe=>{if(Qe<=1){let hr=parseFloat(R);return !isNaN(hr)&&hr>0&&ws(hr),60}return Qe-1});},1e3);return ()=>clearInterval(pe)},[_.length,R]);let Pc=pe=>{(/^\d*\.?\d{0,2}$/.test(pe)||pe==="")&&(u(pe),F(true));},ta=pe=>{u(pe.toString()),F(true);},Ru=async()=>{if(Y&&Ce)try{let pe=Ce.destination_token_metadata.chain_type,Qe=ko(et,pe);if(!Qe?.address){Z("Wallet address not available");return}let hr={service_provider:Y.service_provider,country_code:Y.country_code?.toUpperCase()||Pe?.alpha2?.toUpperCase()||"US",source_currency:Y.source_currency,source_amount:R,destination_currency:Y.destination_currency,destination_network:Y.destination_network,wallet_address:Qe.address,subdivision_code:Pe?.state||void 0},kn=await Uu(hr,t);Ut({provider:Y,sourceCurrency:d,sourceAmount:R,sessionUrl:kn.url}),P(kn.url),j(!0);}catch(pe){console.error("Failed to create session:",pe),Z("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:pe});}},Ii=nf(d),hl=()=>{j(false),N("onramp"),c?.({message:"Payment flow completed"});},Iu=()=>jsxRuntime.jsx(DS,{visible:Ue,onClose:hl,url:Se,providerName:Y?.service_provider_display_name||"Complete Payment",colors:v,fonts:I,borderTopLeftRadius:x?.webView?.borderTopLeftRadius??w,borderTopRightRadius:x?.webView?.borderTopRightRadius??k});return y==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ie.amountViewContainer,children:[jsxRuntime.jsxs(xt,{style:ie.scrollContainer,contentContainerStyle:ie.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:ie.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ce(true),style:[ie.currencyButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.input.borderRadius,borderWidth:S.input.borderWidth,borderColor:S.input.borderColor}],children:[D&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(D,"png"))},style:ie.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ie.currencyText,{color:S.card.titleColor,fontFamily:I.medium}],children:d.toUpperCase()}),jsxRuntime.jsx(er,{size:16,color:S.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(jd,{open:We,onOpenChange:ce,currencies:nt,preferredCurrencyCodes:Ye,selectedCurrency:d,onSelectCurrency:pe=>{C(pe.toLowerCase()),O(true);},borderTopLeftRadius:x?.currencyModal?.borderTopLeftRadius??w,borderTopRightRadius:x?.currencyModal?.borderTopRightRadius??k}),jsxRuntime.jsx(reactNative.View,{style:ie.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:ie.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.currencySymbol,{color:S.container.titleColor,fontFamily:I.medium}],children:Ii}),jsxRuntime.jsx(reactNative.TextInput,{style:[ie.amountInput,{color:S.container.titleColor,fontFamily:I.medium}],value:R,onChangeText:Pc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:v.foregroundMuted})]})}),D?.suggested_amounts&&D.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:ie.quickAmounts,children:D.suggested_amounts.map(pe=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ta(pe),style:[ie.quickAmountButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.button.borderRadius,borderWidth:parseFloat(R)===pe?2:S.button.borderWidth,borderColor:parseFloat(R)===pe?v.primary:S.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ie.quickAmountText,{color:S.card.titleColor,fontFamily:I.medium}],children:[Ii,pe.toLocaleString()]})},pe))}),Ne&&jsxRuntime.jsx(reactNative.Text,{style:[ie.validationError,{color:v.error,fontFamily:I.regular}],children:Ne}),jsxRuntime.jsxs(reactNative.View,{style:ie.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.providerLabel,{color:S.card.labelColor,fontFamily:I.medium}],children:"Provider"}),_.length>0&&!W&&jsxRuntime.jsxs(reactNative.Text,{style:[ie.refreshText,{color:S.card.labelRightColor,fontFamily:I.regular}],children:["Refreshing in ",we,"s"]})]}),jsxRuntime.jsx(vr,{cardTokens:S.depositCard.quoteProvider.card,onPress:W||_.length===0?void 0:()=>ae(true),contentStyle:reactNative.StyleSheet.flatten([ie.providerButton,(W||_.length===0)&&ie.disabled]),children:W?jsxRuntime.jsxs(reactNative.View,{style:ie.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:v.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ie.loadingText,{color:S.container.subtitleColor,fontFamily:I.regular}],children:"Finding best rates..."})]}):Y?jsxRuntime.jsxs(reactNative.View,{style:ie.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.providerInfo,children:[J&&jsxRuntime.jsx(reactNative.Text,{style:[ie.autoPickedText,{color:S.container.subtitleColor,fontFamily:I.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:ie.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Uc(Y.icon_urls,"png",Y.icon_url))},style:ie.providerIconImage},`provider-${Y.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.providerName,{color:S.card.titleColor,fontFamily:I.medium}],children:Y.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.bestPriceText,{color:S.container.subtitleColor,fontFamily:I.regular}],children:[Y.destination_amount.toFixed(2)," ",M]})]})]})]}),jsxRuntime.jsx(_r,{size:20,color:S.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[ie.noProviderText,{color:S.container.subtitleColor,fontFamily:I.regular}],children:parseFloat(R)>0?"No providers available":"Enter an amount to see providers"})}),ze&&jsxRuntime.jsx(reactNative.Text,{style:[ie.errorText,{color:v.error,fontFamily:I.regular}],children:ze})]}),jsxRuntime.jsxs(_t,{visible:Fe,onClose:()=>ae(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:x?.providerModal?.borderTopLeftRadius??w,borderTopRightRadius:x?.providerModal?.borderTopRightRadius??k,children:[jsxRuntime.jsx(zr,{title:"Select Provider",showBack:false,onClose:()=>ae(false)}),jsxRuntime.jsx(xt,{style:ie.providerModalList,contentContainerStyle:ie.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:ie.quotesList,children:_.map(pe=>{let Qe=Y?.service_provider===pe.service_provider;return jsxRuntime.jsxs(vr,{cardTokens:S.depositCard.quoteProvider.card,onPress:()=>{me(pe),Ke(true),Te(pe.service_provider===qe),ae(false);},contentStyle:reactNative.StyleSheet.flatten([ie.quoteItem,Qe&&{borderWidth:2,borderColor:v.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:ie.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Uc(pe.icon_urls,"png",pe.icon_url))},style:ie.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[ie.quoteName,{color:S.card.titleColor,fontFamily:I.medium}],children:pe.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ie.quoteAmount,{color:S.card.textRightColor,fontFamily:I.medium}],children:[pe.destination_amount.toFixed(2)," ",M]}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.quoteSource,{color:S.card.subtextRightColor,fontFamily:I.regular}],children:["Fee: ",Ii,pe.total_fee.toFixed(2)]})]})]},pe.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ie.continueButtonContainer,{backgroundColor:v.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:W||Ee||!Y||parseFloat(R)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Ru,disabled:W||Ee||!Y||parseFloat(R)<=0,style:[ie.continueButton,{backgroundColor:S.container.buttonColor,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:S.container.buttonTitleColor,fontFamily:I.medium}],children:Ee?"Loading...":"Continue"})})})})]}),Iu()]}):y==="onramp"&&st?jsxRuntime.jsxs(reactNative.View,{style:ie.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Uc(st.provider.icon_urls,"png",st.provider.icon_url))},style:ie.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.onrampTitle,{color:S.container.titleColor,fontFamily:I.medium}],children:["Complete transaction with ",st.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.onrampSubtitle,{color:S.container.subtitleColor,fontFamily:I.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[ie.flowDiagram,{backgroundColor:S.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ie.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:qt(`/icons/currencies/png/${st.sourceCurrency.toLowerCase()}.png`)},style:ie.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[ie.flowLabel,{color:S.card.subtitleColor,fontFamily:I.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.flowValue,{color:S.card.titleColor,fontFamily:I.medium}],children:st.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ie.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Vi(Ce?.destination_token_metadata?.icon_urls,"png")||Ce?.destination_token_metadata?.icon_url||qt("/icons/tokens/png/usdc.png")},style:ie.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Vi(Ce?.destination_token_metadata?.chain?.icon_urls,"png")||Ce?.destination_token_metadata?.chain?.icon_url||qt("/icons/networks/png/polygon.png")},style:[ie.flowNetworkBadge,{borderColor:v.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.flowLabel,{color:S.card.subtitleColor,fontFamily:I.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.flowValue,{color:S.card.titleColor,fontFamily:I.medium}],children:"USDC"})]}),jsxRuntime.jsx(_r,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ie.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Ie||qt("/icons/tokens/png/usdc.png")},style:ie.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Je||qt("/icons/networks/png/polygon.png")},style:[ie.flowNetworkBadge,{borderColor:v.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.flowLabel,{color:S.card.subtitleColor,fontFamily:I.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.flowValue,{color:S.card.titleColor,fontFamily:I.medium}],children:M})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ie.onrampInfoBox,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ie.onrampInfoText,{color:S.card.descriptionColor,fontFamily:I.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 DS({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:zs.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:zs.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[zs.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:zs.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:zs.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:zs.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:zs.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var zs=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"}}),ie=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 BS(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 AS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Yd({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=B(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=oe(Le(e.destination_token_metadata,"png")||qt("/icons/tokens/png/usdc.png")),c=i?"Deposit Processing":"Deposit Completed",p=BS(e.created_at||new Date().toISOString()),g=AS(e.source_amount_usd);return jsxRuntime.jsxs(vr,{cardTokens:s,onPress:t,contentStyle:gi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:gi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:gi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[gi.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(sa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:gi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[gi.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[gi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:gi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[gi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(_r,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var gi=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 vg(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 Rg(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 ES(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Ig=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function _g(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function MS(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 zS({count:e=4}){let{colors:t,components:r}=B(),o=hs.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return hs.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:Us.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Us.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Us.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Us.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Us.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Us.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Us.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var Us=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 lf({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=B(),[l,c]=hs.useState(r),[p,g]=hs.useState(false),[T,m]=hs.useState(null),[f,w]=hs.useState(false),k=hs.useRef(null);hs.useEffect(()=>{if(!e||!o)return;let d=async()=>{g(true);try{let O=[...(await un(o,n,"deposit")).data].sort((A,F)=>{let _=A.created_at?new Date(A.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-_});c(O);}catch(b){console.error("Failed to fetch executions:",b),c(r);}finally{g(false);}};d();let C=setInterval(d,1e4);return ()=>clearInterval(C)},[e,o,n,r]),hs.useEffect(()=>{r.length>0&&c(d=>{let C=new Set(d.map(O=>O.id)),b=r.filter(O=>!C.has(O.id));return b.length>0?[...b,...d]:d});},[r]),hs.useEffect(()=>{e||m(null);},[e]);let x=d=>{m(d);},v=()=>{m(null),w(false);},I=()=>{m(null),t();},S=()=>{if(!T)return null;let d=T,C=d.status==="pending"||d.status==="waiting"||d.status==="delayed",b=d.status==="succeeded",O=oe(Le(d.destination_token_metadata,"png")||qt("/icons/tokens/png/usdc.png")),A=d.provider_metadata?.details,F=A?.currencyIn,_=A?.currencyOut;F?.currency?.symbol||"USDC";_?.currency?.symbol||"USDC";let Q=Rg(d.source_amount_base_unit,d.source_token_metadata?.decimals),ze=Rg(d.destination_amount_base_unit,d.destination_token_metadata?.decimals),Z=ES(d.source_amount_usd),Ne=vg(d.source_chain_type,d.source_chain_id),G=vg(d.destination_chain_type,d.destination_chain_id),ne=()=>{d.explorer_url&&reactNative.Linking.openURL(d.explorer_url);},H=()=>{d.destination_explorer_url&&reactNative.Linking.openURL(d.destination_explorer_url);};return jsxRuntime.jsxs(xt,{ref:k,style:$e.scrollContainer,contentContainerStyle:$e.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:$e.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:$e.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:O},style:$e.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[$e.statusBadge,{backgroundColor:C?s.warning:s.success,borderColor:s.background}],children:C?jsxRuntime.jsx(er,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.statusDot,{backgroundColor:C?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[$e.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[$e.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:MS(d.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[$e.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Q," ",_g(d.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[ze," ",_g(d.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Z})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ne})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:G})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Y=!f;w(Y),Y?setTimeout(()=>{k.current?.scrollToEnd({animated:true});},100):k.current?.scrollTo({y:0,animated:true});},style:$e.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(xn,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(er,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:[$e.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[d.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ne,style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:$e.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ig(d.transaction_hash)}),jsxRuntime.jsx(Ko,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.cardDivider,{backgroundColor:s.border}]})]}),d.destination_explorer_url&&b&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:H,style:$e.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:$e.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ig(d.destination_transaction_hashes[0])}),jsxRuntime.jsx(Ko,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},R=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zr,{title:T?"Deposit Details":"Deposit Tracker",onClose:I,showClose:!T,showBack:!!T,onBack:v}),T?S():R?jsxRuntime.jsx(zS,{}):jsxRuntime.jsx(xt,{style:$e.scrollContainer,contentContainerStyle:$e.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:$e.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:$e.executionsList,children:l.map(d=>jsxRuntime.jsx(Yd,{execution:d,onPress:()=>x(d)},d.id))})})]})}var $e=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 uc(e,t=true){let[r,o]=hs.useState(null),[n,s]=hs.useState(null),[i,a]=hs.useState(false),[l,c]=hs.useState(false),[p,g]=hs.useState(null),[T,m]=hs.useState(null);hs.useEffect(()=>{!t||r||(a(true),_l().then(x=>{o(x),g(null);}).catch(x=>{g(x instanceof Error?x:new Error(String(x)));}).finally(()=>{a(false);}));},[t,r]),hs.useEffect(()=>{!t||!e||n||(c(true),Il(e).then(x=>{s(x),m(null);}).catch(x=>{m(x instanceof Error?x:new Error(String(x)));}).finally(()=>{c(false);}));},[t,e,n]);let f=i||l,w=p||T||null,k=null;if(r&&n){let x=n.blocked_country_codes||[],v=r.alpha2.toUpperCase();k=!x.some(I=>I.toUpperCase()===v);}return {isAllowed:k,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:w}}var uf="unifold_recent_tokens",$S=5,Lg=[{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 tu(){try{let e=await wp__default.default.getItem(uf);return e?JSON.parse(e):[]}catch{return []}}async function qS(e){try{let r=(await tu()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,$S);await wp__default.default.setItem(uf,JSON.stringify(o));}catch{}}async function QS(e){try{let r=(await tu()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await wp__default.default.setItem(uf,JSON.stringify(r)),r}catch{return []}}function pf({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:g=true}){let{colors:T,fonts:m,components:f}=B(),[w,k]=hs.useState(""),[x,v]=hs.useState([]);hs.useEffect(()=>{e&&tu().then(v);},[e]),hs.useEffect(()=>{e||k("");},[e]);let I=hs.useMemo(()=>{let b=[];return r.forEach(O=>{O.chains.forEach(A=>{b.push({token:O,chain:A});});}),b},[r]),S=hs.useMemo(()=>{let b=[],O=new Set,A=(F,_,U,W)=>{let Q=`${F}-${_}:${U}`;if(O.has(Q))return;let ze=r.find(Ne=>Ne.symbol===F);if(!ze)return;let Z=ze.chains.find(Ne=>Ne.chain_type===_&&Ne.chain_id===U);Z&&(O.add(Q),b.push({token:ze,chain:Z,isRecent:W}));};return x.forEach(F=>{A(F.symbol,F.chainType,F.chainId,true);}),Lg.forEach(F=>{A(F.symbol,F.chainType,F.chainId,false);}),b},[r,x]),R=hs.useMemo(()=>{if(!w.trim())return I;let b=w.toLowerCase();return I.filter(({token:O,chain:A})=>O.symbol.toLowerCase().includes(b)||O.name.toLowerCase().includes(b)||A.chain_name.toLowerCase().includes(b))},[I,w]),u=(b,O,A)=>Lg.some(F=>F.symbol===b&&F.chainType===O&&F.chainId===A),d=async(b,O)=>{let A=`${O.chain_type}:${O.chain_id}`;if(!u(b.symbol,O.chain_type,O.chain_id)){await qS({symbol:b.symbol,chainType:O.chain_type,chainId:O.chain_id});let F=await tu();v(F);}k(""),s(b.symbol,A),t();},C=async(b,O)=>{let A=await QS({symbol:b.symbol,chainType:O.chain_type,chainId:O.chain_id});v(A);};return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:g,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[jt.header,!g&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:jt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[jt.headerTitle,{color:f.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:jt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(wt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:jt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[jt.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:m.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:w,onChangeText:k,autoCapitalize:"none",autoCorrect:false})}),!l&&S.length>0&&!w&&jsxRuntime.jsxs(reactNative.View,{style:jt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:jt.quickSelectScroll,children:S.map(({token:b,chain:O,isRecent:A})=>{let F=`${O.chain_type}:${O.chain_id}`;b.symbol===o&&F===n;return jsxRuntime.jsxs(reactNative.View,{children:[A&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>C(b,O),style:jt.removeButton,children:jsxRuntime.jsx(wt,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(b,O),activeOpacity:.7,style:[jt.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:jt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(b,"png"))},style:jt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(O,"png"))},style:[jt.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:jt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.quickSelectSymbol,{color:f.card.titleColor,fontFamily:m.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[jt.quickSelectChain,{color:f.card.subtitleColor,fontFamily:m.regular}],children:O.chain_name})]})]})]},`quick-${b.symbol}-${F}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[jt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsxRuntime.jsx(xt,{style:jt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:jt.tokenListContent,children:R.length===0?jsxRuntime.jsx(reactNative.View,{style:jt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[jt.emptyText,{color:T.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):R.map(({token:b,chain:O})=>{let A=`${O.chain_type}:${O.chain_id}`,F=b.symbol===o&&A===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(b,O),activeOpacity:.7,style:[jt.tokenItem,{backgroundColor:F?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:jt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(b,"png"))},style:jt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(O,"png"))},style:[jt.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:jt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.tokenSymbol,{color:f.card.titleColor,fontFamily:m.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[jt.tokenChainName,{color:f.card.subtitleColor,fontFamily:m.regular}],children:O.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[jt.minDeposit,{color:f.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",O.minimum_deposit_amount_usd]})]})]},`${b.symbol}-${A}`)})})]})}var jt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},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 pc=(e,t)=>`${t}:${e}`,ZS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function ff({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:m,onLatestExecution:f,onShowStatusSheet:w,onSelectedTokenIconUrl:k,wallets:x,borderTopLeftRadius:v,borderTopRightRadius:I,sheetBorderRadius:S}){let{colors:R,fonts:u,components:d}=B(),C=a&&l?`${a}:${l}`:"solana:mainnet",[b,O]=hs.useState("USDC"),[A,F]=hs.useState(C),[_,U]=hs.useState([]),[W,Q]=hs.useState(!x?.length),ze=x?.length?x:_,[Z,Ne]=hs.useState([]),[G,ne]=hs.useState(true),[H,Y]=hs.useState(false),[me,J]=hs.useState(false),[Te,qe]=hs.useState(false),[be,He]=hs.useState([]),[Ke,je]=hs.useState(new Map),[Ge]=hs.useState(()=>new Date),[et,Ve]=hs.useState(null),[Ee,_e]=hs.useState(false),[we,xe]=hs.useState(null),[nt,se]=hs.useState(false);hs.useEffect(()=>{we&&f?.(we);},[we]),hs.useEffect(()=>{Ee&&(w?.(true),_e(false));},[Ee]);let Ye=new Map;Z.forEach(j=>{j.chains.forEach(Se=>{let P=`${Se.chain_type}:${Se.chain_id}`;Ye.has(P)||Ye.set(P,Se);});});let Xt=Array.from(Ye.values()),Oe=ZS(A),Re=Xt.find(j=>j.chain_type===Oe.chainType&&j.chain_id===Oe.chainId),Pe=Re?.chain_type||"ethereum",tt=ko(ze,Pe),Ae=tt?.address||"",fe=hs.useRef(false);hs.useEffect(()=>{async function j(){try{ne(!0),Ve(null);let P=await ei(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Ne(P.data),P.data.length>0&&!fe.current){fe.current=!0;let y,L;if(a&&l)if(c)for(let D of P.data){let N=D.chains.find(M=>M.chain_type===a&&M.chain_id===l&&M.token_address.toLowerCase()===c.toLowerCase());if(N){y=D,L=N;break}}else {let D=M=>M.chain_type===a&&M.chain_id===l,N=P.data.find(M=>M.symbol==="USDC"&&M.chains.some(D));if(N)y=N,L=N.chains.find(D);else for(let M of P.data){let Ie=M.chains.find(D);if(Ie){y=M,L=Ie;break}}}if(!y&&s)for(let D of P.data){let N=D.chains.find(M=>M.token_address.toLowerCase()===s.toLowerCase());if(N){y=D,L=N;break}}y||(y=P.data.find(D=>D.symbol==="USDC"),y&&y.chains.length>0&&(L=y.chains[0])),y||(y=P.data.find(D=>D.symbol==="USDT"),y&&y.chains.length>0&&(L=y.chains[0])),y||(y=P.data[0],y.chains.length>0&&(L=y.chains[0])),y&&O(y.symbol),L&&F(pc(L.chain_id,L.chain_type));}}catch(Se){console.error("Error fetching supported tokens:",Se),Ve("Failed to load supported tokens"),m?.({message:"Failed to load supported tokens",error:Se});}finally{ne(false);}}j();},[t,s,n,o,a,l,c,m]),hs.useEffect(()=>{g&&g(be);},[be,g]),hs.useEffect(()=>{if(x?.length){Q(false);return}if(_.length>0){Q(false);return}let j=null,Se=false,P=async()=>{if(!Se){Q(true);try{let y=await Ao({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Se||(U(y.data),Ve(null),Q(!1));}catch(y){console.error("Error fetching wallets, retrying in 5s:",y),Se||(Ve(y instanceof Error?y.message:"Failed to load wallets"),Q(false),j=setTimeout(P,5e3));}}};return P(),()=>{Se=true,j&&clearTimeout(j);}},[e,r,o,n,s,t,x,_.length]);let Ce=tt?.id??"",{showWaitingUi:Dt,handleIveDeposited:Wt}=wn({depositConfirmationMode:p,depositAddress:Ae,chain:A,externalUserId:e,publishableKey:t,modalOpenedAt:Ge,depositWalletId:Ce,depositExecutions:be,trackedExecutions:Ke,setDepositExecutions:He,setTrackedExecutions:je,setLatestExecution:xe,setShowStatusSheet:_e,onDepositSuccess:T,onExecutionsChange:g,onDepositError:m});hs.useEffect(()=>{if(!Z.length)return;let j=Z.find(P=>P.symbol===b);if(!j||j.chains.length===0){let P=Z.find(y=>y.symbol==="USDC")||Z[0];P&&(O(P.symbol),P.chains.length>0&&F(pc(P.chains[0].chain_id,P.chains[0].chain_type)));return}if(!j.chains.some(P=>pc(P.chain_id,P.chain_type)===A)){let P=j.chains[0];F(pc(P.chain_id,P.chain_type));}},[b,Z,A]);let ft=Z.find(j=>j.symbol===b),st=Le(ft,"png")||void 0;hs.useEffect(()=>{k?.(st);},[st]);let We=(ft?.chains||[]).find(j=>pc(j.chain_id,j.chain_type)===A),ce=async()=>{if(Ae)try{reactNative.Clipboard.setString(Ae),Y(!0),setTimeout(()=>Y(!1),2e3);}catch(j){console.error("Failed to copy:",j);}},Fe=We?.estimated_price_impact_percent??0,ae=We?.max_slippage_percent??.25,Ue=We?.minimum_deposit_amount_usd??3;return G?jsxRuntime.jsxs(reactNative.View,{style:re.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:R.primary}),jsxRuntime.jsx(reactNative.Text,{style:[re.loadingText,{color:R.foregroundMuted,fontFamily:u.regular}],children:"Loading currencies..."})]}):et&&Z.length===0?jsxRuntime.jsxs(reactNative.View,{style:re.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.errorText,{color:R.error,fontFamily:u.regular}],children:et}),jsxRuntime.jsx(reactNative.Text,{style:[re.errorHint,{color:R.foregroundMuted,fontFamily:u.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:re.container,children:[jsxRuntime.jsxs(reactNative.View,{style:re.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.selectorLabel,{color:d.card.labelColor,fontFamily:u.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qe(true),disabled:G||Z.length===0,style:[re.tokenSelectorButton,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],activeOpacity:.7,children:G?jsxRuntime.jsxs(reactNative.View,{style:re.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[re.loadingIcon,{backgroundColor:R.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:re.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[re.loadingLine,{backgroundColor:R.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[re.loadingLine,{backgroundColor:R.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:re.tokenIconWrapper,children:[ft&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(ft,"png"))},style:re.tokenMainIcon}),(We||Re)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(We||Re,"png"))},style:[re.tokenChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:re.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.tokenSelectorSymbol,{color:d.card.titleColor,fontFamily:u.semibold}],children:ft?.symbol||b}),jsxRuntime.jsx(reactNative.Text,{style:[re.tokenSelectorNetwork,{color:d.card.subtitleColor,fontFamily:u.regular}],numberOfLines:1,children:We?.chain_name||Re?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:re.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[re.minDepositText,{color:R.warning,fontFamily:u.medium}],children:["$",Ue," minimum"]}),jsxRuntime.jsx(_r,{size:16,color:d.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(pf,{visible:Te,onClose:()=>qe(false),tokens:Z,selectedToken:b,selectedChainKey:A,onSelect:(j,Se)=>{O(j),F(Se);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??v,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??I}),jsxRuntime.jsx(reactNative.View,{style:re.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[re.qrWrapper,{backgroundColor:R.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:re.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:R.primary}),jsxRuntime.jsx(reactNative.Text,{style:[re.loadingText,{color:R.foregroundMuted,fontFamily:u.regular}],children:"Loading..."})]}):Ae?jsxRuntime.jsx(ns,{value:Ae,size:180,logoUri:oe(Le(We,"png")||qt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:re.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[re.errorText,{color:R.error,fontFamily:u.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:re.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:re.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.addressLabel,{color:d.card.labelColor,fontFamily:u.medium}],children:"Deposit Address"}),H&&jsxRuntime.jsxs(reactNative.View,{style:re.copiedIndicator,children:[jsxRuntime.jsx(pt,{size:14,color:R.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[re.copiedText,{color:R.success,fontFamily:u.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(vr,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!W&&Ae?ce:void 0,contentStyle:re.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.addressText,{color:d.card.titleColor,fontFamily:u.regular}],numberOfLines:2,children:W?"Loading...":Ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:re.addressCopyIcon,children:jsxRuntime.jsx(ln,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[re.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(!me),style:re.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(po,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.detailsLabel,{color:d.card.titleColor,fontFamily:u.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:re.chevronContainer,children:me?jsxRuntime.jsx(xn,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(er,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),me&&jsxRuntime.jsxs(reactNative.View,{style:re.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(cn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:d.card.titleColor,fontFamily:u.regular}],children:["Price impact: ",Fe.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>se(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(dn,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:d.card.titleColor,fontFamily:u.regular}],children:["Slippage: Auto \u2022 ",ae.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>se(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(dn,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ia,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:d.card.titleColor,fontFamily:u.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(pg,{depositConfirmationMode:p,depositAddress:Ae,showWaitingUi:Dt,latestExecution:we,onIveDeposited:Wt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:re.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[re.termsText,{color:R.primary,fontFamily:u.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(_t,{visible:nt,onClose:()=>se(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??v,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:R.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:d.header.titleColor,fontFamily:u.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>se(false),style:re.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[re.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(cn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardTitle,{color:d.card.titleColor,fontFamily:u.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[re.infoCardValue,{color:d.card.titleColor,fontFamily:u.medium}],children:[Fe.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardDescription,{color:d.card.descriptionColor,fontFamily:u.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:[re.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[re.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardTitle,{color:d.card.titleColor,fontFamily:u.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[re.infoCardValue,{color:d.card.titleColor,fontFamily:u.medium}],children:[ae.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardDescription,{color:d.card.descriptionColor,fontFamily:u.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."})]})]})]})]})}var re=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 Ya=(e,t)=>`${t}:${e}`,oT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},nT=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function nu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:m,onLatestExecution:f,onShowStatusSheet:w,onSelectedTokenIconUrl:k,onShowInfoSheet:x,onInfoSheetData:v,wallets:I,borderTopLeftRadius:S,borderTopRightRadius:R,sheetBorderRadius:u}){let{colors:d,fonts:C,components:b}=B(),O=a&&l?`${a}:${l}`:"solana:mainnet",[A,F]=hs.useState("USDC"),[_,U]=hs.useState(O),[W,Q]=hs.useState([]),[ze,Z]=hs.useState(!I?.length),Ne=I?.length?I:W,[G,ne]=hs.useState([]),[H,Y]=hs.useState(true),[me,J]=hs.useState(false),[Te,qe]=hs.useState(false),[be,He]=hs.useState(false),[Ke,je]=hs.useState([]),[Ge,et]=hs.useState(new Map),[Ve]=hs.useState(()=>new Date),[Ee,_e]=hs.useState(null),[we,xe]=hs.useState(false),[nt,se]=hs.useState(null),[Ye,Xt]=hs.useState(false),[Oe,Re]=hs.useState(false),[Pe,tt]=hs.useState(""),[Ae,fe]=hs.useState(""),Ce=hs.useRef(new reactNative.Animated.Value(0)).current;hs.useEffect(()=>{let Me=reactNative.Animated.loop(reactNative.Animated.timing(Ce,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Me.start(),()=>Me.stop()},[Ce]);let Dt=Ce.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});hs.useEffect(()=>{nt&&f?.(nt);},[nt]),hs.useEffect(()=>{we&&(w?.(true),xe(false));},[we]);let Wt=new Map;G.forEach(Me=>{Me.chains.forEach(Vt=>{let at=`${Vt.chain_type}:${Vt.chain_id}`;Wt.has(at)||Wt.set(at,Vt);});});let ft=Array.from(Wt.values()),st=oT(_),Ut=ft.find(Me=>Me.chain_type===st.chainType&&Me.chain_id===st.chainId),We=Ut?.chain_type||"ethereum",ce=ko(Ne,We),Fe=ce?.address||"",ae=hs.useRef(false);hs.useEffect(()=>{async function Me(){try{Y(!0),_e(null);let at=await ei(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(ne(at.data),at.data.length>0&&!ae.current){ae.current=!0;let rt,uo;if(a&&l)if(c)for(let Gt of at.data){let Qr=Gt.chains.find(Er=>Er.chain_type===a&&Er.chain_id===l&&Er.token_address.toLowerCase()===c.toLowerCase());if(Qr){rt=Gt,uo=Qr;break}}else {let Gt=Er=>Er.chain_type===a&&Er.chain_id===l,Qr=at.data.find(Er=>Er.symbol==="USDC"&&Er.chains.some(Gt));if(Qr)rt=Qr,uo=Qr.chains.find(Gt);else for(let Er of at.data){let ea=Er.chains.find(Gt);if(ea){rt=Er,uo=ea;break}}}if(!rt&&s)for(let Gt of at.data){let Qr=Gt.chains.find(Er=>Er.token_address.toLowerCase()===s.toLowerCase());if(Qr){rt=Gt,uo=Qr;break}}rt||(rt=at.data.find(Gt=>Gt.symbol==="USDC"),rt&&rt.chains.length>0&&(uo=rt.chains[0])),rt||(rt=at.data.find(Gt=>Gt.symbol==="USDT"),rt&&rt.chains.length>0&&(uo=rt.chains[0])),rt||(rt=at.data[0],rt.chains.length>0&&(uo=rt.chains[0])),rt&&F(rt.symbol),uo&&U(Ya(uo.chain_id,uo.chain_type));}}catch(Vt){console.error("Error fetching supported tokens:",Vt),_e("Failed to load supported tokens"),m?.({message:"Failed to load supported tokens",error:Vt});}finally{Y(false);}}Me();},[t,s,n,o,a,l,c,m]),hs.useEffect(()=>{g&&g(Ke);},[Ke,g]),hs.useEffect(()=>{if(I?.length){Z(false);return}if(W.length>0){Z(false);return}let Me=null,Vt=false,at=async()=>{if(!Vt){Z(true);try{let rt=await Ao({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Vt||(Q(rt.data),_e(null),Z(!1));}catch(rt){console.error("Error fetching wallets, retrying in 5s:",rt),Vt||(_e(rt instanceof Error?rt.message:"Failed to load wallets"),Z(false),Me=setTimeout(at,5e3));}}};return at(),()=>{Vt=true,Me&&clearTimeout(Me);}},[e,r,o,n,s,t,I,W.length]);let Ue=ce?.id??"",{showWaitingUi:j,handleIveDeposited:Se}=wn({depositConfirmationMode:p,depositAddress:Fe,chain:_,externalUserId:e,publishableKey:t,modalOpenedAt:Ve,depositWalletId:Ue,depositExecutions:Ke,trackedExecutions:Ge,setDepositExecutions:je,setTrackedExecutions:et,setLatestExecution:se,setShowStatusSheet:xe,onDepositSuccess:T,onExecutionsChange:g,onDepositError:m}),P=p==="manual"&&Fe&&!j;hs.useEffect(()=>{if(!G.length)return;let Me=G.find(at=>at.symbol===A);if(!Me||Me.chains.length===0){let at=G.find(rt=>rt.symbol==="USDC")||G[0];at&&(F(at.symbol),at.chains.length>0&&U(Ya(at.chains[0].chain_id,at.chains[0].chain_type)));return}if(!Me.chains.some(at=>Ya(at.chain_id,at.chain_type)===_)){let at=Me.chains[0];U(Ya(at.chain_id,at.chain_type));}},[A,G,_]);let y=G.find(Me=>Me.symbol===A),L=Le(y,"png")||void 0;hs.useEffect(()=>{k?.(L);},[L]);let D=y?.chains||[],N=D.find(Me=>Ya(Me.chain_id,Me.chain_type)===_),M=async()=>{if(Fe)try{reactNative.Clipboard.setString(Fe),J(!0),setTimeout(()=>J(!1),2e3);}catch(Me){console.error("Failed to copy:",Me);}},Ie=N?.estimated_price_impact_percent??0,Je=N?.max_slippage_percent??.25,ro=N?.minimum_deposit_amount_usd??3,te=N?.chain_name||Ut?.chain_name||"Network",Xs=hs.useMemo(()=>{if(!Pe.trim())return D;let Me=Pe.toLowerCase();return D.filter(Vt=>Vt.chain_name.toLowerCase().includes(Me))},[D,Pe]),Bt=hs.useMemo(()=>{if(!Ae.trim())return G;let Me=Ae.toLowerCase();return G.filter(Vt=>Vt.symbol.toLowerCase().includes(Me)||Vt.name?.toLowerCase().includes(Me)||Vt.chains.some(at=>at.chain_name.toLowerCase().includes(Me)))},[G,Ae]);return H?jsxRuntime.jsxs(reactNative.View,{style:le.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsx(reactNative.Text,{style:[le.loadingText,{color:d.foregroundMuted,fontFamily:C.regular}],children:"Loading currencies..."})]}):Ee&&G.length===0?jsxRuntime.jsxs(reactNative.View,{style:le.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.errorText,{color:d.error,fontFamily:C.regular}],children:Ee}),jsxRuntime.jsx(reactNative.Text,{style:[le.errorHint,{color:d.foregroundMuted,fontFamily:C.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:le.container,children:[jsxRuntime.jsxs(reactNative.View,{style:le.content,children:[jsxRuntime.jsxs(reactNative.View,{style:le.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.intentAddressLabel,{color:d.foregroundMuted,fontFamily:C.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[le.qrCard,{backgroundColor:d.background,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth>0?b.card.borderWidth:1,borderColor:b.card.borderColor}],children:ze?jsxRuntime.jsxs(reactNative.View,{style:le.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.primary}),jsxRuntime.jsx(reactNative.Text,{style:[le.loadingText,{color:d.foregroundMuted,fontFamily:C.regular}],children:"Loading..."})]}):Fe?jsxRuntime.jsx(reactNative.View,{style:le.qrWrapper,children:jsxRuntime.jsx(ns,{value:Fe,size:200,logoUri:oe(Le(y,"png")||qt("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:oe(Le(N,"png")||qt("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:le.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[le.errorText,{color:d.error,fontFamily:C.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:le.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{tt(""),Re(true);},style:[le.selectorPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[(N||Ut)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(N||Ut,"png"))},style:le.selectorPillIcon}),jsxRuntime.jsx(er,{size:14,color:b.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{fe(""),He(true);},disabled:H||G.length===0,style:[le.selectorPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[y&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(y,"png"))},style:le.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[le.selectorPillText,{color:b.card.titleColor,fontFamily:C.semibold}],children:y?.symbol||A}),jsxRuntime.jsx(er,{size:14,color:b.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:le.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:M,style:[le.addressPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.addressPillText,{color:b.card.titleColor,fontFamily:C.regular}],numberOfLines:1,children:ze?"Loading...":Fe?nT(Fe):"No address"}),me?jsxRuntime.jsx(pt,{size:14,color:d.success,strokeWidth:2}):jsxRuntime.jsx(ln,{size:14,color:b.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:j&&!nt?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:Dt}]},children:jsxRuntime.jsx(wl,{size:16,color:d.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:d.foregroundMuted,fontFamily:C.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{v?.({priceImpact:Ie,maxSlippage:Je,minDepositUsd:ro,chainName:te}),x?.(true);},style:le.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(dn,{size:14,color:b.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[le.infoFooterText,{color:b.card.subtitleColor,fontFamily:C.regular}],numberOfLines:1,children:["$",ro," ",te," Minimum and ","<","1 min Processing"]})]}),P?jsxRuntime.jsxs(reactNative.View,{style:le.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:le.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Se,activeOpacity:.8,style:[le.ctaButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[le.ctaText,{color:d.primaryForeground??"#FFF",fontFamily:C.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:le.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[le.ctaButton,{backgroundColor:b.card.backgroundColor,borderRadius:b.button.borderRadius,borderWidth:1,borderColor:d.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[le.ctaText,{color:d.foreground,fontFamily:C.semibold}],children:me?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[le.ctaButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[le.ctaText,{color:"#FFFFFF",fontFamily:C.semibold}],children:me?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(_t,{visible:be,onClose:()=>{He(false),fe("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:u?.tokenSelector?.borderTopLeftRadius??S,borderTopRightRadius:u?.tokenSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[le.sheetHeader,{borderBottomColor:d.border}],children:[jsxRuntime.jsx(reactNative.View,{style:le.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[le.sheetTitle,{color:b.header.titleColor,fontFamily:C.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{He(false),fe("");},style:le.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(wt,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:le.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[le.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:C.regular,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:b.search.placeholderColor,value:Ae,onChangeText:fe,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(xt,{style:le.sheetList,contentContainerStyle:le.sheetListContent,showsVerticalScrollIndicator:false,children:Bt.length===0?jsxRuntime.jsx(reactNative.View,{style:le.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[le.emptyText,{color:d.foregroundMuted,fontFamily:C.regular}],children:"No tokens found"})}):Bt.map(Me=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{F(Me.symbol),He(false),fe("");},activeOpacity:.7,style:[le.sheetItem,{backgroundColor:A===Me.symbol?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(Me,"png"))},style:le.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[le.sheetItemTitle,{color:b.card.titleColor,fontFamily:C.medium}],children:Me.symbol}),jsxRuntime.jsx(reactNative.View,{style:le.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[le.sheetItemBadge,{borderWidth:1,borderColor:d.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[le.sheetItemBadgeText,{color:b.card.subtitleColor,fontFamily:C.medium}],children:[Me.chains.length," chain",Me.chains.length!==1?"s":""]})})]},Me.symbol))})]}),jsxRuntime.jsxs(_t,{visible:Oe,onClose:()=>{Re(false),tt("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:u?.chainSelector?.borderTopLeftRadius??S,borderTopRightRadius:u?.chainSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[le.sheetHeader,{borderBottomColor:d.border}],children:[jsxRuntime.jsx(reactNative.View,{style:le.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[le.sheetTitle,{color:b.header.titleColor,fontFamily:C.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Re(false),tt("");},style:le.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(wt,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:le.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[le.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:C.regular,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],placeholder:"Search networks",placeholderTextColor:b.search.placeholderColor,value:Pe,onChangeText:tt,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(xt,{style:le.sheetList,contentContainerStyle:le.sheetListContent,showsVerticalScrollIndicator:false,children:Xs.length===0?jsxRuntime.jsx(reactNative.View,{style:le.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[le.emptyText,{color:d.foregroundMuted,fontFamily:C.regular}],children:"No networks found"})}):Xs.map(Me=>{let Vt=Ya(Me.chain_id,Me.chain_type),at=_===Vt;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{U(Vt),Re(false),tt("");},activeOpacity:.7,style:[le.chainItem,{backgroundColor:at?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(Me,"png"))},style:le.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:le.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[le.chainItemName,{color:b.card.titleColor,fontFamily:C.medium}],children:Me.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[le.chainMinBadge,{backgroundColor:`${d.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[le.chainMinBadgeText,{color:d.warning,fontFamily:C.medium}],children:["$",Me.minimum_deposit_amount_usd," Minimum"]})})]},Vt)})})]})]})}var le=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},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"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Hg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function lT(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 su({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:g,heightCompleted:T,heightCompletedExpanded:m}){let {colors:f,fonts:w,components:k}=B(),[x,v]=hs.useState(false),I=t==="pending"||t==="waiting"||t==="delayed",S=t==="succeeded",u=()=>{o&&reactNative.Linking.openURL(o);},d=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(_t,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:S?x?m??T??.55:T??.55:g??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:pr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:pr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:k.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:pr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:pr.container,children:[jsxRuntime.jsx(reactNative.View,{style:pr.iconContainer,children:I?jsxRuntime.jsx(bt,{size:80,strokeWidth:4,iconSize:56,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(r)},style:pr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[pr.tokenIconFill,{backgroundColor:f.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(r)},style:pr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[pr.tokenIconLarge,{backgroundColor:f.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[pr.statusBadge,{backgroundColor:k.container.iconBackgroundColor}],children:jsxRuntime.jsx(pt,{size:16,color:k.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[pr.title,{color:k.container.titleColor,fontFamily:w.semibold}],children:I?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[pr.amount,{color:k.container.titleColor,fontFamily:w.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[pr.date,{color:k.container.subtitleColor,fontFamily:w.regular}],children:lT(s)}),jsxRuntime.jsx(reactNative.Text,{style:[pr.subtitle,{color:k.container.subtitleColor,fontFamily:w.regular}],children:I?"This usually takes less than a minute.":"Your account has been credited successfully!"}),S&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:pr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[pr.divider,{backgroundColor:f.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:pr.detailsToggle,onPress:()=>v(!x),children:[jsxRuntime.jsx(reactNative.Text,{style:[pr.detailsToggleText,{color:k.container.actionTitle,fontFamily:w.medium}],children:x?"See less":"See more details"}),x?jsxRuntime.jsx(xn,{size:18,color:k.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(er,{size:18,color:k.container.actionColor,strokeWidth:2})]}),x&&jsxRuntime.jsxs(reactNative.View,{style:pr.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[pr.txButton,{backgroundColor:k.card.backgroundColor,borderColor:f.border}],onPress:u,children:[jsxRuntime.jsx(reactNative.Text,{style:[pr.txLabel,{color:k.card.titleColor,fontFamily:w.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[pr.txHash,{color:k.card.subtitleColor,fontFamily:w.regular}],children:Hg(o)}),jsxRuntime.jsx(Ko,{size:16,color:k.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[pr.txButton,{backgroundColor:k.card.backgroundColor,borderColor:f.border}],onPress:d,children:[jsxRuntime.jsx(reactNative.Text,{style:[pr.txLabel,{color:k.card.titleColor,fontFamily:w.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[pr.txHash,{color:k.card.subtitleColor,fontFamily:w.regular}],children:Hg(n)}),jsxRuntime.jsx(Ko,{size:16,color:k.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var pr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},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 mf({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:g}=B(),T=[{icon:jsxRuntime.jsx(po,{size:14,color:g.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(cn,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(cn,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(bo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:nn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:nn.header,children:[jsxRuntime.jsxs(reactNative.View,{style:nn.titleRow,children:[jsxRuntime.jsx(dn,{size:16,color:g.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[nn.title,{color:g.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:nn.closeButton,children:jsxRuntime.jsx(wt,{size:18,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:nn.rows,children:[T.map((m,f)=>jsxRuntime.jsxs(reactNative.View,{style:nn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[nn.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:m.icon}),jsxRuntime.jsx(reactNative.Text,{style:[nn.label,{color:g.card.titleColor,fontFamily:p.regular}],children:m.label})]},f)),jsxRuntime.jsxs(reactNative.View,{style:nn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[nn.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ia,{size:14,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[nn.label,{color:g.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var nn=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var Tn={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"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function hT(){let{colors:e,components:t}=B(),r=hs.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;hs.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:[cs.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[cs.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:cs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[cs.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[cs.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:cs.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[cs.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:cs.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var cs=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 gT({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=B(),s=({tab:i,label:a,glyph:l})=>{let c=e===i,p=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:fc.item,activeOpacity:.8,onPress:()=>t(i),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[fc.badge,{backgroundColor:p}],children:jsxRuntime.jsx(reactNative.Text,{style:[fc.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[fc.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[fc.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(s,{tab:"crypto",label:Tn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(s,{tab:"cash",label:Tn.tabs.cash,glyph:"$"})]})}var fc=reactNative.StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function yT({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,showBalance:m=false,hideDepositTracker:f=false,enableCashApp:w=false,enableConnectWallet:k,enableStripeLinkPay:x=false,StripeOnrampComponent:v,stripeOnrampEmail:I,stripeOnrampPhone:S,stripeMerchantIdentifier:R,stripePaymentSelectorPosition:u,stripeSkipSuccessConfirmation:d,stripeTheme:C,depositConfirmationMode:b="auto_ui",transferInputVariant:O="double_input",depositMenuDisplay:A="stacked",initialScreen:F="main",onDepositSuccess:_,onDepositError:U,sheetBorderRadius:W}){let Q=W?.globalBorderTopLeftRadius,ze=W?.globalBorderTopRightRadius,{colors:Z,fonts:Ne}=B(),[G,ne]=hs.useState([]),[H,Y]=hs.useState(null),[me,J]=hs.useState("amount"),[Te,qe]=hs.useState(false),[be,He]=hs.useState(null),[Ke,je]=hs.useState(void 0),[Ge,et]=hs.useState(false),[Ve,Ee]=hs.useState(null),_e=k??H?.connect_wallet?.enabled??false,we=F==="tracker"&&!f?"tracker":F==="transfer"?"transfer":F==="card"?"card":F==="cashapp"&&w?"cashapp":F==="wallet"&&_e?"wallet":"main",[xe,nt]=hs.useState(we==="main"),[se,Ye]=hs.useState(we),[Xt,Oe]=hs.useState("crypto"),{isAllowed:Re,isLoading:Pe}=uc(o,e);hs.useEffect(()=>{if(!e||H)return;let y=false;return Il(o).then(async L=>{if(y)return;let D=[];for(let N of L?.transfer_crypto?.networks??[]){let M=N.icon_urls.find(Ie=>Ie.format==="png")?.url||N.icon_urls.find(Ie=>Ie.format==="svg")?.url;M&&D.push(oe(M));}for(let N of L?.payment_networks?.networks??[]){let M=N.icon_urls.find(Ie=>Ie.format==="png")?.url||N.icon_urls.find(Ie=>Ie.format==="svg")?.url;M&&D.push(oe(M));}D.length>0&&await Gl(D),y||Y(L);}).catch(console.error),()=>{y=true;}},[e,H,o]);let tt=()=>{t();},Ae=hs.useRef(false);hs.useEffect(()=>{e&&!Ae.current&&(Ye(we),nt(we==="main"),J("amount"),et(false),Ee(null),Oe("crypto")),Ae.current=e;},[e,we]),hs.useEffect(()=>{e&&(F!=="wallet"||!_e||Ye(y=>y==="main"?"wallet":y));},[e,F,_e]);let fe=hs.useCallback(y=>{y.length!==0&&ne(L=>{let D=new Map(L.map(N=>[N.id,N]));for(let N of y)D.set(N.id,N);return Array.from(D.values())});},[]),Ce=hs.useCallback(()=>{et(false),Ee(null),xe?(Ye("main"),J("amount")):tt();},[xe,tt]),Dt=G.filter(y=>y.status==="pending"||y.status==="waiting").length,ft=!!(i&&a&&l&&c&&o)&&m!==false&&!!H,st=Pe||e&&!H,Ut=Re===false,We=null;if(se==="stripe"&&v){let y=jsxRuntime.jsx(v,{publishableKey:o,email:I,phone:S,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,merchantIdentifier:R,paymentSelectorPosition:u,skipSuccessConfirmation:d,appName:H?.project_name??"",onClose:Ce});We=C?jsxRuntime.jsx(aa,{...C,children:y}):y;}let ce=se==="stripe"||se==="transfer"||se==="card"||se==="cashapp"||se==="wallet"?.9:se==="tracker"?.6:se==="main"?w||_e?.6:.5:void 0,Fe=se==="main"?.9:void 0,Ue={main:W?.main,transfer:W?.transferCrypto,card:W?.buyWithCard,stripe:W?.stripeLinkPay,cashapp:W?.cashApp,wallet:W?.connectWallet,tracker:W?.depositsTracker}[se],j=Ue?.borderTopLeftRadius??Q,Se=Ue?.borderTopRightRadius??ze,P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[be&&jsxRuntime.jsx(su,{visible:Te,useModal:false,status:be.status,tokenIconUrl:be.destination_token_metadata?.icon_urls?.find(y=>y.format==="png")?.url||be.destination_token_metadata?.icon_url||Ke,explorerUrl:be.explorer_url,completionExplorerUrl:be.destination_explorer_url,date:be.created_at?new Date(be.created_at):void 0,amountUsd:be.source_amount_usd?parseFloat(be.source_amount_usd):void 0,onClose:()=>qe(false),heightProcessing:se==="card"||se==="wallet"?.35:void 0,heightCompleted:se==="card"||se==="wallet"?.41:void 0,heightCompletedExpanded:se==="card"||se==="wallet"?.53:void 0,borderTopLeftRadius:W?.depositStatus?.borderTopLeftRadius??Q,borderTopRightRadius:W?.depositStatus?.borderTopRightRadius??ze}),Ve&&jsxRuntime.jsx(mf,{visible:Ge,useModal:false,onClose:()=>et(false),priceImpact:Ve.priceImpact,maxSlippage:Ve.maxSlippage,minDepositUsd:Ve.minDepositUsd,chainName:Ve.chainName,borderTopLeftRadius:W?.infoSheet?.borderTopLeftRadius??Q,borderTopRightRadius:W?.infoSheet?.borderTopRightRadius??ze})]});return jsxRuntime.jsxs(_t,{visible:e,onClose:se==="main"?tt:Ce,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:ce,maxHeightPercent:Fe,borderTopLeftRadius:j,borderTopRightRadius:Se,overlay:P,children:[se==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zr,{title:n,showBack:false,onClose:tt,showBalance:ft,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:H?.project_name}),st&&jsxRuntime.jsx(hT,{}),!st&&Ut&&jsxRuntime.jsxs(reactNative.View,{style:qr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[qr.iconContainer,{backgroundColor:Z.cardHover}],children:jsxRuntime.jsx(Cl,{size:32,color:Z.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[qr.blockedTitle,{color:Z.foreground,fontFamily:Ne.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[qr.blockedDescription,{color:Z.foreground,opacity:.7,fontFamily:Ne.regular}],children:"There are no supported tokens available from your current location."})]}),!st&&!Ut&&(()=>{let y=jsxRuntime.jsx(Yl,{onPress:()=>Ye("transfer"),title:Tn.transferCrypto.title,subtitle:Tn.transferCrypto.subtitle,featuredTokens:H?.transfer_crypto?.networks},"transfer"),L=jsxRuntime.jsx(Zl,{onPress:()=>Ye("card"),title:Tn.depositWithCard.title,subtitle:Tn.depositWithCard.subtitle,paymentNetworks:H?.payment_networks?.networks},"card"),D=_e?jsxRuntime.jsx(oc,{onPress:()=>Ye("wallet"),featuredWallets:H?.connect_wallet?.wallets},"wallet"):null,N=w?jsxRuntime.jsx(rc,{onPress:()=>Ye("cashapp")},"cashapp"):null,M=x&&v?jsxRuntime.jsx(tc,{onPress:()=>Ye("stripe"),title:Tn.stripeLinkPay.title,subtitle:Tn.stripeLinkPay.subtitle},"stripe"):null,Ie=f?null:jsxRuntime.jsx(Xl,{onPress:()=>Ye("tracker"),title:Tn.depositTracker.title,subtitle:Tn.depositTracker.subtitle,badge:Dt>0?Dt:void 0},"tracker");return jsxRuntime.jsxs(reactNative.View,{style:qr.optionsContainer,children:[A==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(gT,{selected:Xt,onSelect:Oe}),Xt==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[y,D]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L,N,M]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[y,D,L,N,M]}),Ie]})})()]}),se==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zr,{title:Tn.transferCrypto.title,showBack:false,onClose:Ce,showBalance:ft,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:H?.project_name}),Pe&&jsxRuntime.jsx(reactNative.View,{style:[qr.centeredContainer,qr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:Z.primary})}),!Pe&&Ut&&jsxRuntime.jsxs(reactNative.View,{style:[qr.centeredContainer,qr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[qr.iconContainer,{backgroundColor:Z.cardHover}],children:jsxRuntime.jsx(Cl,{size:32,color:Z.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[qr.blockedTitle,{color:Z.foreground,fontFamily:Ne.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[qr.blockedDescription,{color:Z.foreground,opacity:.7,fontFamily:Ne.regular}],children:"There are no supported tokens available from your current location."})]}),!Pe&&!Ut&&jsxRuntime.jsx(xt,{style:qr.transferScrollContainer,contentContainerStyle:O==="compact"?qr.scrollContentCompact:qr.scrollContent,showsVerticalScrollIndicator:false,children:O==="compact"?jsxRuntime.jsx(nu,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:b,onExecutionsChange:fe,onDepositSuccess:_,onDepositError:U,onLatestExecution:He,onShowStatusSheet:qe,onSelectedTokenIconUrl:je,onShowInfoSheet:et,onInfoSheetData:Ee,borderTopLeftRadius:Q,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:W?.tokenSelector,chainSelector:W?.chainSelector,infoSheet:W?.infoSheet,depositStatus:W?.depositStatus}}):O==="single_input"?jsxRuntime.jsx(ff,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:b,onExecutionsChange:fe,onDepositSuccess:_,onDepositError:U,onLatestExecution:He,onShowStatusSheet:qe,onSelectedTokenIconUrl:je,borderTopLeftRadius:Q,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:W?.tokenSelector,infoSheet:W?.infoSheet,depositStatus:W?.depositStatus}}):jsxRuntime.jsx(Ud,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:b,onExecutionsChange:fe,onDepositSuccess:_,onDepositError:U,onLatestExecution:He,onShowStatusSheet:qe,onSelectedTokenIconUrl:je,borderTopLeftRadius:Q,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:W?.tokenSelector,chainSelector:W?.chainSelector,infoSheet:W?.infoSheet,depositStatus:W?.depositStatus}})})]}),se==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zr,{title:`Deposit ${s||"USDC"}`,showBack:me==="onramp",onBack:()=>J("amount"),onClose:Ce,showBalance:ft,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:H?.project_name}),jsxRuntime.jsx(reactNative.View,{style:qr.buyWithCardContainer,children:jsxRuntime.jsx(Qd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onDepositSuccess:_,onDepositError:U,onExecutionsChange:fe,onLatestExecution:He,onShowStatusSheet:qe,onSelectedTokenIconUrl:je,view:me,onViewChange:y=>J(y),borderTopLeftRadius:Q,borderTopRightRadius:ze,sheetBorderRadius:{providerModal:W?.providerModal,webView:W?.webView,currencyModal:W?.currencyModal}})})]}),se==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:qr.cashAppContainer,children:jsxRuntime.jsx(Dd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:Ce,onClose:Ce,onDepositSuccess:_})}),se==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:qr.connectWalletContainer,children:jsxRuntime.jsx(Wd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:Ce,onClose:Ce,onDepositSuccess:_,onDepositError:U,onExecutionsChange:fe,onLatestExecution:He,onShowStatusSheet:qe})}),se==="stripe"&&We&&jsxRuntime.jsx(reactNative.View,{style:qr.stripeLinkPayContainer,children:We}),se==="tracker"&&jsxRuntime.jsx(lf,{active:se==="tracker",onClose:Ce,executions:G,externalUserId:r,publishableKey:o})]})}function du({theme:e="auto",...t}){return jsxRuntime.jsx(yT,{...t})}var qr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{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}});var Za=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 js,us,Xa,qg,wT=(qg=class extends Za{constructor(){super();X(this,js);X(this,us);X(this,Xa);z(this,Xa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){h(this,us)||this.setEventListener(h(this,Xa));}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,us))==null||t.call(this),z(this,us,void 0));}setEventListener(t){var r;z(this,Xa,t),(r=h(this,us))==null||r.call(this),z(this,us,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){h(this,js)!==t&&(z(this,js,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof h(this,js)=="boolean"?h(this,js):globalThis.document?.visibilityState!=="hidden"}},js=new WeakMap,us=new WeakMap,Xa=new WeakMap,qg),Qg=new wT;var CT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qn,$s,Kg,ST=(Kg=class{constructor(){X(this,Qn,CT);X(this,$s,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&h(this,$s)&&e!==h(this,Qn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:h(this,Qn),provider:e}),z(this,Qn,e),process.env.NODE_ENV!=="production"&&z(this,$s,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,$s,true),h(this,Qn).setTimeout(e,t)}clearTimeout(e){h(this,Qn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,$s,true),h(this,Qn).setInterval(e,t)}clearInterval(e){h(this,Qn).clearInterval(e);}},Qn=new WeakMap,$s=new WeakMap,Kg),mc=new ST;function Gg(e){setTimeout(e,0);}var hf=typeof window>"u"||"Deno"in globalThis;function el(){}function gf(e){return typeof e=="number"&&e>=0&&e!==1/0}function Xg(e,t){return Math.max(e+(t||0)-Date.now(),0)}function tl(e,t){return typeof e=="function"?e(t):e}function jo(e,t){return typeof e=="function"?e(t):e}var TT=Object.prototype.hasOwnProperty;function uu(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Yg(e)&&Yg(t);if(!o&&!(Jg(e)&&Jg(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):{},c=0;for(let p=0;p<a;p++){let g=o?p:i[p],T=e[g],m=t[g];if(T===m){l[g]=T,(o?p<s:TT.call(e,g))&&c++;continue}if(T===null||m===null||typeof T!="object"||typeof m!="object"){l[g]=m;continue}let f=uu(T,m,r+1);l[g]=f,f===T&&c++;}return s===a&&c===s?e:l}function pu(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 Yg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Jg(e){if(!Zg(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Zg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Zg(e){return Object.prototype.toString.call(e)==="[object Object]"}function yf(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 uu(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 uu(e,t)}return t}function fu(e,t){return typeof e=="function"?e(...t):!!e}var rl=(()=>{let e=()=>hf;return {isServer(){return e()},setIsServer(t){e=t;}}})();function bf(){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 ey=Gg;function kT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=ey,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 hc=kT();var ol,ps,nl,ty,xT=(ty=class extends Za{constructor(){super();X(this,ol,true);X(this,ps);X(this,nl);z(this,nl,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(){h(this,ps)||this.setEventListener(h(this,nl));}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,ps))==null||t.call(this),z(this,ps,void 0));}setEventListener(t){var r;z(this,nl,t),(r=h(this,ps))==null||r.call(this),z(this,ps,t(this.setOnline.bind(this)));}setOnline(t){h(this,ol)!==t&&(z(this,ol,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return h(this,ol)}},ol=new WeakMap,ps=new WeakMap,nl=new WeakMap,ty),ry=new xT;function oy(e){return (e??"online")==="online"?ry.isOnline():true}function ny(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:oy(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var Vo,Rt,yc,So,qs,il,Si,fs,bc,sl,al,Qs,Ks,ms,ll,$t,gc,wf,Cf,Sf,Tf,kf,xf,vf,ly,ay,If=(ay=class extends Za{constructor(t,r){super();X(this,$t);X(this,Vo);X(this,Rt);X(this,yc);X(this,So);X(this,qs);X(this,il);X(this,Si);X(this,fs);X(this,bc);X(this,sl);X(this,al);X(this,Qs);X(this,Ks);X(this,ms);X(this,ll,new Set);this.options=r,z(this,Vo,t),z(this,fs,null),z(this,Si,bf()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(h(this,Rt).addObserver(this),iy(h(this,Rt),this.options)?ut(this,$t,gc).call(this):this.updateResult(),ut(this,$t,Tf).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Rf(h(this,Rt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rf(h(this,Rt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ut(this,$t,kf).call(this),ut(this,$t,xf).call(this),h(this,Rt).removeObserver(this);}setOptions(t){let r=this.options,o=h(this,Rt);if(this.options=h(this,Vo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof jo(this.options.enabled,h(this,Rt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ut(this,$t,vf).call(this),h(this,Rt).setOptions(this.options),r._defaulted&&!pu(this.options,r)&&h(this,Vo).getQueryCache().notify({type:"observerOptionsUpdated",query:h(this,Rt),observer:this});let n=this.hasListeners();n&&sy(h(this,Rt),o,this.options,r)&&ut(this,$t,gc).call(this),this.updateResult(),n&&(h(this,Rt)!==o||jo(this.options.enabled,h(this,Rt))!==jo(r.enabled,h(this,Rt))||tl(this.options.staleTime,h(this,Rt))!==tl(r.staleTime,h(this,Rt)))&&ut(this,$t,wf).call(this);let s=ut(this,$t,Cf).call(this);n&&(h(this,Rt)!==o||jo(this.options.enabled,h(this,Rt))!==jo(r.enabled,h(this,Rt))||s!==h(this,ms))&&ut(this,$t,Sf).call(this,s);}getOptimisticResult(t){let r=h(this,Vo).getQueryCache().build(h(this,Vo),t),o=this.createResult(r,t);return RT(this,o)&&(z(this,So,o),z(this,il,this.options),z(this,qs,h(this,Rt).state)),o}getCurrentResult(){return h(this,So)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&h(this,Si).status==="pending"&&h(this,Si).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){h(this,ll).add(t);}getCurrentQuery(){return h(this,Rt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=h(this,Vo).defaultQueryOptions(t),o=h(this,Vo).getQueryCache().build(h(this,Vo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return ut(this,$t,gc).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),h(this,So)))}createResult(t,r){let o=h(this,Rt),n=this.options,s=h(this,So),i=h(this,qs),a=h(this,il),c=t!==o?t.state:h(this,yc),{state:p}=t,g={...p},T=false,m;if(r._optimisticResults){let b=this.hasListeners(),O=!b&&iy(t,r),A=b&&sy(t,o,r,n);(O||A)&&(g={...g,...ny(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:f,errorUpdatedAt:w,status:k}=g;m=g.data;let x=false;if(r.placeholderData!==void 0&&m===void 0&&k==="pending"){let b;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(b=s.data,x=true):b=typeof r.placeholderData=="function"?r.placeholderData(h(this,al)?.state.data,h(this,al)):r.placeholderData,b!==void 0&&(k="success",m=yf(s?.data,b,r),T=true);}if(r.select&&m!==void 0&&!x)if(s&&m===i?.data&&r.select===h(this,bc))m=h(this,sl);else try{z(this,bc,r.select),m=r.select(m),m=yf(s?.data,m,r),z(this,sl,m),z(this,fs,null);}catch(b){z(this,fs,b);}h(this,fs)&&(f=h(this,fs),m=h(this,sl),w=Date.now(),k="error");let v=g.fetchStatus==="fetching",I=k==="pending",S=k==="error",R=I&&v,u=m!==void 0,C={status:k,fetchStatus:g.fetchStatus,isPending:I,isSuccess:k==="success",isError:S,isInitialLoading:R,isLoading:R,data:m,dataUpdatedAt:g.dataUpdatedAt,error:f,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>c.dataUpdateCount||g.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!I,isLoadingError:S&&!u,isPaused:g.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:S&&u,isStale:_f(t,r),refetch:this.refetch,promise:h(this,Si),isEnabled:jo(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let b=C.data!==void 0,O=C.status==="error"&&!b,A=U=>{O?U.reject(C.error):b&&U.resolve(C.data);},F=()=>{let U=z(this,Si,C.promise=bf());A(U);},_=h(this,Si);switch(_.status){case "pending":t.queryHash===o.queryHash&&A(_);break;case "fulfilled":(O||C.data!==_.value)&&F();break;case "rejected":(!O||C.error!==_.reason)&&F();break}}return C}updateResult(){let t=h(this,So),r=this.createResult(h(this,Rt),this.options);if(z(this,qs,h(this,Rt).state),z(this,il,this.options),h(this,qs).data!==void 0&&z(this,al,h(this,Rt)),pu(r,t))return;z(this,So,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!h(this,ll).size)return true;let i=new Set(s??h(this,ll));return this.options.throwOnError&&i.add("error"),Object.keys(h(this,So)).some(a=>{let l=a;return h(this,So)[l]!==t[l]&&i.has(l)})};ut(this,$t,ly).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ut(this,$t,Tf).call(this);}},Vo=new WeakMap,Rt=new WeakMap,yc=new WeakMap,So=new WeakMap,qs=new WeakMap,il=new WeakMap,Si=new WeakMap,fs=new WeakMap,bc=new WeakMap,sl=new WeakMap,al=new WeakMap,Qs=new WeakMap,Ks=new WeakMap,ms=new WeakMap,ll=new WeakMap,$t=new WeakSet,gc=function(t){ut(this,$t,vf).call(this);let r=h(this,Rt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(el)),r},wf=function(){ut(this,$t,kf).call(this);let t=tl(this.options.staleTime,h(this,Rt));if(rl.isServer()||h(this,So).isStale||!gf(t))return;let o=Xg(h(this,So).dataUpdatedAt,t)+1;z(this,Qs,mc.setTimeout(()=>{h(this,So).isStale||this.updateResult();},o));},Cf=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(h(this,Rt)):this.options.refetchInterval)??false},Sf=function(t){ut(this,$t,xf).call(this),z(this,ms,t),!(rl.isServer()||jo(this.options.enabled,h(this,Rt))===false||!gf(h(this,ms))||h(this,ms)===0)&&z(this,Ks,mc.setInterval(()=>{(this.options.refetchIntervalInBackground||Qg.isFocused())&&ut(this,$t,gc).call(this);},h(this,ms)));},Tf=function(){ut(this,$t,wf).call(this),ut(this,$t,Sf).call(this,ut(this,$t,Cf).call(this));},kf=function(){h(this,Qs)!==void 0&&(mc.clearTimeout(h(this,Qs)),z(this,Qs,void 0));},xf=function(){h(this,Ks)!==void 0&&(mc.clearInterval(h(this,Ks)),z(this,Ks,void 0));},vf=function(){let t=h(this,Vo).getQueryCache().build(h(this,Vo),this.options);if(t===h(this,Rt))return;let r=h(this,Rt);z(this,Rt,t),z(this,yc,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},ly=function(t){hc.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(h(this,So));}),h(this,Vo).getQueryCache().notify({query:h(this,Rt),type:"observerResultsUpdated"});});},ay);function vT(e,t){return jo(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&jo(t.retryOnMount,e)===false)}function iy(e,t){return vT(e,t)||e.state.data!==void 0&&Rf(e,t,t.refetchOnMount)}function Rf(e,t,r){if(jo(t.enabled,e)!==false&&tl(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&_f(e,t)}return false}function sy(e,t,r,o){return (e!==t||jo(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&_f(e,r)}function _f(e,t){return jo(t.enabled,e)!==false&&e.isStaleByTime(tl(t.staleTime,e))}function RT(e,t){return !pu(e.getCurrentResult(),t)}var IT=hs__namespace.createContext(void 0),cy=e=>{let t=hs__namespace.useContext(IT);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var dy=hs__namespace.createContext(false),uy=()=>hs__namespace.useContext(dy);dy.Provider;function _T(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var PT=hs__namespace.createContext(_T()),py=()=>hs__namespace.useContext(PT);var my=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?fu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},hy=e=>{hs__namespace.useEffect(()=>{e.clearReset();},[e]);},gy=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||fu(r,[e.error,o]));var yy=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));}},by=(e,t)=>e.isLoading&&e.isFetching&&!t,wy=(e,t)=>e?.suspense&&t.isPending,Pf=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Cy(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=uy(),n=py(),s=cy(),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`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,yy(i),my(i,n,a),hy(n);let c=!s.getQueryCache().get(i.queryHash),[p]=hs__namespace.useState(()=>new t(s,i)),g=p.getOptimisticResult(i),T=!o&&l;if(hs__namespace.useSyncExternalStore(hs__namespace.useCallback(m=>{let f=T?p.subscribe(hc.batchCalls(m)):el;return p.updateResult(),f},[p,T]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),hs__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),wy(i,g))throw Pf(i,p,n);if(gy({result:g,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw g.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,g),i.experimental_prefetchInRender&&!rl.isServer()&&by(g,o)&&(c?Pf(i,p,n):a?.promise)?.catch(el).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?g:p.trackResult(g)}function Ti(e,t){return Cy(e,If)}function hu(e,t=true){return Ti({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Hc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Ff(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return Ti({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await ei(s),c=null,p=null,g=null,T=null,m,f,w,k=l.data.some(x=>x.chains.some(v=>{let I=v.chain_type===t&&v.chain_id===r&&v.token_address.toLowerCase()===o.toLowerCase();return I&&(c=v.minimum_deposit_amount_usd,p=v.estimated_processing_time,g=v.max_slippage_percent,T=v.estimated_price_impact_percent,w=v.chain_name,f=x),I}));if(f){let x=Le(f,"png");x&&(m=oe(x));}return {isSupported:k,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:T,errorMessage:k?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:m,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Df(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return Ti({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await jc(t,r,o,n,s);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,T=BigInt(g),m=BigInt(10**c),f=T/m,k=(T%m).toString().padStart(c,"0").replace(/0+$/,""),x=k?`${f}.${k}`:f.toString();return {balanceBaseUnit:g,balanceHuman:x,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}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 FT=2500,DT=3e3,VT=6e4;function Vf({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=hs.useState([]),[l,c]=hs.useState(false),p=hs.useRef(new Date),g=hs.useRef(new Map),T=hs.useRef(false),m=hs.useRef(n),f=hs.useRef(s);return hs.useEffect(()=>{m.current=n;},[n]),hs.useEffect(()=>{f.current=s;},[s]),hs.useEffect(()=>{o&&!T.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),T.current=o;},[o]),hs.useEffect(()=>{if(!e||!o)return;let w=p.current,k=async()=>{try{let v=await un(e,t,"withdraw"),I=new Date(w.getTime()-VT),S=[...v.data].sort((C,b)=>{let O=C.created_at?new Date(C.created_at).getTime():0;return (b.created_at?new Date(b.created_at).getTime():0)-O}),R=["pending","waiting","delayed"],u=["succeeded","failed"],d=null;for(let C of S){let b=C.created_at?new Date(C.created_at):null;if(!b||b<I)continue;let O=g.current.get(C.id);if(!O){d=C;break}if(R.includes(O)&&u.includes(C.status)){d=C;break}}if(d){let C=d,b=C.created_at?new Date(C.created_at):null;if(!b||b<p.current)return;let O=g.current.get(C.id);g.current.set(C.id,C.status),a(A=>{let F=A.findIndex(_=>_.id===C.id);if(F>=0){let _=[...A];return _[F]=C,_}return [...A,C]}),C.status==="succeeded"&&(!O||R.includes(O))?m.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&O!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(v){console.error("Failed to fetch withdraw executions:",v),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:v});}};k();let x=setInterval(k,FT);return c(true),()=>{clearInterval(x),c(false);}},[e,t,o]),hs.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await $u({deposit_wallet_id:r},t);}catch{}};w();let k=setInterval(w,DT);return ()=>clearInterval(k)},[o,r,t]),{executions:i,isPolling:l}}var Of=(e,t)=>`${t}:${e}`;function kc({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:T,fonts:m,components:f}=B(),[w,k]=hs.useState(false),[x,v]=hs.useState(false),I=f.card,S=t?e.find(C=>C.symbol===t):void 0,R=S?.chains||[],u=r?R.find(C=>Of(C.chain_id,C.chain_type)===r):void 0,d={backgroundColor:I.backgroundColor,borderRadius:I.borderRadius,borderWidth:I.borderWidth||1,borderColor:I.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Ft.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Ft.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ft.label,{color:I.labelColor,fontFamily:m.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ft.selectButton,d],onPress:()=>!s&&e.length>0&&k(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[Ft.placeholder,{color:I.subtitleColor,fontFamily:m.regular}],children:"Loading..."}):S?jsxRuntime.jsxs(reactNative.View,{style:Ft.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(S,"png"))},style:Ft.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.selectedText,{color:I.titleColor,fontFamily:m.medium}],numberOfLines:1,children:S.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Ft.placeholder,{color:I.subtitleColor,fontFamily:m.regular}],children:"Select receive token"}),jsxRuntime.jsx(er,{size:16,color:I.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ft.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ft.label,{color:I.labelColor,fontFamily:m.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ft.selectButton,d,(!S||R.length===0)&&Ft.disabled],onPress:()=>!s&&S&&R.length>0&&v(true),activeOpacity:.7,disabled:s||!S||R.length===0,children:[u?jsxRuntime.jsxs(reactNative.View,{style:Ft.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(u,"png"))},style:Ft.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.selectedText,{color:I.titleColor,fontFamily:m.medium}],numberOfLines:1,children:u.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Ft.placeholder,{color:I.subtitleColor,fontFamily:m.regular}],children:"Chain"}),jsxRuntime.jsx(er,{size:16,color:I.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(_t,{visible:w,onClose:()=>k(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:Ft.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Ft.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.pickerTitle,{color:T.foreground,fontFamily:m.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ft.pickerHeaderClose,onPress:()=>k(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(la,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Ft.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ft.pickerItem,{backgroundColor:C.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(C.symbol),k(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(C,"png"))},style:Ft.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.pickerItemText,{color:T.foreground,fontFamily:m.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.pickerItemSub,{color:T.foregroundMuted,fontFamily:m.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(pt,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(_t,{visible:x,onClose:()=>v(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:Ft.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Ft.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.pickerTitle,{color:T.foreground,fontFamily:m.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ft.pickerHeaderClose,onPress:()=>v(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(la,{data:R,keyExtractor:C=>Of(C.chain_id,C.chain_type),contentContainerStyle:Ft.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let b=Of(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ft.pickerItem,{backgroundColor:b===r?T.cardHover:"transparent"}],onPress:()=>{n(b),v(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Le(C,"png"))},style:Ft.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.pickerItemText,{color:T.foreground,fontFamily:m.medium}],children:C.chain_name}),b===r&&jsxRuntime.jsx(pt,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Ft=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 Lf(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 Ti({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>ju({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 AT(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function WT(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 ET(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function yu({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:T,estimatedProcessingTime:m,maxSlippagePercent:f,priceImpactPercent:w,canWithdraw:k,onDepositWalletCreation:x,onWithdraw:v,onWithdrawError:I,onWithdrawSubmitted:S,onViewTracker:R}){let u="https://unifold.io/terms",d="https://unifold.io/support",{colors:C,fonts:b,components:O}=B(),[A,F]=hs.useState(a||""),[_,U]=hs.useState(""),[W,Q]=hs.useState(false),[ze,Z]=hs.useState(null),[Ne,G]=hs.useState(false),[ne,H]=hs.useState(""),Y=hs.useRef(null);hs.useEffect(()=>{F(a||""),U(""),Z(null);},[a]);let me=A.trim();hs.useEffect(()=>{let fe=setTimeout(()=>H(me),500);return ()=>clearTimeout(fe)},[me]);let{data:J,isLoading:Te,error:qe}=Lf({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:ne,publishableKey:e,enabled:ne.length>5&&!!c}),be=me!==ne,He=hs.useMemo(()=>!me||me.length<=5||be||Te?null:qe?"Invalid address":J&&!J.valid?J.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:J.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[me,be,Te,qe,J,c,l]),Ke=!be&&!!J?.valid&&!He,je=hs.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),Ge=hs.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),et=n||p?.symbol||"TOKEN",Ve=p?.decimals??6,Ee=hs.useMemo(()=>{let fe=parseFloat(_);return !fe||fe<=0?0:fe},[_]),_e=hs.useMemo(()=>{let fe=parseFloat(_);return !fe||fe<=0?0:fe*je},[_,je]),we=hs.useCallback(async()=>{try{let Ce=await zy("expo-clipboard").getStringAsync();Ce&&(F(Ce.trim()),Z(null));}catch{}},[]),xe=hs.useCallback(()=>{Ge<=0||U(p?.balanceHuman??"0");},[Ge,p]),nt=T!==null&&_e>0&&_e<T,se=Ee>0&&Ge>0&&Ee>Ge,Ye=me.length>0&&_.trim().length>0&&Ee>0&&Ke&&!nt&&!se&&!!p,Xt=hs.useCallback(async()=>{if(!(!l||!c||!Ye||!k)){Q(true),Z(null);try{let fe=await x({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:me}),Ce=WT(Ee,Ve),Dt=ET(Ee,Ve),Wt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:et,sourceTokenIconUrl:i,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?oe(Le(l,"png")):void 0,amount:Dt,amountBaseUnit:Ce,submittedAt:new Date,withdrawIntentAddress:fe.address,recipientAddress:me};await v(Wt),S(Wt);}catch(fe){let Ce=fe instanceof Error?fe.message:"Withdrawal failed. Please try again.",Dt=Ce.length>120?"Withdrawal failed. Please try again.":Ce;Z(Dt),I?.({message:Ce,error:fe,code:"WITHDRAW_FAILED"});}finally{Q(false);}}},[l,c,Ye,k,me,t,r,o,et,i,_,Ge,p,Ee,Ve,_e,x,v,I,S]),Oe=O.input,Re=O.card,Pe=O.button,tt=He?C.error:Oe.borderColor,Ae=hs.useMemo(()=>W?"Processing...":se?"Insufficient balance":nt?`Minimum $${T?.toFixed(2)}`:ze?"Withdrawal failed \u2014 try again":"Withdraw",[W,se,nt,T,ze]);return jsxRuntime.jsxs(reactNative.View,{style:It.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:It.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[It.label,{color:Re.labelColor,fontFamily:b.medium}],children:"Recipient address"}),(be||Te)&&me.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:we,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(qf,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[It.inputRow,{backgroundColor:Oe.backgroundColor,borderRadius:Oe.borderRadius,borderWidth:Oe.borderWidth,borderColor:tt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[It.textInput,{color:Oe.textColor,fontFamily:b.regular}],placeholder:"Enter wallet address",placeholderTextColor:Oe.placeholderColor,value:A,onChangeText:fe=>{F(fe),Z(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Y.current?.focus()})}),He?jsxRuntime.jsx(reactNative.Text,{style:[It.errorText,{color:C.error,fontFamily:b.regular}],children:He}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[It.label,{color:Re.labelColor,fontFamily:b.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:b.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[It.amountRow,{backgroundColor:Oe.backgroundColor,borderRadius:Oe.borderRadius,borderWidth:Oe.borderWidth,borderColor:Oe.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[It.amountInput,{color:Oe.textColor,fontFamily:b.regular}],placeholder:"0.00",placeholderTextColor:Oe.placeholderColor,value:_,onChangeText:fe=>{(fe===""||/^\d*\.?\d*$/.test(fe))&&(U(fe),Z(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[It.unitLabel,{color:C.foregroundMuted,fontFamily:b.medium}],children:et}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[It.maxButton,{backgroundColor:`${C.primary}20`}],onPress:xe,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[It.maxText,{color:C.primary,fontFamily:b.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[It.detailsCard,{marginTop:24,backgroundColor:Re.backgroundColor,borderRadius:Re.borderRadius,borderWidth:Re.borderWidth||1,borderColor:Re.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:It.detailsToggle,onPress:()=>G(!Ne),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:It.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[It.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(po,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[It.detailsLabel,{color:Re.titleColor,fontFamily:b.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:b.medium},children:AT(m)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:Ne?"180deg":"0deg"}]},children:jsxRuntime.jsx(er,{size:16,color:Re.actionColor,strokeWidth:2})})]})}),Ne&&jsxRuntime.jsxs(reactNative.View,{style:It.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:It.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[It.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[It.detailsLabel,{color:Re.titleColor,fontFamily:b.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:b.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:It.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[It.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(cn,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[It.detailsLabel,{color:Re.titleColor,fontFamily:b.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:b.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),ze&&jsxRuntime.jsx(reactNative.Text,{style:[It.errorText,{color:C.error,fontFamily:b.regular,textAlign:"center"}],children:ze}),jsxRuntime.jsxs(reactNative.View,{style:It.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[It.withdrawButton,{backgroundColor:Pe.primaryBackground,borderRadius:Pe.borderRadius,borderWidth:Pe.borderWidth,borderColor:Pe.borderColor,opacity:!Ye||!k||W?.5:1}],onPress:Xt,disabled:!Ye||!k||W,activeOpacity:.8,children:[W&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Pe.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[It.withdrawButtonText,{color:Pe.primaryText,fontFamily:b.medium}],children:Ae})]}),jsxRuntime.jsxs(reactNative.View,{style:It.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:It.historyLink,onPress:R,activeOpacity:.7,children:[jsxRuntime.jsx(po,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[It.historyText,{color:C.foregroundMuted,fontFamily:b.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:It.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[It.legalText,{color:C.foregroundMuted,fontFamily:b.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[It.legalSeparator,{color:C.foregroundMuted,fontFamily:b.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(d),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[It.legalText,{color:C.foregroundMuted,fontFamily:b.regular}],children:"Help"})})]})]})]})]})}var It=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 UT(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 NT(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Cu({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=B(),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,c=oe(Le(e.destination_token_metadata,"png")||qt("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=UT(e.created_at||new Date().toISOString()),T=NT(e.source_amount_usd);return jsxRuntime.jsxs(vr,{cardTokens:s,onPress:t,contentStyle:xi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:xi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:xi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[xi.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Fi,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(sa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:xi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xi.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[xi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:xi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(_r,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var xi=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 Wf(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 c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${c} ${l}`}catch{return e}}function Dy(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 jT(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 Vy(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Oy(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function xc({label:e,value:t,isLast:r}){let{fonts:o,components:n}=B(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:yt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[yt.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[yt.divider,{backgroundColor:s.borderColor}]})]})}function Mf({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=B(),[c,p]=hs.useState([]),[g,T]=hs.useState(!!n),m=l.card,f=l.button,w=l.header,k=l.container;hs.useEffect(()=>{Hu().then(Q=>p(Q.data)).catch(()=>{});},[]),hs.useEffect(()=>{T(!!n);},[e?.id]);let x=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,v=e?e.status==="failed"||e.status==="refunded":false,I=v?i.error:x?i.warning:i.success,S=v?"Failed":x?"Processing":"Completed",R=e?.destination_token_metadata?oe(Le(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?oe(t.destinationTokenIconUrl):oe(qt("/icons/tokens/png/usdc.png")),u=e?.created_at?Wf(e.created_at):t.submittedAt?Wf(t.submittedAt.toISOString()):Wf(new Date().toISOString()),d=e?`${Dy(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Vy(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${Dy(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Vy(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,b=e?jT(e.source_amount_usd,e.source_amount_base_unit):"$0.00",O=e?Nc(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,A=e?Nc(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,_=e?.explorer_url,U=e?.destination_transaction_hashes?.[0],W=e?.destination_explorer_url;return jsxRuntime.jsxs(xt,{style:yt.scroll,contentContainerStyle:yt.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:yt.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(na,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:yt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[yt.headerTitle,{color:w.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:yt.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:yt.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:R},style:yt.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[yt.statusBadge,{backgroundColor:I}],children:v?jsxRuntime.jsx(Fi,{size:10,color:"#FFFFFF",strokeWidth:3}):x?jsxRuntime.jsx(reactNative.View,{style:yt.spinnerDot}):jsxRuntime.jsx(pt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:yt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[yt.statusDot,{backgroundColor:I}]}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusText,{color:I,fontFamily:a.medium}],children:S})]}),jsxRuntime.jsx(reactNative.Text,{style:[yt.dateText,{color:k.subtitleColor,fontFamily:a.regular}],children:u}),jsxRuntime.jsxs(reactNative.View,{style:[yt.detailsCard,{backgroundColor:m.backgroundColor,borderRadius:m.borderRadius,borderWidth:m.borderWidth??1,borderColor:m.borderColor}],children:[jsxRuntime.jsx(xc,{label:"Amount Sent",value:d}),jsxRuntime.jsx(xc,{label:"Amount Received",value:C}),jsxRuntime.jsx(xc,{label:"USD Value",value:b}),jsxRuntime.jsx(xc,{label:"Source Network",value:O}),jsxRuntime.jsx(xc,{label:"Destination Network",value:A,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yt.moreDetailsRow,onPress:()=>T(Q=>!Q),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.moreDetailsText,{color:k.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(xn,{size:16,color:k.actionColor,strokeWidth:2}):jsxRuntime.jsx(er,{size:16,color:k.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[yt.detailsCard,{backgroundColor:m.backgroundColor,borderRadius:m.borderRadius,borderWidth:m.borderWidth??1,borderColor:m.borderColor}],children:F&&_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yt.txRow,onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.txLabel,{color:m.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.txHash,{color:m.titleColor,fontFamily:a.regular}],children:Oy(F)}),jsxRuntime.jsx(Ko,{size:14,color:m.actionColor,strokeWidth:2})]}),!x&&U&&W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[yt.divider,{backgroundColor:m.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yt.txRow,onPress:()=>reactNative.Linking.openURL(W),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.txLabel,{color:m.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.txHash,{color:m.titleColor,fontFamily:a.regular}],children:Oy(U)}),jsxRuntime.jsx(Ko,{size:14,color:m.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:yt.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[yt.detailLabel,{color:m.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:yt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[yt.button,yt.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[yt.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[yt.button,yt.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[yt.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var yt=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 Ly(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Su({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=B(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:nr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:nr.closeButton,onPress:r,children:jsxRuntime.jsx(wt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[nr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(pt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[nr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[nr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Ly(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:nr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[nr.button,nr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[nr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[nr.button,nr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[nr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:nr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:nr.closeButton,onPress:r,children:jsxRuntime.jsx(wt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[nr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(wt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[nr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[nr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[nr.button,nr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[nr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:nr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:nr.closeButton,onPress:r,children:jsxRuntime.jsx(wt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(bt,{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:nr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[nr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[nr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[nr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",Ly(e.recipientAddress)]})]})}var nr=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 YT(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(Le(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(Le(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 By=(e,t)=>`${t}:${e}`;function JT(){let{colors:e}=B(),t=hs.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return hs.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 xu({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:T,heightPercent:m=.94,sheetBorderRadius:f,sourceChainType:w,sourceChainId:k,sourceTokenAddress:x,sourceTokenSymbol:v,sourceChainName:I,sourceTokenIconUrl:S}){let{colors:R,fonts:u}=B(),[d,C]=hs.useState("form"),[b,O]=hs.useState(w),[A,F]=hs.useState(k),[_,U]=hs.useState(x),[W,Q]=hs.useState(v),[ze,Z]=hs.useState(I),[Ne,G]=hs.useState(S),[ne,H]=hs.useState(null),[Y,me]=hs.useState(null),[J,Te]=hs.useState(null),[qe,be]=hs.useState(),[He,Ke]=hs.useState([]),[je,Ge]=hs.useState(null),[et,Ve]=hs.useState("form"),Ee=hs.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,_e=hs.useRef(null),we=!!b&&!!A&&!!_,{data:xe,isLoading:nt}=hu(r,e&&d==="form"),se=xe?.data??[],{data:Ye,isLoading:Xt}=Ff({sourceChainType:b,sourceChainId:A,sourceTokenAddress:_,sourceTokenSymbol:W,publishableKey:r,enabled:e&&we&&d==="form"}),{data:Oe,isLoading:Re}=Df({address:n,chainType:b,chainId:A,tokenAddress:_,publishableKey:r,enabled:e&&we}),{executions:Pe}=Vf({userId:o,publishableKey:r,depositWalletId:qe,enabled:!!qe&&e,onWithdrawSuccess:g,onWithdrawError:T});hs.useEffect(()=>{if(!e||d!=="tracker")return;let D=false;return un(o,r,"withdraw").then(N=>{D||Ke(N.data);}).catch(console.error),()=>{D=true;}},[e,d,o,r]),hs.useEffect(()=>{e&&(_e.current&&(clearTimeout(_e.current),_e.current=null),C("form"),O(w),F(k),U(x),Q(v),Z(I),G(S),H(null),me(null),Te(null),be(void 0),Ke([]),Ge(null),Ve("form"),Ee.setValue(reactNative.Dimensions.get("window").width));},[e]),hs.useEffect(()=>()=>{_e.current&&clearTimeout(_e.current);},[]),hs.useEffect(()=>{Ne||Ye?.iconUrl&&G(Ye.iconUrl);},[Ye?.iconUrl,Ne]),hs.useEffect(()=>{ze||Ye?.chainName&&Z(Ye.chainName);},[Ye?.chainName,ze]),hs.useEffect(()=>{if(!se.length||ne)return;let D,N;if(i&&a)if(l)for(let M of se){let Ie=M.chains.find(Je=>Je.chain_type===i&&Je.chain_id===a&&Je.token_address.toLowerCase()===l.toLowerCase());if(Ie){D=M,N=Ie;break}}else for(let M of se){let Ie=M.chains.find(Je=>Je.chain_type===i&&Je.chain_id===a);if(Ie){D=M,N=Ie;break}}D||(D=se[0]),D&&(H(D),me(N??D.chains[0]??null));},[se,ne,i,a,l]),hs.useEffect(()=>{d==="confirming"&&Pe.length>0&&C("details");},[d,Pe]);let tt=hs.useCallback(()=>{t(),_e.current=setTimeout(()=>{C("form"),O(w),F(k),U(x),Q(v),Z(I),G(S),H(null),me(null),Te(null),be(void 0),Ke([]),Ge(null),Ve("form"),_e.current=null;},300);},[t,w,k,x,v,I,S]),Ae=hs.useCallback(D=>{let N=se.find(M=>M.symbol===D);N&&(H(N),N.chains.length>0&&me(N.chains[0]));},[se]),fe=hs.useCallback(D=>{if(!ne)return;let N=ne.chains.find(M=>By(M.chain_id,M.chain_type)===D);N&&me(N);},[ne]),Ce=hs.useCallback(async D=>{let N=await Ao({external_user_id:o,destination_chain_type:D.destinationChainType,destination_chain_id:D.destinationChainId,destination_token_address:D.destinationTokenAddress,recipient_address:D.recipientAddress,action_type:"withdraw"},r),M=ko(N.data,b??"");if(!M)throw new Error(`No deposit wallet found for chain type: ${b}`);return be(M.id),{id:M.id,address:M.address}},[o,r,b]),Dt=hs.useCallback(D=>{Te(D),C("confirming");},[]),Wt=hs.useCallback(D=>{Ge(D),Ee.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ee,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ee]),ft=hs.useCallback(()=>{reactNative.Animated.timing(Ee,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ge(null));},[Ee]),st=nt||Xt,Ut=Ye?.isSupported??null,We=d==="confirming"?"Withdrawal Status":c,ce=f?.globalBorderTopLeftRadius,Fe=f?.globalBorderTopRightRadius,ae=f?.main?.borderTopLeftRadius??ce,Ue=f?.main?.borderTopRightRadius??Fe,j=f?.tokenSelector?.borderTopLeftRadius??ce,Se=f?.tokenSelector?.borderTopRightRadius??Fe,P=f?.chainSelector?.borderTopLeftRadius??ce,y=f?.chainSelector?.borderTopRightRadius??Fe,L=(()=>{if(d!=="form"||!we||Re||!Oe)return;let D=W||Oe.symbol,N=Oe.balanceUsd;if(N!=null){let Je=`$${parseFloat(N).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return D?`Balance: ${Je} ${D}`:`Balance: ${Je}`}let M=Oe.balanceHuman;if(!(!M||M==="0"))return D?`Balance: ${M} ${D}`:`Balance: ${M}`})();return jsxRuntime.jsx(_t,{visible:e,onClose:tt,closeOnBackdropPress:false,enablePanDownToClose:d==="tracker"||d==="form",showHandle:d==="tracker"||d==="form",heightPercent:d==="confirming"?.3:d==="details"?.7:d==="tracker"?.9:m,borderTopLeftRadius:ae,borderTopRightRadius:Ue,children:d==="confirming"&&J?jsxRuntime.jsx(Su,{txInfo:J,executions:Pe,onClose:tt,onViewTracker:()=>{Ve("confirming"),C("tracker");}}):d==="details"&&J?jsxRuntime.jsx(Mf,{execution:Pe.length>0?Pe[Pe.length-1]:null,txInfo:J,onClose:tt,onViewHistory:()=>{Ve("details"),C("tracker");},onHeaderClose:()=>C("form")}):d==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Kn.trackerContainer,children:[jsxRuntime.jsx(zr,{title:"Withdrawal History",onClose:()=>C(et)}),He.length===0?jsxRuntime.jsx(reactNative.View,{style:Kn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Kn.emptyText,{color:R.foregroundMuted,fontFamily:u.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(la,{data:He,keyExtractor:D=>D.id,contentContainerStyle:Kn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:D})=>jsxRuntime.jsx(Cu,{execution:D,onPress:()=>Wt(D)})}),je&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Kn.historyDetailOverlay,{backgroundColor:R.background,transform:[{translateX:Ee}]}],children:jsxRuntime.jsx(Mf,{execution:je,txInfo:YT(je),onClose:tt,onBack:ft,onViewHistory:ft})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zr,{title:We,subtitle:L,onClose:tt}),st?jsxRuntime.jsx(JT,{}):Ut===false?jsxRuntime.jsxs(reactNative.View,{style:Kn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Kn.unsupportedTitle,{color:R.foreground,fontFamily:u.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Kn.unsupportedMessage,{color:R.foregroundMuted,fontFamily:u.regular}],children:Ye?.errorMessage})]}):jsxRuntime.jsx(ZT,{publishableKey:r,sourceChainType:b??"",sourceChainId:A??"",sourceTokenAddress:_??"",sourceTokenSymbol:W,sourceChainName:ze,sourceTokenIconUrl:Ne,recipientAddressProp:s,destinationTokens:se,selectedToken:ne,selectedChain:Y,selectedChainKey:Y?By(Y.chain_id,Y.chain_type):null,onTokenChange:Ae,onChainChange:fe,tokensLoading:nt,balanceData:Oe??null,isLoadingBalance:Re,sourceValidation:Ye??null,onDepositWalletCreation:Ce,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:Dt,onViewTracker:()=>{Ve("form"),C("tracker");},tokenSelectorLeft:j,tokenSelectorRight:Se,chainSelectorLeft:P,chainSelectorRight:y})]})})}function ZT({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:g,onTokenChange:T,onChainChange:m,tokensLoading:f,balanceData:w,isLoadingBalance:k,sourceValidation:x,onDepositWalletCreation:v,onWithdraw:I,onWithdrawError:S,onWithdrawSubmitted:R,onViewTracker:u,tokenSelectorLeft:d,tokenSelectorRight:C,chainSelectorLeft:b,chainSelectorRight:O}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(xt,{style:{flex:1,paddingTop:16},contentContainerStyle:Kn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Kn.doubleInputWrapper,children:jsxRuntime.jsx(kc,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:g,onTokenChange:T,onChainChange:m,isLoading:f,tokenPickerBorderTopLeftRadius:d,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:b,chainPickerBorderTopRightRadius:O})}),jsxRuntime.jsx(yu,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:w,isLoadingBalance:k,minimumWithdrawAmountUsd:x?.minimumAmountUsd??null,estimatedProcessingTime:x?.estimatedProcessingTime??null,maxSlippagePercent:x?.maxSlippagePercent??null,priceImpactPercent:x?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:v,onWithdraw:I,onWithdrawError:S,onWithdrawSubmitted:R,onViewTracker:u})]})})}var Kn=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 Ey=hs.createContext(null);function lk({children:e,publishableKey:t,config:r}){let[o]=hs.useState(()=>new Vp({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=hs.useState(false),[i,a]=hs.useState(null),[l,c]=hs.useState(false),[p,g]=hs.useState(null),T=reactNative.useColorScheme(),m=hs.useRef(false);m.current||(Ec({publishableKey:t}),m.current=true);let f=hs.useMemo(()=>{let _=r?.appearance||"dark";return _==="auto"?T==="dark"?"dark":"light":_},[r?.appearance,T]);hs.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.'),Ec({publishableKey:t});},[t]),hs.useEffect(()=>()=>{k.current&&clearTimeout(k.current),u.current&&clearTimeout(u.current);},[]);let w=hs.useRef(null),k=hs.useRef(null),x=hs.useCallback(_=>{k.current&&(clearTimeout(k.current),k.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let U=new Promise((W,Q)=>{w.current={resolve:W,reject:Q};});return a(_),s(true),U},[]),v=hs.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),s(false),k.current=setTimeout(()=>{a(null),k.current=null;},200);},[]),I=hs.useCallback(_=>{i?.onSuccess&&i.onSuccess(_),w.current&&(w.current.resolve(_),w.current=null);},[i]),S=hs.useCallback(_=>{console.error("[UnifoldProvider] Deposit error:",_),i?.onError&&i.onError(_),w.current&&(w.current.reject(_),w.current=null);},[i]),R=hs.useRef(null),u=hs.useRef(null),d=hs.useRef(void 0),C=hs.useCallback(_=>{u.current&&(clearTimeout(u.current),u.current=null),R.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),R.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),R.current=null);let U=new Promise((W,Q)=>{R.current={resolve:W,reject:Q};});return d.current=_.onClose,g(_),c(true),U},[]),b=hs.useCallback(()=>{R.current&&(R.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),R.current=null),d.current?.(),d.current=void 0,c(false),u.current=setTimeout(()=>{g(null),u.current=null;},200);},[]),O=hs.useCallback(_=>{p?.onSuccess&&p.onSuccess(_),R.current&&(R.current.resolve(_),R.current=null);},[p]),A=hs.useCallback(_=>{console.error("[UnifoldProvider] Withdraw error:",_),p?.onError&&p.onError(_),R.current&&(R.current.reject(_),R.current=null);},[p]),F=hs.useMemo(()=>({publishableKey:t,beginDeposit:x,closeDeposit:v,beginWithdraw:C,closeWithdraw:b}),[t,x,v,C,b]);return jsxRuntime.jsx(Op,{client:o,children:jsxRuntime.jsx(Ey.Provider,{value:F,children:jsxRuntime.jsxs(aa,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(du,{visible:n,onClose:v,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:f,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,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLinkPay:r?.enableStripeLinkPay,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?ah():void 0,onDepositSuccess:I,onDepositError:S,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(xu,{visible:l,onClose:b,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:O,onWithdrawError:A,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function ck(){let e=hs.useContext(Ey);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
- exports.AmountScreen=nd;exports.BottomSheet=_t;exports.KYCWizardScreen=id;exports.OnrampScreen=hd;exports.StripeOnramp=gd;exports.StripeOnrampPreconfigure=ih;exports.UnifoldProvider=lk;exports.getPreferredIcon=Le;exports.getStripePublishableKey=Xc;exports.getSupportedDestinationTokens=Hc;exports.normalizeIconUrl=oe;exports.registerStripeOnramp=yd;exports.setDevApiUrl=om;exports.setStripeOnrampApiUrl=Zc;exports.setStripeOnrampPublishableKey=Jc;exports.useAllowedCountry=uc;exports.useStripeOnramp=sd;exports.useTheme=B;exports.useUnifold=ck;
1
+ 'use strict';var ws=require('react'),reactNative=require('react-native'),sr=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),sm=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),xp=require('@react-native-async-storage/async-storage'),uw=require('expo-constants'),CS=require('react-native-qrcode-svg/src/genMatrix'),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 ws__namespace=/*#__PURE__*/_interopNamespace(ws);var sr__default=/*#__PURE__*/_interopDefault(sr);var sm__default=/*#__PURE__*/_interopDefault(sm);var xp__default=/*#__PURE__*/_interopDefault(xp);var uw__default=/*#__PURE__*/_interopDefault(uw);var CS__default=/*#__PURE__*/_interopDefault(CS);var Yf=e=>{throw TypeError(e)};var Jy=(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 Lu=(e,t,r)=>t.has(e)||Yf("Cannot "+r);var g=(e,t,r)=>(Lu(e,t,"read from private field"),r?r.call(e):t.get(e)),re=(e,t,r)=>t.has(e)?Yf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),z=(e,t,r,o)=>(Lu(e,t,"write to private field"),t.set(e,r),r),Tt=(e,t,r)=>(Lu(e,t,"access private method"),r);var wl=(e,t,r,o)=>({set _(n){z(e,t,n);},get _(){return g(e,t,o)}});var Bu={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)"}},Au=Bu;function Bc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Sl(e,t,r){let o=r?t?.[r]:void 0,n=(p,h,T)=>{let d=o?.[p]?.[h];if(d!==void 0)return d;let f=t?.[p]?.[h];return f!==void 0?f: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,c=(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:Bc(s,i)},transferCrypto:{depositAddress:{card:Bc(s,a)}},depositCard:{quoteProvider:{card:Bc(s,l)}},depositTracker:{executionRow:{card:Bc(s,c)}}}}function Wu(e,t,r){let n={...Bu[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Eu=ws.createContext(null);function L(){let e=ws.useContext(Eu);if(!e){let t=Au.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Sl(t,void 0,"dark"),isDark:true}}return e}function vt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=L(),l=s??a.primary,c=i??a.primary,p=ws.useRef(new reactNative.Animated.Value(0)).current,h=ws.useId(),T=ws.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),d=(e-t)/2,f=2*Math.PI*d,b=e/2,v=o??Math.max(0,Math.round(e-t*2-8)),x=(e-v)/2;ws.useEffect(()=>{let R=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),w=requestAnimationFrame(()=>R.start());return ()=>{cancelAnimationFrame(w),R.stop();}},[p]);let k=p.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:k}]},children:jsxRuntime.jsxs(sr__default.default,{width:e,height:e,children:[jsxRuntime.jsx(sr.Defs,{children:jsxRuntime.jsxs(sr.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(sr.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(sr.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(sr.Circle,{cx:b,cy:b,r:d,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${b}, ${b}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:x+1.5,left:x,width:v,height:v,alignItems:"center",justifyContent:"center"},children:r}):null]})}function zu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(sr.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ho({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(sr.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(sr.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function cr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(sr.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function pn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.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 pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(sr.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ai({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.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 la({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _n({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(sr.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.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 mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function To({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ec({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.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 xl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.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(sr.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(sr.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function em({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.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(sr.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(sr.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(sr.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function rm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function om({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(sr.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(sr.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nm({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(sr__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(sr.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(sr.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(sr.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 da({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=ws.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=ws.useMemo(()=>{let d=o?.[l];return Wu(l,d,r)},[l,o,r]),p=ws.useMemo(()=>Sl(c,i,l),[c,i,l]),h=ws.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=ws.useMemo(()=>({mode:l,colors:c,fonts:h,components:p,isDark:l==="dark"}),[l,c,h,p]);return jsxRuntime.jsx(Eu.Provider,{value:T,children:e})}var _l={damping:28,stiffness:300,mass:.8},Rb=80,Ib=500;function Mt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:c=false,borderTopLeftRadius:p=24,borderTopRightRadius:h=24,marginHorizontal:T,marginBottom:d,overlay:f,useModal:b=true}){let{colors:v}=L(),{height:x}=reactNative.useWindowDimensions(),k=ws.useRef(x);x>k.current&&(k.current=x);let R=reactNative.Platform.OS==="android"?k.current:x,[w,I]=ws.useState(false),m=ws.useRef(e);m.current=e;let u=ws.useRef(0),S=i!=null&&i>=1,y=S||c?0:reactNative.Platform.OS==="ios"?34:24,D=a!=null&&i!=null&&a>i,B=i!=null?(D?a:i)*R:void 0,V=D?(a-i)*R:0,F=l?0:V,W=sm.useSharedValue(R),U=ws.useRef(null),Z=ws.useCallback(()=>{U.current&&(clearTimeout(U.current),U.current=null),m.current||I(false);},[]);ws.useEffect(()=>{e?(U.current&&(clearTimeout(U.current),U.current=null),I(true),W.value=sm.withSpring(F,_l)):w&&(W.value=sm.withTiming(R,{duration:250},X=>{X&&sm.runOnJS(Z)();}),U.current=setTimeout(()=>{U.current=null,Z();},350));},[e]),ws.useEffect(()=>()=>{U.current&&clearTimeout(U.current);},[]),ws.useEffect(()=>{w&&e&&(W.value=sm.withSpring(F,_l));},[F,D]);let le=ws.useCallback(()=>{o&&t();},[o,t]),ne=ws.useMemo(()=>{if(!(!n&&!D))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{u.current=W.value;},onPanResponderMove:(X,G)=>{if(Math.abs(G.dy)<4)return;let q=u.current+G.dy;W.value=Math.max(0,q);},onPanResponderRelease:(X,G)=>{if(!(Math.abs(G.dy)<4)){if(n&&(G.dy>Rb||G.vy>Ib)){t();return}if(D){let q=V/2,te=W.value<q?0:V;W.value=sm.withSpring(te,_l);}else W.value=sm.withSpring(F,_l);}},onPanResponderTerminate:()=>{W.value=sm.withSpring(F,_l);}}).panHandlers},[n,D,V,F,W,t]),ze=sm.useAnimatedStyle(()=>({transform:[{translateY:W.value}]})),K=sm.useAnimatedStyle(()=>({opacity:sm.interpolate(W.value,[0,R*.5,R],[.5,.25,0],sm.Extrapolation.CLAMP)}));if(!w)return null;let de=jsxRuntime.jsxs(reactNative.View,{style:[ni.root,!b&&ni.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(sm__default.default.View,{style:[ni.backdrop,K],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:le})}),jsxRuntime.jsxs(sm__default.default.View,{style:[ni.sheet,ze,{height:B,backgroundColor:v.background,borderTopLeftRadius:S?0:p,borderTopRightRadius:S?0:h,...T?{marginHorizontal:T,marginBottom:d??T+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:p,borderBottomRightRadius:h}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:B!=null?ni.gestureRoot:ni.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:ni.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[ni.handle,{backgroundColor:v.foreground+"33"}]})}),r,y>0&&jsxRuntime.jsx(reactNative.View,{style:{height:y}})]}),ne&&jsxRuntime.jsx(reactNative.View,{...ne,style:ni.dragOverlay})]})]});return b?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[de,f]}):de}var lm={position:"absolute",left:0,right:0,top:0,bottom:0},ni=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...lm,zIndex:9999},backdrop:{...lm,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink: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}}),Bt=ws__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Bt.displayName="BottomSheetScrollView";function ua(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var _b="https://api.unifold.io",Hu="__UnifoldDevApiBaseUrl__",jr="pk_test_123",Uc={},Pl=["ethereum","solana","bitcoin","n1"];function Pb(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Hu];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function br(){return Pb()??_b}function Nc(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.'),jr=e.publishableKey;}e.defaultConfig&&(Uc=e.defaultConfig);}function dm(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[Hu]=t:delete globalThis[Hu];}function Fl(){return br()}function Hc(){return jr}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 or(e){let t=e.startsWith("/")?e:`/${e}`;return `${br()}/api/public${t}`}function ie(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,br()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${br()}${e}`:`${br()}/api/public${e}`:""}async function zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Uc.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||Uc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Uc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||jr;to(n);let s=await fetch(`${br()}/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 Io(e,t){return e.find(r=>r.chain_type===t)}async function hn(e,t,r){let o=t||jr;to(o);let n=await fetch(`${br()}/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 jc(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/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 Ae(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 ii(e,t){let r=e||jr;to(r);let o=`${br()}/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 ju(e,t){let r=t||jr;to(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${br()}/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 $c(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function $u(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/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 qu(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/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 Qu(e,t){let r=t||jr;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(`${br()}/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 Dl(e){let t=e||jr;to(t);let r=await fetch(`${br()}/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 Pn(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 Vl(e){let t=e||jr;to(t);let r=await fetch(`${br()}/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 Ku(){let e=await fetch(`${br()}/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 qc(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 Ol(){let e=await fetch(`${br()}/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 Qc(e){let t=e||jr;to(t);let r=await fetch(`${br()}/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 Gu(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/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 Yu(e,t){return jc(e.deposit_wallet_id,t)}async function Kc(e,t,r,o,n){let s=n||jr;to(s);let i=await fetch(`${br()}/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()}async function Ju(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/cashapp/sessions`,{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 create Cash App session: ${o.statusText}`);return o.json()}async function Zu(e="usd",t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Xu(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function ep(e){let t=e||jr;to(t);let r=await fetch(`${br()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function tp(e,t,r){let o=r||jr;to(o);let n=await fetch(`${br()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}function pm({size:e=28}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(sr.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(sr.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(sr.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 pa({size:e=28}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(sr.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(sr.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(sr.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(sr.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(sr.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(sr.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(sr.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(sr.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(sr.Defs,{children:jsxRuntime.jsx(sr.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(sr.Rect,{width:28,height:28,fill:"white"})})})]})}function gm({size:e=28}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(sr.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(sr.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(sr.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(sr.Defs,{children:jsxRuntime.jsx(sr.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(sr.Rect,{width:28,height:28,fill:"white"})})})]})}function ha({size:e=28}){return jsxRuntime.jsxs(sr__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(sr.Defs,{children:[jsxRuntime.jsxs(sr.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(sr.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(sr.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(sr.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(sr.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(sr.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(sr.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(sr.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(sr.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(sr.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(sr.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(sr.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(sr.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(sr.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 ym({size:e=28}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(sr.G,{children:[jsxRuntime.jsx(sr.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(sr.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 Gc=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:pm},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:pa},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:gm},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ha},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:ym}];function Yc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Jc(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 ga(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Gc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Gc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function nr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=L(),i=r==="back",a=i?jsxRuntime.jsx(aa,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(_t,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ei.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:Ei.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Ei.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Ei.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Ei.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Ei.headerWithTitle:Ei.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Ei.headerSpacer}),!i&&l]})}var Zc={paddingTop:8,paddingBottom:8},Ei=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Zc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Zc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function ko({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=L();return e?jsxRuntime.jsx(reactNative.Text,{style:[bm.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[bm.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var bm=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function gn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ws.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 ap({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=ws.useState(false),{colors:a,components:l}=L(),c=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Yc(r);return jsxRuntime.jsxs(ws.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:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(pt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(pn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Xc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ya({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=L(),s=e.toLowerCase(),i=Xc[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 ed({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=L(),c=or(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ga(r);return jsxRuntime.jsxs(reactNative.View,{style:[Xo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:Xo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Xo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Xo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Xo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Wr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Xo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Xo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Xo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Xo.tokenIcon,{backgroundColor:Xc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Xo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Xo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Xo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Xo=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 Vn(){let{colors:e,fonts:t,components:r}=L(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return ws.useMemo(()=>{let l=i.borderRadius,c={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"}},p={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}:{}}},h={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)),d={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}:{}}},f={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"}},b={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:c,quote:h,pm:d,wallet:f,flow:b,amount:p}},[e,t,o,n,s,i,a])}var Sm="",Tm;function td(e){Sm=e;}function rd(e){Tm=e;}function _o(){let e=Sm||Hc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Po(){return Tm??Fl()}async function od(){let e=`${Po()}/v1/public/onramps/headless/stripe/config`,t=_o(),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 lp(e){let t=await fetch(`${Po()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":_o(),"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 km(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":_o(),"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 cp(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"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 xm(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(`${Po()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":_o(),"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 vm(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":_o(),"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 si(e,t){let r=`${Po()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"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 Rm(e){let t=`${Po()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":_o(),"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 Im(e,t){let r=`${Po()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"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 dp(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"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 up(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(`${Po()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":_o(),"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 pp(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":_o(),"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 _m(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(`${Po()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":_o(),"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 Mi(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 Pm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":_o()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function rC({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(sr__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(sr.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(sr.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(sr.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(sr.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(sr.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 oC({size:e=24}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(sr.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(sr.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(sr.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function nC({size:e=24}){return jsxRuntime.jsx(sr__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(sr.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(sr.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(sr.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(sr.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(sr.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(sr.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(sr.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(sr.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(sr.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(sr.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(sr.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(sr.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(sr.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(sr.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 mp({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(sa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(rC,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(oC,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(nC,{size:t}):jsxRuntime.jsx(sa,{size:t*.75,color:r,strokeWidth:1.75})}function nd(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 gp={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function yp(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 Lm({status:e,colors:t,fontFamily:r}){let o=yp(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:gp[e]??e})})}function Bm({count:e=4}){let{colors:t,components:r}=L(),o=ws.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return ws.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:ba.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ba.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ba.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ba=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 Am({active:e,interval:t=15e3,color:r}){let o=ws.useRef(new reactNative.Animated.Value(0)).current;return ws.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 Wm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=L(),[s,i]=ws.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=yp(e.status,r),h=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,b=Mi(f?.icon_urls,f?.icon_url),v=ga(l?.destination_network??""),x=l?.wallet_address?Yc(l.wallet_address):null,k=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,R=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,w=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase()):null,I=[{label:"Amount",value:h},{label:"Received",value:`${T} ${d}`},...w?[{label:"Payment",value:w}]:[],{label:"Network",value:v},...x?[{label:"Wallet",value:x}]:[],...k?[{label:"Network Fee",value:k}]:[],...R?[{label:"Transaction Fee",value:R}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(nr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Bt,{style:Kr.scroll,contentContainerStyle:Kr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Kr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ya,{currency:d||"USD",tokenIconUrl:b,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Kr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx(ho,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(_t,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Kr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Kr.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:gp[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Kr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:nd(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Kr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Kr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Kr.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:[Kr.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(pt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(pn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),I.map(m=>jsxRuntime.jsx(ws__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Kr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Kr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:m.label}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:m.value})]})},m.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Kr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Kr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Kr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Kr=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 Mm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=L(),[i,a]=ws.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:Ln.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ln.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(tm,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Ln.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Ln.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:Ln.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(ho,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(To,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(rm,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Ln=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 bC=[50,100,500],CC=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Um(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wC(e){return e.card?`${Um(e.card.brand)} ${Um(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function ld({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:h=[],onAddPaymentMethod:T,onConfirm:d,onCancel:f,sheetBorderTopLeftRadius:b,sheetBorderTopRightRadius:v,accessToken:x,showHistoryProgressBar:k=true,onLogout:R,onRequestKYC:w,showSwitchAccount:I=true,inputDisabled:m=false}){let u=Vn(),{colors:S,components:y,fonts:D}=L(),B=b??y.card.borderRadius,V=v??y.card.borderRadius,[F,W]=ws.useState(e),[U,Z]=ws.useState(r?"apple_pay":h.length>0?h[0].id:null),le=ws.useRef(false),ne=_=>{le.current=true,Z(_);};ws.useEffect(()=>{le.current||r||h.length>0&&Z(h[0].id);},[h,r]);let[ze,K]=ws.useState(false),[de,X]=ws.useState("select"),[G,q]=ws.useState(null),te=ws.useRef(false);ws.useEffect(()=>{l&&c&&/saving/i.test(c)&&X("card");},[l,c]);let xe=s,rt=xe!=null&&xe>0,Ue=ws.useMemo(()=>{if(o)return [];let _=bC.map(C=>({label:`$${C}`,amount:String(C),disabled:false}));return _.push({label:"MAX",amount:rt?String(xe):"0",disabled:!rt}),_},[o,rt,xe]),se=_=>{if(_==="\u232B"){W(C=>C.slice(0,-1));return}if(_==="."){if(F.includes("."))return;W(C=>C===""?"0.":C+".");return}W(C=>{let O=C.indexOf(".");return O!==-1&&C.length-O>2?C:C==="0"&&_!=="."?_:C+_});},Fe=F===""?"0":F,Ne=parseFloat(F),ot=n!=null&&!isNaN(Ne)&&Ne>0&&Ne<n,lt=xe!=null&&xe>0&&!isNaN(Ne)&&Ne>xe,qe=F!==""&&!isNaN(Ne)&&Ne>0&&!ot&&!lt,Ee=r||h.length>0,De=i==="header",_e=ws.useMemo(()=>{let _=[];r&&_.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let C of h)_.push({id:C.id,label:wC(C),hint:C.card?`Expires ${C.card.exp_month}/${C.card.exp_year}`:C.type,brand:C.card?.brand,isApplePay:false});return _},[r,h]),Se=_e.find(_=>_.id===U),Qe=U!=null&&U!=="apple_pay",dt=Se?Se.label:Qe&&G?G:Qe?"Card":"Pay With",er=Se?!Se.isApplePay:Qe,He=Se?.brand??G??void 0,[ve,nt]=ws.useState(false),[ut,Ve]=ws.useState([]),[ye,Be]=ws.useState(false),[Nt,he]=ws.useState(null),[st,ht]=ws.useState(null),tr=ws.useRef(null);tr.current=st;let je=ws.useRef(false);je.current=ve;let kt=ws.useCallback(async(_=false)=>{if(x){_||(Be(true),he(null));try{let C=await Rm(x);if(!je.current)return;let O=Array.isArray(C.data)?C.data:Array.isArray(C)?C:[];Ve(O),_||he(null);let N=tr.current?.id;if(N){let H=O.find(j=>j.id===N);H&&ht(H);}}catch(C){if(!je.current)return;_||he(C?.message??"Failed to load history");}finally{!_&&je.current&&Be(false);}}},[x]),Xe=ws.useCallback(()=>{nt(true),kt();},[kt]);ws.useEffect(()=>{if(!ve||!x)return;let _=setInterval(()=>kt(true),15e3);return ()=>clearInterval(_)},[ve,x,kt]);let Re=ws.useCallback(_=>{switch(_){case "history":Xe();break;case "kyc":w?.();break;case "logout":R?.();break}},[Xe,w,R]),$=!!x||!!w||!!R?jsxRuntime.jsx(Mm,{onSelect:Re,showKycOption:!!w,showSwitchAccount:I&&!!R}):void 0,Te=Ee?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[De?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(X("select"),K(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[Se?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):er?jsxRuntime.jsx(mp,{sublabel:He,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:dt}),jsxRuntime.jsx(cr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:u.form.screen,children:[jsxRuntime.jsx(nr,{onPress:f,title:"Enter amount",leftAction:$}),De&&Te,jsxRuntime.jsxs(reactNative.View,{style:u.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.amountText,Fe==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Fe]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),ot&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),lt&&xe!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Maximum amount is $",xe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!De&&Te,Ue.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Ue.map(_=>{let C=!_.disabled&&F===_.amount&&F!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,C&&{backgroundColor:S.primary},_.disabled&&{opacity:.4}],activeOpacity:.7,disabled:_.disabled||l,onPress:()=>W(_.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,C&&{color:S.primaryForeground}],children:_.label})},_.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:CC.map((_,C)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:_.map(O=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||m)&&{opacity:.3}],onPress:()=>se(O),activeOpacity:.6,disabled:l||m,children:jsxRuntime.jsx(reactNative.Text,{style:O==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:O})},O))},C))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!qe||l||m)&&u.form.continueBtnDisabled],onPress:()=>qe&&!l&&!m&&d(F,U),disabled:!qe||l||m,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!qe||m)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!ze&&p?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:p}):!ze&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(Mt,{visible:ze,onClose:()=>{l||(K(false),X("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:B,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:de==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>K(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx(_t,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Bt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[_e.map(_=>{let C=U===_.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,C&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{ne(_.id),q(_.isApplePay?null:_.label),K(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetOptionIcon,children:_.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(mp,{sublabel:_.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:_.label}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:_.hint})]})]}),C&&jsxRuntime.jsx(pt,{size:18,color:S.primary,strokeWidth:2.5})]},_.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!te.current){te.current=true;try{let _=await T?.();_&&(ne(_.token),q(_.sublabel),K(!1));}finally{te.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||X("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(aa,{size:20,color:S.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&qe&&a(false,F);},children:jsxRuntime.jsx(reactNative.Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(Mt,{visible:ve,onClose:()=>{nt(false),ht(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:B,borderTopRightRadius:V,children:st?jsxRuntime.jsx(Wm,{session:st,onBack:()=>ht(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(nr,{onPress:()=>nt(false),title:"Purchase History"}),k&&jsxRuntime.jsx(Am,{active:ve&&!ye&&ut.length>0,color:S.primary}),ye?jsxRuntime.jsx(Bm,{}):Nt?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:Nt})}):ut.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:S.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Bt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:ut.map(_=>{let C=_.transaction_details,O=C?.source_amount?`$${parseFloat(C.source_amount).toFixed(2)}`:"\u2014",N=(C?.destination_currency??"").toUpperCase(),H=C?.destination_amount?`${parseFloat(C.destination_amount).toFixed(2)} ${N}`:"",j=nd(_.created),pe=_.destination_token_metadata,$e=Mi(pe?.icon_urls,pe?.icon_url),A=Mi(pe?.chain?.icon_urls,pe?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>ht(_),children:[jsxRuntime.jsx(ya,{currency:N||"USD",tokenIconUrl:$e,networkIconUrl:A,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:O}),H?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:H}):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(Lm,{status:_.status,colors:S,fontFamily:D.regular}),j?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:S.foregroundMuted,fontFamily:D.regular},children:j}):null]}),jsxRuntime.jsx(Wr,{size:14,color:S.foregroundMuted,strokeWidth:2})]})]},_.id)})})]})})]})}function cd({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Vn(),{colors:i,fonts:a,components:l}=L(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],h=p.length,[T,d]=ws.useState(1),[f,b]=ws.useState(e.firstName??""),[v,x]=ws.useState(e.lastName??""),[k,R]=ws.useState(e.dobMonth??""),[w,I]=ws.useState(e.dobDay??""),[m,u]=ws.useState(e.dobYear??""),[S,y]=ws.useState(e.addressLine1??""),[D,B]=ws.useState(e.addressLine2??""),[V,F]=ws.useState(e.city??""),[W,U]=ws.useState(e.state??""),[Z,le]=ws.useState(e.postalCode??""),[ne,ze]=ws.useState(e.country??"US"),[K,de]=ws.useState(e.idNumber??""),X=ws.useRef(null),G=ws.useRef(null),q=ws.useRef(null),te=ws.useRef(null),xe=ws.useRef(null),rt=ws.useRef(null),Ue=ws.useRef(null),se=ws.useRef(null),Fe=p[T-1],Ne=()=>{switch(Fe){case "name":return f.trim().length>0&&v.trim().length>0;case "dob":return k.length===2&&w.length===2&&m.length===4;case "address":return S.trim().length>0&&V.trim().length>0&&W.trim().length>0&&Z.trim().length>0;case "ssn":return K.trim().length>0;default:return false}},ot=()=>{Ne()&&(T<h?d(_e=>_e+1):o({firstName:f,lastName:v,idNumber:K,dobMonth:k,dobDay:w,dobYear:m,addressLine1:S,addressLine2:D,city:V,state:W,postalCode:Z,country:ne}));},lt=()=>{T>1?d(_e=>_e-1):n();},qe={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:Ee}=qe[Fe],De=[Fr.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:Fr.header,children:[jsxRuntime.jsx(reactNative.View,{style:Fr.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Fr.iconButton,onPress:lt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(Tl,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:Fr.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:De,children:[T," of ",h]})}),jsxRuntime.jsx(reactNative.View,{style:Fr.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Fr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(_t,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:Fr.progressTrack,children:Array.from({length:h}).map((_e,Se)=>jsxRuntime.jsx(reactNative.View,{style:[Fr.progressSegment,{backgroundColor:Se<T||Se+1===T?i.primary:i.border}]},Se))}),jsxRuntime.jsx(Bt,{style:s.form.flex,contentContainerStyle:Fr.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:Ee}),Fe==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(li,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:b,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>X.current?.focus()})}),jsxRuntime.jsx(li,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:X,style:s.form.input,placeholder:"Doe",placeholderTextColor:c,value:v,onChangeText:x,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:ot})})]}),Fe==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:Fr.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:Fr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,Fr.dobInput],placeholder:"MM",placeholderTextColor:c,value:k,onChangeText:_e=>{let Se=_e.replace(/\D/g,"").slice(0,2);R(Se),Se.length===2&&G.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Fr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:[s.form.input,Fr.dobInput],placeholder:"DD",placeholderTextColor:c,value:w,onChangeText:_e=>{let Se=_e.replace(/\D/g,"").slice(0,2);I(Se),Se.length===2&&q.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Fr.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:q,style:[s.form.input,Fr.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:m,onChangeText:_e=>{let Se=_e.replace(/\D/g,"").slice(0,4);u(Se);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:ot})]})]}),Fe==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(li,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:S,onChangeText:y,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})}),jsxRuntime.jsx(li,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:D,onChangeText:B,returnKeyType:"next",onSubmitEditing:()=>xe.current?.focus()})}),jsxRuntime.jsx(li,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:xe,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:V,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>rt.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:Fr.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(li,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:rt,style:s.form.input,placeholder:"CA",placeholderTextColor:c,value:W,onChangeText:_e=>U(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ue.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(li,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ue,style:s.form.input,placeholder:"94001",placeholderTextColor:c,value:Z,onChangeText:le,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>se.current?.focus()})})})]}),jsxRuntime.jsx(li,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:se,style:s.form.input,placeholder:"US",placeholderTextColor:c,value:ne,onChangeText:_e=>ze(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:ot})})]}),Fe==="ssn"&&jsxRuntime.jsxs(li,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:K,onChangeText:de,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:ot}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,Fr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&T>=h?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(vt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Ne()&&s.form.continueBtnDisabled],onPress:ot,disabled:!Ne(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Ne()&&s.form.continueBtnTextDisabled],children:T>=h?"Submit":"Continue"})})})]})})}function li({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 Fr=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 vp="@unifold/stripe_oauth";async function Hm(){try{let e=await xp__default.default.getItem(vp);return e?JSON.parse(e):null}catch{return null}}async function Rp(e){try{await xp__default.default.setItem(vp,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Sa(){try{await xp__default.default.removeItem(vp);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var _C=5,qi=null,Ip=false,_p={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function dd(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:c,registerWalletAddress:p,collectPaymentMethod:h,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[d,f]=ws.useState(r),[b,v]=ws.useState(!!e?.externalUserId),[x,k]=ws.useState(false),[R,w]=ws.useState(false),[I,m]=ws.useState(""),[u,S]=ws.useState(null),[y,D]=ws.useState(e?.email??""),[B,V]=ws.useState(e?.phone??""),[F,W]=ws.useState(""),[U,Z]=ws.useState("US"),[le,ne]=ws.useState(""),[ze,K]=ws.useState(""),de=ws.useRef(""),X=ws.useRef(""),G=ws.useRef(""),[q,te]=ws.useState(false),[xe,rt]=ws.useState(false),Ue=ws.useRef(0),se=ws.useRef(false),Fe=ws.useRef(false),Ne=ws.useRef(false),ot=ws.useRef(false),lt=ws.useRef(e?.email??""),qe=ws.useRef(false),Ee=ws.useRef(null),De=ws.useRef(""),_e=ws.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Se=ws.useRef(null),[Ge,Qe]=ws.useState(0),[dt,er]=ws.useState(_p),[He,ve]=ws.useState(e?.defaultWalletAddress??""),[nt,ut]=ws.useState(""),[Ve,ye]=ws.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Be,Nt]=ws.useState(e?.defaultSourceAmount??"100"),[he,st]=ws.useState(e?.defaultSourceCurrency??"usd"),[ht,tr]=ws.useState(e?.defaultDestinationCurrency??"usdc"),[je,kt]=ws.useState(null),[Xe,Re]=ws.useState(),[Ye,$]=ws.useState(),[Te,_]=ws.useState(false),C=ws.useRef(null),O=ws.useRef(false),N=ws.useRef(0),H=ws.useRef(e?.onComplete),j=ws.useRef(e?.onError),pe=ws.useRef(e?.onStepChange),$e=ws.useRef(r);ws.useEffect(()=>{H.current=e?.onComplete;},[e?.onComplete]),ws.useEffect(()=>{j.current=e?.onError;},[e?.onError]),ws.useEffect(()=>{pe.current=e?.onStepChange;},[e?.onStepChange]);let A=ws.useRef(r);ws.useEffect(()=>{d!==A.current&&(pe.current?.(d,A.current),A.current=d),$e.current=d;},[d]),ws.useEffect(()=>{R&&d!=="email"&&w(false);},[R,d]),ws.useEffect(()=>{b&&d!==r&&v(false);},[b,d,r]);let E=ws.useCallback((P,M,fe)=>{let Le={code:P,message:M,step:$e.current,stripeErrorCode:fe};S(Le),m(""),j.current?.(Le);},[]),rr=ws.useCallback(P=>{let M={sessionId:P.id,status:P.status,sourceAmount:P.transaction_details.source_amount,sourceCurrency:P.transaction_details.source_currency,destinationAmount:P.transaction_details.destination_amount,destinationCurrency:P.transaction_details.destination_currency,destinationNetwork:P.transaction_details.destination_network,walletAddress:P.transaction_details.wallet_address,fees:{networkFee:P.transaction_details.fees.network_fee_amount,transactionFee:P.transaction_details.fees.transaction_fee_amount}};return H.current?.(M),M},[]),Oe=ws.useCallback(()=>S(null),[]),be=P=>P.refresh_token??P.refresh?.refresh_token??"",gt=ws.useCallback((P,M,fe,Le,Pe)=>{X.current=M,de.current=fe,e?.externalUserId&&Rp({accessToken:M,refreshToken:fe,customerId:P,externalUserId:e.externalUserId,email:Pe||y,expiresAt:Date.now()+Le*1e3});},[e?.externalUserId,y]),it=ws.useCallback(async()=>{let P=de.current;if(!P)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let M=await cp(P,G.current??void 0),fe=M.access_token,Le=be(M)||P;return K(fe),gt(G.current,fe,Le,M.expires_in??3600),fe}catch(M){return console.error("[tryRefreshAccessToken] refresh failed:",M?.message),await Sa(),qi=null,Se.current=null,X.current="",de.current="",G.current="",K(""),ne(""),null}},[gt]),Je=ws.useCallback(async P=>{try{return await P(X.current)}catch(M){let fe=M?.message??"";if(fe.includes("stripe_onramp_forbidden")||fe.includes("403")){let Le=await it();if(!Le)throw E("authorization_error","Session expired. Please sign in again."),f("email"),M;return await P(Le)}throw M}},[it,E]);ws.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){_(false);return}let M=false;return stripeReactNative.isPlatformPaySupported().then(fe=>{M||_(fe);}),()=>{M=true;}},[e?.merchantIdentifier]),ws.useEffect(()=>(O.current=false,()=>{O.current=true,C.current&&clearTimeout(C.current);}),[]);let et=ws.useRef(false);ws.useEffect(()=>{if(et.current)return;if(!e?.externalUserId){Sa(),qi=null,Se.current=null,v(false);return}let P=false;return (async()=>{try{let M=await Hm();if(P||!M){P||v(!1);return}if(M.externalUserId!==e.externalUserId){await Sa(),qi=null,Se.current=null,P||v(!1);return}let fe=Date.now()>=M.expiresAt,Le=M.accessToken,Pe=M.refreshToken;if(fe)try{let xt=await cp(M.refreshToken,M.customerId);if(P)return;Le=xt.access_token,Pe=xt.refresh_token??xt.refresh?.refresh_token??M.refreshToken,await Rp({accessToken:Le,refreshToken:Pe,customerId:M.customerId,externalUserId:e.externalUserId,email:M.email,expiresAt:Date.now()+(xt.expires_in??3600)*1e3});}catch(xt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",xt?.message),await Sa(),qi=null,Se.current=null,P||v(!1);return}if(P)return;if(et.current=!0,ne(M.customerId),G.current=M.customerId,K(Le),X.current=Le,de.current=Pe,M.email&&(D(M.email),lt.current=M.email),qi===M.customerId)Se.current=Promise.resolve({error:void 0});else {let xt=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:M.customerId});xt.error?console.error("[useStripeOnramp] restore configureSDK error:",xt.error.message):qi=M.customerId,Se.current=Promise.resolve(xt);}if(P)return;let yt=()=>new Promise(xt=>{let gr=()=>{qe.current&&De.current?xt():setTimeout(gr,200);};gr();});try{if(await Promise.race([yt(),new Promise((gr,Vt)=>setTimeout(()=>Vt(new Error("timeout")),1e4))]),P)return;let xt=De.current.toLowerCase();await p(xt,_e.current);}catch(xt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",xt?.message);}if(P)return;try{let gr=(await si(G.current,X.current)).kyc_tiers??[],Vt=gr.find(Eo=>Eo.tier==="l0"),Hr=gr.find(Eo=>Eo.tier==="l1"),lo=gr.find(Eo=>Eo.tier==="l2"),eo=Vt?.verification_status==="verified",un=Hr?.verification_status==="verified",yr=lo?.verification_status==="verified",ri=!!Vt?.verification_status&&Vt.verification_status!=="not_started";f(eo||un||yr?"session_params":ri?"kyc_offer":"kyc");}catch{f("kyc");}}finally{P||v(false);}})(),()=>{P=true;}},[]),ws.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||q)return;let P=false;rt(true);async function M(){try{let[fe,Le]=await Promise.all([_m({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?Pm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(yr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",yr?.message),null)):Promise.resolve(null)]);if(P)return;let Pe=e?.destinationChainType??"ethereum",yt=fe.data.find(yr=>yr.chain_type===Pe);if(yt?.address){let yr=yt.address.toLowerCase();ve(yr),De.current=yr,yt.recipient_address&&ut(yt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",Pe,"in",fe.data?.length,"wallets");let xt={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},gr={8453:"base",1:"ethereum",137:"polygon"},Vt=Le?.destination_network,Hr="none";if(Vt&&xt[Vt])ye(xt[Vt]),_e.current=xt[Vt],Hr=Vt+" (from default_token API)";else if(e?.destinationChainId&&gr[e.destinationChainId]){let yr=gr[e.destinationChainId];xt[yr]&&(ye(xt[yr]),_e.current=xt[yr]),Hr=yr+" (from chain_id "+e.destinationChainId+")";}else xt[Pe]&&(ye(xt[Pe]),_e.current=xt[Pe],Hr=Pe+" (from chain_type fallback)");Le?.destination_currency&&tr(Le.destination_currency.toLowerCase());let lo=Le?.destination_token_metadata,eo=Mi(lo?.icon_urls,lo?.icon_url),un=Mi(lo?.chain?.icon_urls,lo?.chain?.icon_url);eo&&Re(eo),un&&$(un),te(!0),qe.current=!0;}catch(fe){if(P)return;console.error("[resolveWallet] Failed to resolve wallet:",fe?.message),te(true),qe.current=true;}finally{P||rt(false);}}return Ee.current=M(),()=>{P=true;}},[e?.publishableKey,e?.externalUserId,Ge]);let Me=ws.useCallback(async()=>{if(Se.current)return Se.current;let P=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(M=>(M.error&&(console.error("[useStripeOnramp] configureSDK error:",M.error.message,M.error.code),Se.current=null),M)).catch(M=>{throw console.error("[useStripeOnramp] configureSDK threw:",M?.message??M),Se.current=null,M});return Se.current=P,P},[o,e?.merchantDisplayName]);ws.useEffect(()=>{e?.externalUserId||Me();},[]);let qt=ws.useCallback(async P=>{if(!se.current){se.current=true,k(true),Oe(),m("Creating auth intent...");try{let M=await lp(P);m("Waiting for authorization...");let fe=await i(M);if(fe?.error){E("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(fe?.status==="Denied"){E("authorization_error","Authorization denied by user."),f("email");return}if(fe?.status!=="Consented"||!fe.customerId){E("authorization_error","Authorization was canceled."),f("email");return}m("Exchanging tokens...");let Le=fe.customerId,Pe=await km(M,Le),yt=Pe.access_token,xt=be(Pe);D(P),lt.current=P,ne(Le),G.current=Le,qi=Le,K(yt),gt(Le,yt,xt,Pe.expires_in??3600,P),m("Checking verification status...");try{let Vt=(await si(Le,yt)).kyc_tiers??[],Hr=Vt.find(So=>So.tier==="l0"),lo=Vt.find(So=>So.tier==="l1"),eo=Vt.find(So=>So.tier==="l2"),un=Hr?.verification_status==="verified",yr=lo?.verification_status==="verified",ri=eo?.verification_status==="verified",Eo=!!Hr?.verification_status&&Hr.verification_status!=="not_started";if(m(""),un||yr||ri){Ee.current&&(m("Resolving wallet..."),await Ee.current,m(""));let So=De.current;if(So)try{let Bi=So.toLowerCase(),Lc=_e.current,oi=await p(Bi,Lc);oi?.error?(console.warn("[proceedToAuthorize] wallet registration error:",oi.error.message),E("wallet_error",oi.error.message,oi.error.code),f("wallet")):f("session_params");}catch(Bi){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Bi?.message),f("wallet");}else f("wallet");}else Eo?(await Qr(),m(""),f("kyc_offer")):f("kyc");}catch(gr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",gr?.message),m(""),f("kyc");}}catch(M){E("authorization_error",M?.message??String(M)),f("email");}finally{se.current=false,k(false);}}},[i,Oe,E,gt,p,Ve]),St=ws.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!y){E("validation_error","Please enter an email address.");return}k(true),Oe(),m("");try{m("Configuring...");let P=await Me();if(P.error){E("configuration_error",P.error.message,P.error.code);return}m("Checking Link account...");let M=await n(y);if(M.error){E("authorization_error",M.error.message,M.error.code);return}M.hasLinkAccount?await qt(y):(m(""),f("disclaimer"));}catch(P){E("unknown_error",P?.message??String(P));}finally{k(false);}},[Oe,Me,y,E,n,qt]),wo=ws.useCallback(async()=>{if(!Ne.current){if(!B){E("validation_error","Please enter your phone number.");return}Ne.current=true,k(true),Oe(),m("");try{m("Creating Link account...");let P=await s({email:y,phone:B,fullName:F||y,country:U||"US"});if(P.error){E("registration_error",P.error.message,P.error.code);return}await qt(y);}catch(P){E("registration_error",P?.message??String(P));}finally{Ne.current=false,k(false);}}},[Oe,U,y,E,F,B,s,qt]);ws.useEffect(()=>{if(d!=="email")return;let P=ot.current||Ip;if(P&&(ot.current=false,Ip=false),!e?.email||b)return;if(P){w(true);return}let M=++Ue.current,fe=false,Le=()=>fe||Ue.current!==M;return e?.phone?(async()=>{k(true),Oe();try{m("Configuring...");let Pe=await Me();if(Le())return;if(Pe.error){E("configuration_error",Pe.error.message,Pe.error.code);return}m("Checking Link account...");let yt=await n(e.email);if(Le())return;if(yt.error){E("authorization_error",yt.error.message,yt.error.code);return}if(yt.hasLinkAccount){if(Le())return;await qt(e.email);}else {if(Le())return;m(""),f("disclaimer");}}catch(Pe){Le()||E("unknown_error",Pe?.message??String(Pe));}finally{k(false);}})():(async()=>{k(true),Oe();try{m("Configuring...");let Pe=await Me();if(Le())return;if(Pe.error){E("configuration_error",Pe.error.message,Pe.error.code);return}m("Checking Link account...");let yt=await n(e.email);if(Le())return;if(yt.error){E("authorization_error",yt.error.message,yt.error.code);return}if(yt.hasLinkAccount){if(Le())return;await qt(e.email);}else {if(Le())return;m(""),f("disclaimer");}}catch(Pe){Le()||E("unknown_error",Pe?.message??String(Pe));}finally{k(false);}})(),()=>{fe=true;}},[d,e?.email,e?.phone,b]);let Qr=ws.useCallback(async()=>{Ee.current&&(m("Resolving wallet..."),await Ee.current);let P=De.current;if(P)try{m("Registering wallet...");let M=P.toLowerCase(),fe=_e.current;await p(M,fe);}catch(M){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",M?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Fc=ws.useCallback(async(P,M)=>{k(true),Oe(),m(""),er(yt=>({...yt,...P}));let fe=!M,Le=M??"kyc_offer",Pe=M?"kyc_l1":"kyc";try{let yt=P.dobDay&&P.dobMonth&&P.dobYear,xt=P.firstName&&P.lastName,gr={};xt&&(gr.firstName=P.firstName,gr.lastName=P.lastName),P.addressLine1&&(gr.address={line1:P.addressLine1,line2:P.addressLine2||void 0,city:P.city,state:P.state,postalCode:P.postalCode,country:P.country}),P.idNumber&&(gr.idNumber=P.idNumber),yt&&(gr.dateOfBirth={day:parseInt(P.dobDay,10),month:parseInt(P.dobMonth,10),year:parseInt(P.dobYear,10)});let Vt=await a(gr);if(Vt?.error?.message&&(/no active link consumer/i.test(Vt.error.message)||/not be verified/i.test(Vt.error.message))){if(m("Verifying identity..."),!await ks()){E("kyc_error","Please verify your identity to continue."),f(Pe);return}Vt=await a(gr);}if(Vt?.error){let yr=fe?"l0":"l1";try{let Eo=(await si(G.current,X.current)).kyc_tiers?.find(So=>So.tier===yr);if(Eo?.verification_status==="verified"){let So=fe?"session_params":Le;await Qr(),m(""),f(So);return}if(Eo?.verification_status==="rejected"){if(fe){await Qr(),m(""),f(Le);return}E("kyc_error","Something went wrong. Please try again."),f(Pe);return}}catch(ri){console.warn("[attachKyc] could not fetch verification status:",ri?.message);}if(fe){await Qr(),m(""),f(Le);return}E("kyc_error",Vt.error.message,Vt.error.stripeErrorCode??Vt.error.code),f(Pe);return}if(!(Vt&&Object.keys(Vt).length>0&&!Vt.error)){let yr=fe?"l0":"l1";if(m("Verifying identity..."),(!G.current||!X.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${yr} \u2014 missing customerIdRef or accessTokenRef`),!fe)){E("kyc_error","Unable to verify identity. Please try again."),f(Pe);return}let ri=G.current,Eo=X.current,So=10,Bi=!1;if(ri&&Eo)for(let Lc=0;Lc<So;Lc++){try{let Ou=(await si(ri,Eo)).kyc_tiers?.find(Yy=>Yy.tier===yr);if(Ou?.verification_status==="verified"){Bi=!0;break}if(Ou?.verification_status==="rejected"){if(fe)break;console.warn(`[attachKyc] \u274C ${yr} rejected:`,Ou?.verification_errors),E("kyc_error","KYC verification was rejected. Please try again."),f(Pe);return}}catch(oi){console.warn(`[attachKyc] ${yr} poll error:`,oi?.message);}await new Promise(oi=>setTimeout(oi,2e3));}if(!Bi&&!fe){console.warn(`[attachKyc] \u274C ${yr} verification timed out after`,So,"attempts"),E("kyc_error","Identity verification is taking longer than expected. Please try again."),f(Pe);return}await Qr(),m(""),f(fe&&Bi?"session_params":Le);return}m("Please review your KYC information...");let eo=await l(null);if(eo?.error){E("kyc_error",eo.error.message,eo.error.stripeErrorCode??eo.error.code),f(Pe);return}if(eo?.status==="UpdateAddress"){E("kyc_error","Please update your address and resubmit."),f(Pe);return}await Qr(),m(""),f(fe?"session_params":Le);}catch(yt){E("kyc_error",yt?.message??String(yt)),f(Pe);}finally{k(false);}},[a,Oe,E,l,Qr]),ks=ws.useCallback(async()=>{let P=lt.current||e?.email;if(!P)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(lt.current),"config.email:",e?.email),false;try{let M=await lp(P),fe=await i(M);return fe?.status==="Consented"&&fe.customerId?(G.current=fe.customerId,ne(fe.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",fe?.status),!1)}catch(M){return console.warn("[reestablishLinkSession] failed:",M?.message),false}},[i,e?.email]),Dc=ws.useCallback(async()=>{if(!Fe.current){Fe.current=true,k(true),Oe(),m("Launching identity verification...");try{let P=await c();if(P?.error?.message&&(/no active link consumer/i.test(P.error.message)||/not be verified/i.test(P.error.message))){if(m("Verifying identity..."),!await ks()){E("identity_error","Please verify your identity to continue.");return}P=await c();}if(P?.error){let fe=P.error.message??"";if(/cancel/i.test(fe)){m("");return}E("identity_error",fe,P.error.code);return}m(""),xs.current?(xs.current=!1,f("session_params")):f("wallet");}catch(P){E("identity_error",P?.message??String(P));}finally{Fe.current=false,k(false);}}},[Oe,E,ks,c]),xs=ws.useRef(false);ws.useEffect(()=>{d==="identity"&&!x&&Dc();},[d]);let Vc=ws.useCallback(async()=>{if(!He){E("validation_error","Please enter a wallet address.");return}k(true),Oe(),m("");try{let P=He.toLowerCase(),M=await p(P,Ve);if(M?.error){console.warn("[registerWallet] error:",M.error.message),E("wallet_error",M.error.message,M.error.code);return}m(""),f("kyc_offer");}catch(P){console.error("[registerWallet] exception:",P?.message??String(P)),E("wallet_error",P?.message??String(P));}finally{k(false);}},[Oe,E,He,Ve,p]);ws.useEffect(()=>{d==="wallet"&&q&&He&&Vc();},[d,q,He]);let na=ws.useCallback(P=>{O.current=false,N.current=0;let M=0,fe=async()=>{M+=1;let Le=X.current;try{let Pe=await Im(P,Le);if(O.current)return;N.current=0,Pe.status==="fulfillment_complete"?(kt(Pe),f("success")):C.current=setTimeout(fe,3e3);}catch(Pe){if(O.current)return;let yt=Pe?.message??"";if((yt.includes("stripe_onramp_forbidden")||yt.includes("403"))&&await it()&&!O.current){C.current=setTimeout(fe,1e3);return}if(N.current+=1,console.error(`[pollSessionStatus] poll #${M} error:`,yt),N.current>=_C){E("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}C.current=setTimeout(fe,5e3);}};C.current=setTimeout(fe,3e3);},[E,it]),Du=ws.useCallback(()=>{if($e.current==="processing"&&je?.id){if(!X.current){E("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Oe(),N.current=0,C.current&&(clearTimeout(C.current),C.current=null),na(je.id);}},[Oe,E,na,je?.id]),Oi=ws.useCallback(async P=>{k(true),Oe(),m("");try{m("Confirming purchase...");let M=await Je(fe=>vm(P,fe));kt(M),f("processing"),m(""),na(M.id);}finally{k(false);}},[Oe,na,Je]),Cl=ws.useRef(false),Vu=ws.useCallback(async()=>{if(!(!je||Cl.current)){Cl.current=true;try{k(!0),Oe(),m("Refreshing quote...");let P=await Je(M=>dp(je.id,M));kt(P),await Oi(P.id);}catch{E("session_error","Something went wrong. Please try again."),f("quote");}finally{k(false),Cl.current=false;}}},[Oe,E,Oi,je,Je]),ge=ws.useCallback(async(P=false,M,fe)=>{let Le=M??Be;if(!Le||isNaN(Number(Le))||Number(Le)<=0){E("validation_error","Please enter a valid amount.");return}M&&Nt(M),k(true),Oe(),m("");try{let Pe=await Me();if(Pe.error){E("configuration_error",Pe.error.message,Pe.error.code);return}let yt;if(fe)yt=fe;else if(P){if(!e?.merchantIdentifier?.trim()){E("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),f("session_params");return}m("Opening Apple Pay...");let Vt={applePay:{merchantCountryCode:"US",currencyCode:he.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ht.toUpperCase()} purchase + fees`,amount:Le}]}},Hr=await h("PlatformPay",Vt);if(Hr?.error){let eo=Hr.error.message??"",un=Hr.error.code??"";/cancel/i.test(eo)||/cancel/i.test(un)||(E("payment_error",eo,un),f("session_params"));return}if(!Hr?.displayData)return;m("Creating payment token...");let lo=await T();if(lo?.error){E("payment_error",lo.error.message,lo.error.code),f("session_params");return}yt=lo.cryptoPaymentToken;}else {m("Select a payment method...");let Vt=await h("Card");if(Vt?.error){let lo=Vt.error.message??"",eo=Vt.error.code??"";/cancel/i.test(lo)||/cancel/i.test(eo)||(E("payment_error",lo,eo),f("session_params"));return}if(!Vt?.displayData)return;m("Creating payment token...");let Hr=await T();if(Hr?.error){E("payment_error",Hr.error.message,Hr.error.code),f("session_params");return}yt=Hr.cryptoPaymentToken;}m("Creating onramp session...");let xt=De.current||He;if(!xt){E("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let gr=await Je(Vt=>xm({cryptoCustomerId:G.current,paymentToken:yt,sourceAmount:Number(Le),sourceCurrency:he,destinationCurrency:ht,walletAddress:xt,destinationNetwork:Ve},Vt));kt(gr),m(""),P?await Oi(gr.id):f("quote");}catch{E("session_error","Something went wrong. Please try again."),f("session_params");}finally{k(false),m("");}},[Oe,Me,h,T,ht,E,Oi,Nt,Be,he,He,Ve,Je,e?.merchantIdentifier]),Ze=ws.useCallback(async()=>{k(true),Oe(),m("Select a payment method...");try{let P=await Me();if(P.error)return E("configuration_error",P.error.message,P.error.code),null;let M=await h("Card");if(M?.error?.message&&(/no active link consumer/i.test(M.error.message)||/not be verified/i.test(M.error.message))){if(!await ks())return E("authorization_error","Please verify your identity to add a payment method."),null;M=await h("Card");}if(M?.error){let yt=M.error.message??"",xt=M.error.code??"";return /cancel/i.test(yt)||/cancel/i.test(xt)||E("payment_error",yt,xt),null}if(!M?.displayData)return null;let Le=M.displayData;m("Saving payment method...");let Pe=await T();return Pe?.error?(E("payment_error",Pe.error.message,Pe.error.code),null):{token:Pe.cryptoPaymentToken,sublabel:Le.sublabel??""}}catch(P){return E("session_error",P?.message??String(P)),null}finally{k(false),m("");}},[Oe,Me,h,T,E,ks]),xr=ws.useCallback(async()=>{if(je){k(true),Oe(),m("");try{let P=await Je(M=>dp(je.id,M));kt(P);}catch{E("session_error","Something went wrong. Please try again.");}finally{k(false);}}},[Oe,E,je,Je]),In=ws.useCallback(()=>{O.current=true,N.current=0,C.current&&(clearTimeout(C.current),C.current=null),f(r),k(false),w(false),m(""),S(null),D(e?.email??""),lt.current=e?.email??"",V(e?.phone??""),W(""),Z("US"),ne(""),G.current="",K(""),X.current="",de.current="",te(false),rt(false),Ee.current=null,Qe(P=>P+1),er(_p),ve(""),De.current="",qe.current=false,ye(stripeReactNative.Onramp.CryptoNetwork.ethereum),Nt(e?.defaultSourceAmount??"100"),st(e?.defaultSourceCurrency??"usd"),tr(e?.defaultDestinationCurrency??"usdc"),ut(""),Re(void 0),$(void 0),kt(null),Ue.current+=1,se.current=false,Fe.current=false,Ne.current=false;},[e,r]),Oc=ws.useCallback(()=>{xs.current=true,f("kyc_offer");},[]),Li=ws.useCallback(async()=>{await Sa(),qi=null,Se.current=null,Ip=true,ot.current=true,O.current=true,N.current=0,C.current&&(clearTimeout(C.current),C.current=null),Ue.current+=1,se.current=false,Fe.current=false,Ne.current=false,X.current="",de.current="",G.current="",De.current="",qe.current=false,Ee.current=null,K(""),ne(""),D(e?.email??""),lt.current=e?.email??"",V(e?.phone??""),W(""),Z("US"),kt(null),S(null),k(false),w(false),m(""),er(_p),ve(""),te(false),rt(false),Qe(P=>P+1),ut(""),Re(void 0),$(void 0),f(r);},[e?.email,e?.phone,r]);return {step:d,restoring:b,loading:x,status:I,error:u,email:y,phone:B,fullName:F,country:U,customerId:le,accessToken:ze,session:je,kycData:dt,walletAddress:He,resolvedRecipientAddress:nt,walletNetwork:Ve,sourceAmount:Be,sourceCurrency:he,destinationCurrency:ht,tokenIconUrl:Xe,networkIconUrl:Ye,applePaySupported:Te,walletReady:q,walletLoading:xe,setStep:f,setStatus:m,setEmail:D,setPhone:V,setFullName:W,setCountry:Z,setWalletAddress:ve,setWalletNetwork:ye,setSourceAmount:Nt,setSourceCurrency:st,setDestinationCurrency:tr,checkEmail:St,register:wo,attachKyc:Fc,verifyIdentity:Dc,requestKYCUpgrade:Oc,kycUpgradeMode:xs,logout:Li,registerWallet:Vc,collectPaymentMethod:ge,addPaymentMethod:Ze,refreshQuote:xr,confirmCheckout:Vu,reset:In,clearError:Oe,emitComplete:rr,resumeFulfillmentPolling:Du,amountFirst:t,switchingAccount:R}}function jm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Vn(),{colors:a,fonts:l,components:c}=L(),p=c.input.placeholderColor,[h,T]=ws.useState(e.dobMonth??""),[d,f]=ws.useState(e.dobDay??""),[b,v]=ws.useState(e.dobYear??""),[x,k]=ws.useState(e.idNumber??""),[R,w]=ws.useState(null),I=ws.useRef(null),m=ws.useRef(null),u=ws.useRef(null),S=h.length===2&&d.length===2&&b.length===4&&x.trim().length>0,y=()=>{if(!S)return;let B=parseInt(h,10),V=parseInt(d,10),F=parseInt(b,10),W=new Date().getFullYear();if(B<1||B>12){w("Please enter a valid month (01\u201312).");return}if(V<1||V>31){w("Please enter a valid day (01\u201331).");return}if(F<1900||F>W){w(`Please enter a valid year (1900\u2013${W}).`);return}w(null),o({dobMonth:h,dobDay:d,dobYear:b,idNumber:x});},D=R||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(nr,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Bt,{style:i.form.flex,contentContainerStyle:Wn.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:Wn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:Wn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:Wn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,Wn.dobInput],placeholder:"MM",placeholderTextColor:p,value:h,onChangeText:B=>{let V=B.replace(/\D/g,"").slice(0,2);T(V),V.length===2&&I.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Wn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:I,style:[i.form.input,Wn.dobInput],placeholder:"DD",placeholderTextColor:p,value:d,onChangeText:B=>{let V=B.replace(/\D/g,"").slice(0,2);f(V),V.length===2&&m.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Wn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:m,style:[i.form.input,Wn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:b,onChangeText:B=>{let V=B.replace(/\D/g,"").slice(0,4);v(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Wn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:x,onChangeText:k,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:y,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."})]}),D?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:D}):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(vt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!S&&i.form.continueBtnDisabled],onPress:y,disabled:!S,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!S&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Wn=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 $m({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ws.useRef(new reactNative.Animated.Value(.3)).current;return ws.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:[Ht.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:Ht.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Ht.skeletonLine,{width:"60%"}]})]})}function qm({onRefresh:e,colors:t,fonts:r}){let[o,n]=ws.useState(10),s=ws.useRef(null);ws.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=ws.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:Ht.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(ca,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[Ht.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function Ym({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:h=false,canPurchase:T=false,currentLimit:d}){let f=Vn(),{colors:b,fonts:v,components:x}=L(),k=[Ht.card,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius??12,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],R=[...k,{opacity:.5}],w=l==="verified",I=l==="pending",m=l==="rejected",u=c==="verified",S=c==="pending",y=w&&u,D=!w,B=!u,V=w,F=(T||w)&&!y,W=U=>`$${U.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:f.form.screen,children:[jsxRuntime.jsx(nr,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Ht.content,children:[d!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[Ht.limitBadge,{backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth,borderRadius:x.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ht.limitLabel,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ht.limitValue,{color:b.foreground,fontFamily:v.semibold}],children:[W(d)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ht.subtitle,{color:b.foregroundMuted,fontFamily:v.regular}],children:i?"Checking your verification status...":y?"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($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth}),jsxRuntime.jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&(I?jsxRuntime.jsxs(reactNative.View,{style:k,children:[jsxRuntime.jsxs(reactNative.View,{style:Ht.pendingHeader,children:[jsxRuntime.jsx(To,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(qm,{onRefresh:n,colors:b,fonts:v}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ht.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(vt,{size:18,strokeWidth:2,gradientFrom:b.primary,gradientTo:b.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[k,Ht.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(To,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ht.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold}],children:m?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:m?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Wr,{size:18,color:b.foregroundMuted,strokeWidth:2})]})),B&&(S?jsxRuntime.jsxs(reactNative.View,{style:k,children:[jsxRuntime.jsxs(reactNative.View,{style:Ht.pendingHeader,children:[jsxRuntime.jsx(Wc,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(qm,{onRefresh:n,colors:b,fonts:v}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ht.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(vt,{size:18,strokeWidth:2,gradientFrom:b.primary,gradientTo:b.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[k,Ht.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Wc,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ht.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Wr,{size:18,color:b.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[R,Ht.cardRow],children:[jsxRuntime.jsx(Wc,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ht.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardTitle,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ht.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:Ht.loaderRow,children:[jsxRuntime.jsx(vt,{size:24,strokeWidth:2,gradientFrom:b.primary,gradientTo:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):y?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.continueBtnText,children:"Done"})}):F?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Ht=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 fd={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 Zm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=L(),a=[wn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:wn.logoRow,children:jsxRuntime.jsx(nm,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:wn.scroll,contentContainerStyle:wn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[wn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[wn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[wn.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:[wn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[wn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[wn.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(fd.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(fd.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(fd.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(fd.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:wn.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 wn=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 Xm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=L();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(vt,{size:56,strokeWidth:3}),jsxRuntime.jsx(ko,{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(nr,{onPress:c}),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(vt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.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(ko,{error:n,progress:s,loading:o})]})]})})}function th({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{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(vt,{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(ko,{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 oh({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:h}=L(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx(nr,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:Zc}),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(vt,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.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(ed,{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(ko,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function nh({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=L(),h=t.transaction_details,T=Jc(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{onPress:c??l,title:"Review your purchase",variant:c?"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(ya,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(gn,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(gn,{quote:e.quote,label:"You receive",value:`${T} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(gn,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(gn,{quote:e.quote,label:"Transaction fee",value:`$${h.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(vt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.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(ko,{error:o,progress:n,loading:r})]})]})}function ih({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:c}){let p=L(),{colors:h,fonts:T,components:d}=p,[f,b]=ws.useState("");ws.useEffect(()=>{if(t)return;let k=f?`+1${f}`:"";a(k);},[f,a,t]);let v=ws.useCallback(k=>{b(k.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(vt,{size:56,strokeWidth:3}),jsxRuntime.jsx(ko,{error:o,progress:n,loading:r})]})]});let x=f.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(nr,{onPress:c}),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:ql.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[ql.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:ql.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[ql.dialCode,{color:h.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,ql.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:v,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>x&&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(vt,{size:28,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!x&&e.form.continueBtnDisabled],onPress:l,disabled:!x,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!x&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(ko,{error:o,progress:n,loading:r})]})]})})}var ql=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 ow({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=L(),n=e.toLowerCase(),s=Xc[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:[Un.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[Un.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Un.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(pt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function sh({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:c}=L(),p=t.transaction_details,h=Jc(p.destination_amount,p.destination_currency),T=r||o||"";ga(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Bt,{style:e.form.flex,contentContainerStyle:Un.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Un.iconSection,children:[jsxRuntime.jsx(ow,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Un.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Un.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Un.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Un.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(ed,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.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},Un.detailCard],children:[jsxRuntime.jsx(gn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(gn,{quote:e.quote,label:"You Received",value:`${h} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(gn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(gn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(ap,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(ap,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(gn,{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 Un=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 ah({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:h}){let{colors:T,components:d}=L();if(t){let f=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(nr,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!f&&jsxRuntime.jsx(vt,{size:56,strokeWidth:3}),jsxRuntime.jsx(ko,{error:o,progress:n,loading:r})]}),f&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,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(nr,{onPress:h}),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:d.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:Gc.map(f=>{let b=i===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,b&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(f.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,b&&e.wallet.rowTextSelected],children:f.label}),b&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(pt,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},f.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(vt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(ko,{error:o,progress:n,loading:r})]})]})})}function Cd({config:e,onClose:t}){let r=L(),o=Vn(),{step:n,restoring:s,loading:i,status:a,error:l,email:c,phone:p,session:h,kycData:T,walletAddress:d,resolvedRecipientAddress:f,walletNetwork:b,sourceAmount:v,sourceCurrency:x,destinationCurrency:k,tokenIconUrl:R,networkIconUrl:w,applePaySupported:I,setStep:m,setEmail:u,setPhone:S,setWalletAddress:y,setWalletNetwork:D,setSourceAmount:B,setDestinationCurrency:V,checkEmail:F,register:W,attachKyc:U,verifyIdentity:Z,registerWallet:le,collectPaymentMethod:ne,addPaymentMethod:ze,confirmCheckout:K,reset:de,emitComplete:X,resumeFulfillmentPolling:G,amountFirst:q,customerId:te,accessToken:xe,requestKYCUpgrade:rt,kycUpgradeMode:Ue,logout:se,clearError:Fe,switchingAccount:Ne}=dd(e),ot=!!e?.email&&!Ne,lt=!!e?.phone,qe=!!e?.publishableKey&&!!e?.externalUserId,[Ee,De]=ws.useState(void 0),[_e,Se]=ws.useState(void 0),[Ge,Qe]=ws.useState([]),[dt,er]=ws.useState(false),[He,ve]=ws.useState(false),[nt,ut]=ws.useState(null),[Ve,ye]=ws.useState(null),[Be,Nt]=ws.useState(null),[he,st]=ws.useState(false),ht=ws.useCallback(async()=>{await se(),t?.();},[se,t]);ws.useEffect(()=>{n!=="kyc_offer"||!te||!xe||(st(true),si(te,xe).then(Re=>{let Ye=Re.kyc_tiers??[],$=Ye.find(C=>C.tier==="l0"),Te=Ye.find(C=>C.tier==="l1"),_=Ye.find(C=>C.tier==="l2");$?.verification_status&&ut($.verification_status),Te?.verification_status&&ye(Te.verification_status),_?.verification_status&&Nt(_.verification_status);}).catch(Re=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",Re?.message);}).finally(()=>st(false)),d&&up({destinationNetwork:b||"ethereum",walletAddress:d,accessToken:xe,cryptoCustomerId:te}).then(Re=>{let Ye=Re.limits?.usd;if(Ye?.card?.length){let $=Math.max(...Ye.card.map(Te=>Te.limit));De($);}}).catch(Re=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",Re?.message);}));},[n,te,xe,d,b]),ws.useEffect(()=>{if(s||n!=="session_params"||!te||!xe)return;let Re=$=>{let Te=$?.message??"";return Te.includes("stripe_onramp_forbidden")||Te.includes("403")},Ye=$=>{Re($)&&ht();};si(te,xe).then($=>{let Te=$.kyc_tiers??[],_=Te.find(j=>j.tier==="l0"),C=Te.find(j=>j.tier==="l1"),O=Te.find(j=>j.tier==="l2"),N=!!C?.verification_status&&C.verification_status!=="not_started",H=O?.verification_status==="verified";er(N),ve(!!H),_?.verification_status&&ut(_.verification_status),C?.verification_status&&ye(C.verification_status),O?.verification_status&&Nt(O.verification_status);}).catch($=>{console.warn("[OnrampScreen] customer fetch error:",$?.message),Ye($);}),pp(te,xe).then($=>{Qe($.data??[]);}).catch($=>{console.warn("[OnrampScreen] payment_tokens error:",$?.message),Ye($);}),d&&up({destinationNetwork:b||"ethereum",walletAddress:d,accessToken:xe,cryptoCustomerId:te}).then($=>{let Te=$.limits?.usd;if(Te?.card?.length){let _=Math.max(...Te.card.map(C=>C.limit));De(_);}}).catch($=>{console.warn("[OnrampScreen] transaction_limits error:",$?.message),Ye($);}),Dl(e?.publishableKey).then($=>{let Te=$.data?.find(_=>_.currency_code==="usd");Te&&Se(Te.minimum_amount);}).catch($=>{console.warn("[OnrampScreen] fiat_currencies error:",$?.message);});},[s,n,te,xe,d,b,de,ht]);let tr=async()=>{if(!(!te||!xe))try{let Re=await pp(te,xe);Qe(Re.data??[]);}catch(Re){console.warn("[OnrampScreen] payment_tokens refresh error:",Re?.message);let Ye=Re?.message??"";(Ye.includes("stripe_onramp_forbidden")||Ye.includes("403"))&&ht();}},je=async()=>{let Re=await ze();return Re&&await tr(),Re},kt=e?.skipSuccessConfirmation===true;ws.useEffect(()=>{n==="success"&&kt&&h&&(X(h),de(),t?.());},[n,kt,h,X,de,t]),ws.useEffect(()=>{n==="register"&&lt&&W();},[n,lt,W]);let Xe=()=>{de(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[dw.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(vt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Zm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>m("register"),onClose:()=>m("email")});if(n==="email")return jsxRuntime.jsx(Xm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:ot,loading:i,error:l,status:a,email:c,setEmail:u,checkEmail:F,onClose:Xe});if(n==="register")return jsxRuntime.jsx(ih,{styles:o,hasPrefilledPhone:lt,loading:i,error:l,status:a,email:c,phone:p,setPhone:S,register:W,onClose:Xe});if(n==="kyc")return jsxRuntime.jsx(cd,{initialData:T,loading:i,onComplete:U,onCancel:Xe});if(n==="kyc_offer"){let $=nt==="verified"||Ve==="verified"||Be==="verified",Te=()=>{Ue.current&&(Ue.current=false),m("session_params");};return jsxRuntime.jsx(Ym,{onSelectL1:()=>m("kyc_l1"),onSelectL2:()=>{Ue.current=true,m("identity");},onSkip:Te,onClose:()=>{Ue.current?(Ue.current=false,m("session_params")):$?Te():Xe();},onRefresh:()=>{!te||!xe||(st(true),si(te,xe).then(O=>{let N=O.kyc_tiers??[],H=N.find($e=>$e.tier==="l0"),j=N.find($e=>$e.tier==="l1"),pe=N.find($e=>$e.tier==="l2");H?.verification_status&&ut(H.verification_status),j?.verification_status&&ye(j.verification_status),pe?.verification_status&&Nt(pe.verification_status);}).catch(O=>{console.warn("[OnrampScreen] refresh customer fetch error:",O?.message);}).finally(()=>st(false)));},loading:i,loadingTiers:he,error:l?.message,l1Status:Ve??"not_started",l2Status:Be??"not_started",l1Completed:dt,l2Completed:He,canPurchase:$,currentLimit:$?Ee:void 0})}if(n==="kyc_l1"){let Re=Ue.current?"session_params":"wallet";return jsxRuntime.jsx(jm,{initialData:T,loading:i,error:l?.message,onComplete:Ye=>{Ue.current&&(Ue.current=false),U(Ye,Re);},onCancel:()=>{Fe(),m("kyc_offer");},onClose:Xe})}return n==="identity"?jsxRuntime.jsx(th,{styles:o,loading:i,status:a,error:l,verifyIdentity:Z,onClose:()=>{Ue.current?(Ue.current=false,m("session_params")):Xe();}}):n==="wallet"?jsxRuntime.jsx(ah,{styles:o,hasAutoWallet:qe,loading:i,error:l,status:a,walletAddress:d,walletNetwork:b,setWalletAddress:y,setWalletNetwork:D,setDestinationCurrency:V,registerWallet:le,onClose:Xe}):n==="session_params"?jsxRuntime.jsx(ld,{initialAmount:v,currency:x,applePaySupported:I,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:_e,maxAmount:Ee,paymentTokens:Ge,onAddPaymentMethod:je,onCollectPayment:(Re,Ye)=>{ne(Re,Ye);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(Re,Ye)=>{if(q&&!te)B(Re),m("email");else {let $=Ye==="apple_pay";ne($,Re,!$&&Ye?Ye:void 0);}},onCancel:Xe,accessToken:xe,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:ht,onRequestKYC:rt,showSwitchAccount:!ot,inputDisabled:(nt!==null||Ve!==null)&&nt!=="verified"&&Ve!=="verified"&&Be!=="verified"}):n==="quote"&&h?jsxRuntime.jsx(nh,{styles:o,session:h,loading:i,error:l,status:a,confirmCheckout:K,tokenIconUrl:R,networkIconUrl:w,onClose:Xe,onBack:()=>m("session_params")}):n==="processing"?jsxRuntime.jsx(oh,{styles:o,error:l,status:a,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??k,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:R,networkIconUrl:w,onClose:Xe,onRetryStatusCheck:G}):n==="success"&&h&&!kt?jsxRuntime.jsx(sh,{styles:o,session:h,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:R,networkIconUrl:w,onDone:()=>{X(h),de(),t?.();}}):null}var dw=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function lh(){try{let e=uw__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 wd({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:h,onClose:T,merchantIdentifier:d="",urlScheme:f="unifoldOnramp",paymentSelectorPosition:b,skipSuccessConfirmation:v=false,appName:x}){let{colors:k,fonts:R,components:w}=L(),I=e||Hc(),m=ws.useMemo(()=>{let V=d.trim();return V.length>0?V:lh()??""},[d]),[u,S]=ws.useState("loading"),[y,D]=ws.useState(null);ws.useEffect(()=>{let V=false;async function F(){try{I&&(td(I),rd(Fl()));let W=await od();if(V)return;let U=m.trim();if(await stripeReactNative.initStripe({publishableKey:W,urlScheme:f,...U?{merchantIdentifier:U}:{}}),V)return;S("ready");}catch(W){if(V)return;console.error("[StripeOnramp] Init failed:",W),D(W?.message??"Failed to load Stripe configuration"),S("error");}}return F(),()=>{V=true;}},[I,m,f]);let B=ws.useMemo(()=>{let V={publishableKey:I,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:c,onError:p,onStepChange:h};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),b&&(V.paymentSelectorPosition=b),V.skipSuccessConfirmation=v,V.merchantIdentifier=m,x&&(V.merchantDisplayName=x),V},[I,o,s,i,a,l,t,r,n,b,v,m,x,c,p,h]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[Ia.centered,{backgroundColor:k.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ia.errorText,{color:k.error,fontFamily:R.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[Ia.errorDetail,{color:k.foregroundMuted,fontFamily:R.regular}],children:y}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ia.retryBtn,{backgroundColor:w.button.primaryBackground,borderRadius:w.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[Ia.retryBtnText,{color:w.button.primaryText,fontFamily:R.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[Ia.centered,{backgroundColor:k.background}],children:jsxRuntime.jsx(vt,{size:56,strokeWidth:3,gradientFrom:k.primary,gradientTo:k.primary})}):jsxRuntime.jsx(Cd,{config:B,onClose:T})}var Ia=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 ph(){let{configure:e}=stripeReactNative.useOnramp(),t=ws.useRef(false);return ws.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 fh="__unifold_stripe_onramp__";function Sd(e){globalThis[fh]=e;}function mh(){return globalThis[fh]}Sd(wd);var Gi=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 Vs,Yi,_a,hh,ww=(hh=class extends Gi{constructor(){super();re(this,Vs);re(this,Yi);re(this,_a);z(this,_a,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,Yi)||this.setEventListener(g(this,_a));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Yi))==null||t.call(this),z(this,Yi,void 0));}setEventListener(t){var r;z(this,_a,t),(r=g(this,Yi))==null||r.call(this),z(this,Yi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Vs)!==t&&(z(this,Vs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Vs)=="boolean"?g(this,Vs):globalThis.document?.visibilityState!=="hidden"}},Vs=new WeakMap,Yi=new WeakMap,_a=new WeakMap,hh),Td=new ww;var Sw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Nn,Os,gh,Tw=(gh=class{constructor(){re(this,Nn,Sw);re(this,Os,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Os)&&e!==g(this,Nn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Nn),provider:e}),z(this,Nn,e),process.env.NODE_ENV!=="production"&&z(this,Os,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,Os,true),g(this,Nn).setTimeout(e,t)}clearTimeout(e){g(this,Nn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,Os,true),g(this,Nn).setInterval(e,t)}clearInterval(e){g(this,Nn).clearInterval(e);}},Nn=new WeakMap,Os=new WeakMap,gh),Ql=new Tw;function yh(e){setTimeout(e,0);}var wh=typeof window>"u"||"Deno"in globalThis;function Oo(){}function Sh(e,t){return typeof e=="function"?e(t):e}function Th(e){return typeof e=="number"&&e>=0&&e!==1/0}function kh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Kl(e,t){return typeof e=="function"?e(t):e}function xh(e,t){return typeof e=="function"?e(t):e}function Lp(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Gl(i,t.options))return false}else if(!Da(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 Bp(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Pa(t.options.mutationKey)!==Pa(s))return false}else if(!Da(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Gl(e,t){return (t?.queryKeyHashFn||Pa)(e)}function Pa(e){return JSON.stringify(e,(t,r)=>Op(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Da(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Da(e[r],t[r])):false}var kw=Object.prototype.hasOwnProperty;function Vp(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=bh(e)&&bh(t);if(!o&&!(Op(e)&&Op(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):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:kw.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=Vp(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function bh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Op(e){if(!Ch(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Ch(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ch(e){return Object.prototype.toString.call(e)==="[object Object]"}function vh(e){return new Promise(t=>{Ql.setTimeout(t,e);})}function Rh(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 Vp(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 Vp(e,t)}return t}function Ih(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function _h(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Fa=Symbol();function kd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Fa&&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===Fa?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ph(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 xd=(()=>{let e=()=>wh;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Fh(){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 xw=yh;function vw(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=xw,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 qr=vw();var Va,Ji,Oa,Dh,Rw=(Dh=class extends Gi{constructor(){super();re(this,Va,true);re(this,Ji);re(this,Oa);z(this,Oa,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(){g(this,Ji)||this.setEventListener(g(this,Oa));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Ji))==null||t.call(this),z(this,Ji,void 0));}setEventListener(t){var r;z(this,Oa,t),(r=g(this,Ji))==null||r.call(this),z(this,Ji,t(this.setOnline.bind(this)));}setOnline(t){g(this,Va)!==t&&(z(this,Va,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,Va)}},Va=new WeakMap,Ji=new WeakMap,Oa=new WeakMap,Dh),La=new Rw;function Iw(e){return Math.min(1e3*2**e,3e4)}function Ap(e){return (e??"online")==="online"?La.isOnline():true}var vd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Rd(e){let t=false,r=0,o,n=Fh(),s=()=>n.status!=="pending",i=b=>{if(!s()){let v=new vd(b);T(v),e.onCancel?.(v);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>Td.isFocused()&&(e.networkMode==="always"||La.isOnline())&&e.canRun(),p=()=>Ap(e.networkMode)&&e.canRun(),h=b=>{s()||(o?.(),n.resolve(b));},T=b=>{s()||(o?.(),n.reject(b));},d=()=>new Promise(b=>{o=v=>{(s()||c())&&b(v);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),f=()=>{if(s())return;let b,v=r===0?e.initialPromise:void 0;try{b=v??e.fn();}catch(x){b=Promise.reject(x);}Promise.resolve(b).then(h).catch(x=>{if(s())return;let k=e.retry??(xd.isServer()?0:3),R=e.retryDelay??Iw,w=typeof R=="function"?R(r,x):R,I=k===true||typeof k=="number"&&r<k||typeof k=="function"&&k(r,x);if(t||!I){T(x);return}r++,e.onFail?.(r,x),vh(w).then(()=>c()?void 0:d()).then(()=>{t?T(x):f();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():d().then(f),n)}}var Ls,Vh,Id=(Vh=class{constructor(){re(this,Ls);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Th(this.gcTime)&&z(this,Ls,Ql.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(xd.isServer()?1/0:300*1e3));}clearGcTimeout(){g(this,Ls)!==void 0&&(Ql.clearTimeout(g(this,Ls)),z(this,Ls,void 0));}},Ls=new WeakMap,Vh);function Lh(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,c=async()=>{let p=false,h=f=>{Ph(f,()=>t.signal,()=>p=true);},T=kd(t.options,t.fetchOptions),d=async(f,b,v)=>{if(p)return Promise.reject(t.signal.reason);if(b==null&&f.pages.length)return Promise.resolve(f);let k=(()=>{let m={client:t.client,queryKey:t.queryKey,pageParam:b,direction:v?"backward":"forward",meta:t.options.meta};return h(m),m})(),R=await T(k),{maxPages:w}=t.options,I=v?_h:Ih;return {pages:I(f.pages,R,w),pageParams:I(f.pageParams,b,w)}};if(n&&s.length){let f=n==="backward",b=f?_w:Oh,v={pages:s,pageParams:i},x=b(o,v);a=await d(v,x,f);}else {let f=e??s.length;do{let b=l===0?i[0]??o.initialPageParam:Oh(o,a);if(l>0&&b==null)break;a=await d(a,b),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Oh(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 _w(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ba,Bs,Aa,sn,As,io,Yl,Ws,qo,Mh,ui,Wh,Eh=(Wh=class extends Id{constructor(t){super();re(this,qo);re(this,Ba);re(this,Bs);re(this,Aa);re(this,sn);re(this,As);re(this,io);re(this,Yl);re(this,Ws);z(this,Ws,false),z(this,Yl,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,As,t.client),z(this,sn,g(this,As).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Bs,Ah(this.options)),this.state=t.state??g(this,Bs),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return g(this,Ba)}get promise(){return g(this,io)?.promise}setOptions(t){if(this.options={...g(this,Yl),...t},t?._type&&z(this,Ba,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Ah(this.options);r.data!==void 0&&(this.setState(Bh(r.data,r.dataUpdatedAt)),z(this,Bs,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,sn).remove(this);}setData(t,r){let o=Rh(this.state.data,t,this.options);return Tt(this,qo,ui).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){Tt(this,qo,ui).call(this,{type:"setState",state:t});}cancel(t){let r=g(this,io)?.promise;return g(this,io)?.cancel(t),r?r.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return g(this,Bs)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>xh(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fa||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Kl(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:!kh(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),g(this,io)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),g(this,io)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,sn).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(g(this,io)&&(g(this,Ws)||Tt(this,qo,Mh).call(this)?g(this,io).cancel({revert:true}):g(this,io).cancelRetry()),this.scheduleGc()),g(this,sn).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Tt(this,qo,ui).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&g(this,io)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(g(this,io))return g(this,io).continueRetry(),g(this,io).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.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=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(z(this,Ws,true),o.signal)});},s=()=>{let c=kd(this.options,r),h=(()=>{let T={client:g(this,As),queryKey:this.queryKey,meta:this.meta};return n(T),T})();return z(this,Ws,false),this.options.persister?this.options.persister(c,h,this):c(h)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:g(this,As),state:this.state,fetchFn:s};return n(c),c})();(g(this,Ba)==="infinite"?Lh(this.options.pages):this.options.behavior)?.onFetch(a,this),z(this,Aa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Tt(this,qo,ui).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),z(this,io,Rd({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof vd&&c.revert&&this.setState({...g(this,Aa),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{Tt(this,qo,ui).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{Tt(this,qo,ui).call(this,{type:"pause"});},onContinue:()=>{Tt(this,qo,ui).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await g(this,io).start();if(c===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(c),g(this,sn).config.onSuccess?.(c,this),g(this,sn).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof vd){if(c.silent)return g(this,io).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw Tt(this,qo,ui).call(this,{type:"error",error:c}),g(this,sn).config.onError?.(c,this),g(this,sn).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Ba=new WeakMap,Bs=new WeakMap,Aa=new WeakMap,sn=new WeakMap,As=new WeakMap,io=new WeakMap,Yl=new WeakMap,Ws=new WeakMap,qo=new WeakSet,Mh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ui=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,...Pw(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Bh(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return z(this,Aa,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),qr.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),g(this,sn).notify({query:this,type:"updated",action:t});});},Wh);function Pw(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ap(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Bh(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Ah(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 Jl,Hn,go,Es,jn,Zi,zh,Uh=(zh=class extends Id{constructor(t){super();re(this,jn);re(this,Jl);re(this,Hn);re(this,go);re(this,Es);z(this,Jl,t.client),this.mutationId=t.mutationId,z(this,go,t.mutationCache),z(this,Hn,[]),this.state=t.state||Fw(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){g(this,Hn).includes(t)||(g(this,Hn).push(t),this.clearGcTimeout(),g(this,go).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){z(this,Hn,g(this,Hn).filter(r=>r!==t)),this.scheduleGc(),g(this,go).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){g(this,Hn).length||(this.state.status==="pending"?this.scheduleGc():g(this,go).remove(this));}continue(){return g(this,Es)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Tt(this,jn,Zi).call(this,{type:"continue"});},o={client:g(this,Jl),meta:this.options.meta,mutationKey:this.options.mutationKey};z(this,Es,Rd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{Tt(this,jn,Zi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{Tt(this,jn,Zi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,go).canRun(this)}));let n=this.state.status==="pending",s=!g(this,Es).canStart();try{if(n)r();else {Tt(this,jn,Zi).call(this,{type:"pending",variables:t,isPaused:s}),g(this,go).config.onMutate&&await g(this,go).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Tt(this,jn,Zi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await g(this,Es).start();return await g(this,go).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await g(this,go).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Tt(this,jn,Zi).call(this,{type:"success",data:i}),i}catch(i){try{await g(this,go).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 g(this,go).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 Tt(this,jn,Zi).call(this,{type:"error",error:i}),i}finally{g(this,go).runNext(this);}}},Jl=new WeakMap,Hn=new WeakMap,go=new WeakMap,Es=new WeakMap,jn=new WeakSet,Zi=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),qr.batch(()=>{g(this,Hn).forEach(o=>{o.onMutationUpdate(t);}),g(this,go).notify({mutation:this,type:"updated",action:t});});},zh);function Fw(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var pi,Sn,Zl,Nh,Hh=(Nh=class extends Gi{constructor(t={}){super();re(this,pi);re(this,Sn);re(this,Zl);this.config=t,z(this,pi,new Set),z(this,Sn,new Map),z(this,Zl,0);}build(t,r,o){let n=new Uh({client:t,mutationCache:this,mutationId:++wl(this,Zl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){g(this,pi).add(t);let r=_d(t);if(typeof r=="string"){let o=g(this,Sn).get(r);o?o.push(t):g(this,Sn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(g(this,pi).delete(t)){let r=_d(t);if(typeof r=="string"){let o=g(this,Sn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&g(this,Sn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=_d(t);if(typeof r=="string"){let n=g(this,Sn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=_d(t);return typeof r=="string"?g(this,Sn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){qr.batch(()=>{g(this,pi).forEach(t=>{this.notify({type:"removed",mutation:t});}),g(this,pi).clear(),g(this,Sn).clear();});}getAll(){return Array.from(g(this,pi))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Bp(r,o))}findAll(t={}){return this.getAll().filter(r=>Bp(t,r))}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return qr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Oo))))}},pi=new WeakMap,Sn=new WeakMap,Zl=new WeakMap,Nh);function _d(e){return e.options.scope?.id}var $n,jh,$h=(jh=class extends Gi{constructor(t={}){super();re(this,$n);this.config=t,z(this,$n,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Gl(n,r),i=this.get(s);return i||(i=new Eh({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){g(this,$n).has(t.queryHash)||(g(this,$n).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=g(this,$n).get(t.queryHash);r&&(t.destroy(),r===t&&g(this,$n).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){qr.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return g(this,$n).get(t)}getAll(){return [...g(this,$n).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Lp(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Lp(t,o)):r}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){qr.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){qr.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},$n=new WeakMap,jh);var Or,Xi,es,Wa,Ea,ts,Ma,za,qh,Wp=(qh=class{constructor(e={}){re(this,Or);re(this,Xi);re(this,es);re(this,Wa);re(this,Ea);re(this,ts);re(this,Ma);re(this,za);z(this,Or,e.queryCache||new $h),z(this,Xi,e.mutationCache||new Hh),z(this,es,e.defaultOptions||{}),z(this,Wa,new Map),z(this,Ea,new Map),z(this,ts,0);}mount(){wl(this,ts)._++,g(this,ts)===1&&(z(this,Ma,Td.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onFocus());})),z(this,za,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onOnline());})));}unmount(){var e,t;wl(this,ts)._--,g(this,ts)===0&&((e=g(this,Ma))==null||e.call(this),z(this,Ma,void 0),(t=g(this,za))==null||t.call(this),z(this,za,void 0));}isFetching(e){return g(this,Or).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Xi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=g(this,Or).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Kl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return g(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=g(this,Or).get(o.queryHash)?.state.data,i=Sh(t,s);if(i!==void 0)return g(this,Or).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return qr.batch(()=>g(this,Or).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state}removeQueries(e){let t=g(this,Or);qr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=g(this,Or);return qr.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=qr.batch(()=>g(this,Or).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Oo).catch(Oo)}invalidateQueries(e,t={}){return qr.batch(()=>(g(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=qr.batch(()=>g(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(Oo)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Oo)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=g(this,Or).build(this,t);return r.isStaleByTime(Kl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return La.isOnline()?g(this,Xi).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,Or)}getMutationCache(){return g(this,Xi)}getDefaultOptions(){return g(this,es)}setDefaultOptions(e){z(this,es,e);}setQueryDefaults(e,t){g(this,Wa).set(Pa(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...g(this,Wa).values()],r={};return t.forEach(o=>{Da(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){g(this,Ea).set(Pa(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...g(this,Ea).values()],r={};return t.forEach(o=>{Da(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...g(this,es).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Gl(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===Fa&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...g(this,es).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){g(this,Or).clear(),g(this,Xi).clear();}},Or=new WeakMap,Xi=new WeakMap,es=new WeakMap,Wa=new WeakMap,Ea=new WeakMap,ts=new WeakMap,Ma=new WeakMap,za=new WeakMap,qh);var Qh=ws__namespace.createContext(void 0);var Ep=({client:e,children:t})=>(ws__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(Qh.Provider,{value:e,children:t}));var Na=new Map;function Kh({width:e,height:t,borderRadius:r,color:o}){let n=ws.useRef(new reactNative.Animated.Value(.3)).current;return ws.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 xo({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=L(),[c,p]=ws.useState(false),[h,T]=ws.useState(false),[d,f]=ws.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let I=Na.get(e);return I?{uri:e,xml:I}:null}),b=e?.toLowerCase().endsWith(".svg"),v=b&&e&&d?.uri===e?d.xml:null;ws.useEffect(()=>{p(false),T(false);},[e]),ws.useEffect(()=>{if(!b||!e)return;if(Na.has(e)){f({uri:e,xml:Na.get(e)});return}let I=false;return fetch(e).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(m=>{I||(Na.set(e,m),f({uri:e,xml:m}));}).catch(()=>{I||p(true);}),()=>{I=true;}},[e,b]);let x=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:x},a]});let k={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},R=t-n*2,w=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[k,{backgroundColor:i||x}]}):b?jsxRuntime.jsxs(reactNative.View,{style:k,children:[!!!v&&jsxRuntime.jsx(Kh,{width:R,height:w,borderRadius:o,color:x}),v?jsxRuntime.jsx(sr.SvgXml,{xml:v,width:R,height:w,onError:()=>p(true)}):jsxRuntime.jsx(sr.SvgUri,{uri:e,width:R,height:w,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:k,children:[!h&&jsxRuntime.jsx(Kh,{width:R,height:w,borderRadius:o,color:x}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:R,height:w},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function ec(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Na.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Na.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Gr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:h,publishableKey:T,projectName:d,leftIcon:f,onLeftAction:b}){let{colors:v,fonts:x,components:k}=L(),[R,w]=ws.useState(null),[I,m]=ws.useState(false),u=ws.useState(()=>new reactNative.Animated.Value(0))[0];ws.useEffect(()=>{if(!I)return;let y=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return y.start(),()=>y.stop()},[I,u]),ws.useEffect(()=>{if(!a||!l||!c||!p||!h||!T){w(null),m(false);return}let y=false;return m(true),Kc(l,c,p,h,T).then(D=>{if(y)return;let B=D.balance,V=null;B&&(B.amount_usd!=null&&B.amount_usd!==""?V=`$${B.amount_usd}`:V="$0.00"),w(V);}).catch(()=>{y||w(null);}).finally(()=>{y||m(false);}),()=>{y=true;}},[a,l,c,p,h,T]);let S=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:yo.header,children:[jsxRuntime.jsx(reactNative.View,{style:yo.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tl,{size:20,color:k.header.buttonColor,strokeWidth:2})}):f&&b?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:b,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsxRuntime.jsx(reactNative.View,{style:yo.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:yo.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:yo.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yo.title,{color:k.header.titleColor,fontFamily:x.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[yo.titleBadge,{backgroundColor:v.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[yo.titleBadgeText,{color:v.foregroundMuted,fontFamily:x.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:t}):null,a&&(I?jsxRuntime.jsx(reactNative.Animated.View,{style:[yo.balanceSkeleton,{backgroundColor:v.cardHover,opacity:S}]}):R!=null?jsxRuntime.jsxs(reactNative.Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:[d?`${d} `:"","Balance: ",R]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:yo.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_t,{size:20,color:k.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:yo.spacer})})]})}var yo=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 Lr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=L(),a=s??i.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Zh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],h=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Zh.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:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Zh=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function tc({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:qn.wrapper,contentStyle:qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[qn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(zu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[qn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[qn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:qn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:qn.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[qn.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(xo,{uri:ie(p),width:20,height:20})},l.name)})})})]})}var qn=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 oc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:fi.wrapper,contentStyle:fi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:fi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[fi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(sa,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:fi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[fi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[fi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:fi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:fi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsxRuntime.jsx(xo,{uri:ie(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var fi=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 nc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card;return jsxRuntime.jsx(Lr,{cardTokens:i,onPress:e,style:mi.wrapper,contentStyle:mi.container,children:jsxRuntime.jsxs(reactNative.View,{style:mi.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[mi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(ho,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[mi.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[mi.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:mi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[mi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[mi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var mi=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 sc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=L(),s=n.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:e,style:Qn.wrapper,contentStyle:Qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ec,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Qn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Qn.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Qn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Qn=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 qw="#00D632";function ac({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=L(),s=n.depositMenu.card,[i,a]=ws.useState(false),l=or("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Lr,{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:i?jsxRuntime.jsx(reactNative.View,{style:[Kn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Kn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Kn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Kn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Kn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Kn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}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",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:qw,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function lc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:Gn.wrapper,contentStyle:Gn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Gn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Gn.iconContainer,{backgroundColor:i.iconBackgroundColor,borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(om,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Gn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Gn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Gn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:Gn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Gn.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Gn.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(xo,{uri:ie(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Gn=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},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});var Ns="#00D632",ag=5,Jw=[25,50,100,500],Qa=120,Zw=5e3,Xw=2e3,eS=300;function cc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function lg(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function tS(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function cg(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function rS(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function dg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function oS(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function nS(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function Ld({size:e,faded:t=false,withBackground:r=false}){let[o,n]=ws.useState(false),s=or("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Ns,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Ns}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Bd({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:h}=L();ws.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,d]=ws.useState("amountInput"),[f,b]=ws.useState("25"),[v,x]=ws.useState(null),[k,R]=ws.useState(null),[w,I]=ws.useState(true),[m,u]=ws.useState(null),[S,y]=ws.useState(false),[D,B]=ws.useState(null),[V,F]=ws.useState(Qa),[W,U]=ws.useState(null),[Z,le]=ws.useState(false),[ne,ze]=ws.useState("pending"),K=ws.useRef(null),de=ws.useRef(null),X=ws.useRef(null),G=ws.useRef("pending"),q=ws.useRef(null),te=ws.useRef("amountInput"),xe=ws.useRef(Qa),rt=ws.useRef(null),Ue=ws.useRef(null),se=ws.useRef(false),Fe=ws.useRef(true),Ne=k?.minimum_amount??ag,ot=k?.maximum_amount,lt=parseFloat(f)||0,qe=!isNaN(lt)&&lt>=Ne&&(ot==null||lt<=ot),Ee=ot?`$${cc(Ne)} \u2013 $${cc(ot)}`:`$${cc(Ne)} minimum`,De=T==="amountInput"?"Pay with Cash App":`Pay $${lg(f)} via Cash App`,_e=T==="waitingForPayment";ws.useEffect(()=>(Fe.current=true,I(true),Zu("usd",t).then(C=>{Fe.current&&R(C);}).catch(()=>{}).finally(()=>{Fe.current&&I(false);}),()=>{Fe.current=false,Ge();}),[t]);function Se(C,O=k){if(B(null),!C){x(null);return}let N=parseFloat(C);if(isNaN(N)){x("Enter a valid number");return}let H=O?.minimum_amount??ag,j=O?.maximum_amount;N<H?x(`$${cc(H)} minimum`):j!=null&&N>j?x(`$${cc(j)} maximum`):x(null);}function Ge(){K.current&&clearInterval(K.current),de.current&&clearInterval(de.current),X.current&&clearInterval(X.current),K.current=null,de.current=null,X.current=null;}function Qe(){Ge(),u(null),q.current=null,U(null),le(false),B(null),G.current="pending",ze("pending"),F(Qa),xe.current=Qa,rt.current=null,se.current=false,d("amountInput"),te.current="amountInput";}async function dt(){if(!(!qe||S)){y(true),B(null),Ge(),rt.current=null;try{let C=await Ju({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:f},t);q.current=C,G.current=C.status,u(C),y(!1),d("waitingForPayment"),te.current="waitingForPayment",er(),He(),reactNative.Linking.openURL(C.url).catch(()=>{});}catch(C){y(false),B(C instanceof Error?C.message:"Failed to create session");}}}function er(){xe.current=Qa,F(Qa),X.current&&clearInterval(X.current),X.current=setInterval(()=>{xe.current-=1,F(xe.current),xe.current<=0&&(clearInterval(X.current),X.current=null,G.current==="pending"&&(d("softExpired"),te.current="softExpired"));},1e3);}function He(){K.current&&clearInterval(K.current),K.current=setInterval(()=>{ve();},Zw);}async function ve(){if(!Fe.current)return;let C=q.current;if(!C)return;let O=C.external_id??C.id;try{let N=await Xu(O,t),H=G.current;switch(G.current=N.status,ze(N.status),N.status){case "processing":(te.current==="amountInput"||te.current==="softExpired"||te.current==="waitingForPayment")&&(d("paymentReceived"),te.current="paymentReceived",X.current&&(clearInterval(X.current),X.current=null));break;case "completed":K.current&&(clearInterval(K.current),K.current=null),X.current&&(clearInterval(X.current),X.current=null),H!=="completed"&&(d("paymentReceived"),te.current="paymentReceived",ut());break;case "failed":K.current&&(clearInterval(K.current),K.current=null),X.current&&(clearInterval(X.current),X.current=null),te.current!=="amountInput"&&(d("failed"),te.current="failed");break;case "expired":K.current&&(clearInterval(K.current),K.current=null),X.current&&(clearInterval(X.current),X.current=null),te.current!=="amountInput"&&(d("softExpired"),te.current="softExpired");break;default:break}}catch{}}let nt=6e5;function ut(){de.current&&clearInterval(de.current);let C=Date.now()+nt;de.current=setInterval(()=>{if(Date.now()>C){clearInterval(de.current),de.current=null;let O=G.current;O==="completed"||O==="processing"?(d("paymentReceived"),te.current="paymentReceived"):(d("failed"),te.current="failed");return}Ve();},Xw);}async function Ve(){if(Fe.current)try{let C=await hn(e,t,"deposit"),O=Date.now(),N=[...C.data].sort((pe,$e)=>{let A=pe.created_at?new Date(pe.created_at).getTime():0;return ($e.created_at?new Date($e.created_at).getTime():0)-A}),H=rt.current,j=H?N.find(pe=>pe.id===H):N.find(pe=>{if(!pe.created_at)return !1;let $e=new Date(pe.created_at).getTime();return O-$e<eS*1e3});j&&(rt.current||(rt.current=j.id),j.status==="succeeded"?(de.current&&(clearInterval(de.current),de.current=null),U(j),d("depositComplete"),te.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:j.id,transaction:j})):(j.status==="failed"||j.status==="refunded")&&(de.current&&(clearInterval(de.current),de.current=null),U(j),d("failed"),te.current="failed"));}catch{}}function ye(){if(T==="waitingForPayment"){X.current&&(clearInterval(X.current),X.current=null),d("amountInput"),te.current="amountInput";return}i();}function Be(){Ge(),a();}function Nt(){let C=q.current??m;C&&reactNative.Linking.openURL(C.url).catch(()=>{});}function he(C){let O=C.destination_amount_base_unit;if(!O)return "\u2014";let N=C.destination_token_metadata?.decimals??6;return tS(O,N)}function st(C){return rS(C.destination_currency)}function ht(C){let O=C.destination_token_metadata;return O?O.icon_urls&&O.icon_urls.length>0?Pn(O.icon_urls,"png")??O.icon_url??null:O.icon_url??null:null}function tr(){return jsxRuntime.jsxs(reactNative.View,{style:Y.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[Y.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function je(C,O){return jsxRuntime.jsxs(reactNative.View,{style:Y.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:C}),jsxRuntime.jsx(reactNative.Text,{style:[Y.detailValue,{color:c.foreground,fontFamily:p.medium}],children:O})]},C)}function kt(C,O,N){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Y.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(N).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.txLabel,{color:c.foreground,fontFamily:p.medium}],children:C}),jsxRuntime.jsxs(reactNative.View,{style:Y.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.txHash,{color:c.foregroundMuted}],children:O}),jsxRuntime.jsx(reactNative.Text,{style:[Y.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},C)}function Xe(){let C=Math.max(60-f.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:Y.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:Y.flex,contentContainerStyle:Y.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{se.current||(se.current=true,setTimeout(()=>Ue.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:Y.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.amountDollar,{color:c.foreground,fontSize:C}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ue,value:f,onChangeText:O=>{b(O),Se(O);},keyboardType:"decimal-pad",style:[Y.amountInput,{color:c.foreground,fontSize:C}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),v?jsxRuntime.jsx(reactNative.Text,{style:[Y.amountError,{color:c.warning,fontFamily:p.regular}],children:v}):w?jsxRuntime.jsx(reactNative.View,{style:[Y.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[Y.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Ee})]}),jsxRuntime.jsx(reactNative.View,{style:Y.quickAmountsRow,children:Jw.map(O=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Y.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let N=String(O);b(N),Se(N);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[Y.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",O]})},O))}),D&&jsxRuntime.jsxs(reactNative.View,{style:[Y.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:Y.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[Y.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:D})]})]}),jsxRuntime.jsx(reactNative.View,{style:Y.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius,opacity:!qe||S?.4:1}],onPress:dt,disabled:!qe||S,activeOpacity:.8,children:[S&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:Y.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:S?"Loading...":"Continue"})]})})]})}function Re(){return jsxRuntime.jsxs(reactNative.View,{style:Y.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.centeredContent,children:[jsxRuntime.jsx(Ld,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
+ This page will update automatically.`}),V>0&&jsxRuntime.jsxs(reactNative.Text,{style:[Y.expiryText,{color:V<=30?c.warning:c.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",nS(V)]})]}),jsxRuntime.jsx(reactNative.View,{style:Y.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Nt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:Y.cashAppButtonIcon,children:jsxRuntime.jsx(Ld,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function Ye(){let C=ne==="processing",O=C?"Payment processing":"Payment received",N=C?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:Y.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:Y.centeredContent,children:[jsxRuntime.jsx(vt,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(Ld,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:O}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:N})]})})}function $(){if(!W)return Ye();let C=W,O=["pending","waiting","delayed"].includes(C.status),N=ht(C),H=oS(C.created_at);return jsxRuntime.jsxs(reactNative.View,{style:Y.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:Y.flex,contentContainerStyle:Y.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:N?jsxRuntime.jsx(reactNative.Image,{source:{uri:N,cache:"force-cache"},style:Y.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[Y.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[Y.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[Y.statusBadge,{backgroundColor:O?c.warning:c.success}],children:jsxRuntime.jsx(reactNative.Text,{style:Y.statusBadgeText,children:O?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.statusDot,{backgroundColor:O?c.warning:c.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Y.statusText,{color:c.foreground,fontFamily:p.semibold}],children:O?"In Progress":"Completed"})]}),H?jsxRuntime.jsx(reactNative.Text,{style:[Y.dateText,{color:c.foregroundMuted,fontFamily:p.regular}],children:H}):null,jsxRuntime.jsxs(reactNative.View,{style:[Y.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[je("Amount Sent",`$${lg(f)} USD`),je("Amount Received",`${he(C)} ${st(C)}`),C.source_amount_usd?je("USD Value",`$${parseFloat(C.source_amount_usd).toFixed(2)}`):null,C.source_chain_id?je("Source Network",cg(C.source_chain_type??"",C.source_chain_id)):null,C.destination_chain_id?je("Destination Network",cg(C.destination_chain_type??"",C.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Y.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),le(j=>!j);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.seeMoreText,{color:c.foreground,fontFamily:p.medium}],children:Z?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[Y.seeMoreChevron,{color:c.foregroundMuted}],children:Z?"\u25B2":"\u25BC"})]}),Z&&jsxRuntime.jsxs(reactNative.View,{style:Y.txHashSection,children:[C.explorer_url?kt("Deposit Tx",dg(C.transaction_hash),C.explorer_url):null,!O&&C.destination_explorer_url&&C.destination_transaction_hashes?.[0]?kt("Completion Tx",dg(C.destination_transaction_hashes[0]),C.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:Y.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Be,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function Te(){return jsxRuntime.jsxs(reactNative.View,{style:Y.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.centeredContent,children:[jsxRuntime.jsx(Ld,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
+ `,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:Y.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Qe,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function _(){return jsxRuntime.jsxs(reactNative.View,{style:Y.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[Y.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Qe,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),tr()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[Y.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(Gr,{title:De,showBack:_e,onBack:ye,onClose:Be}),T==="amountInput"&&Xe(),T==="waitingForPayment"&&Re(),T==="paymentReceived"&&Ye(),T==="depositComplete"&&$(),T==="softExpired"&&Te(),T==="failed"&&_()]})}var Y=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var mg=5e3,hg=2500,gg=5e3,yg=6e4;function kn(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:h,setTrackedExecutions:T,setLatestExecution:d,setShowStatusSheet:f,onDepositSuccess:b,onExecutionsChange:v,onDepositError:x}=e,[k,R]=ws.useState(false),[w,I]=ws.useState(false);return ws.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;R(false),t==="auto_ui"&&I(false);let u=setTimeout(()=>{R(true),t==="auto_ui"&&I(true);},mg);return ()=>clearTimeout(u)},[r,t,o,n]),ws.useEffect(()=>{if(!r||!s||!a)return;let u=new Date(a.getTime()-yg),S=setInterval(async()=>{try{let B=[...(await hn(s,i,"deposit")).data??[]].sort((F,W)=>{let U=F.created_at?new Date(F.created_at).getTime():0;return (W.created_at?new Date(W.created_at).getTime():0)-U}),V=null;for(let F of B){let W=F.created_at?new Date(F.created_at):null;if(!W||W<=u)continue;let U=p.get(F.id);if(!U){V=F;break}if(["pending","waiting","delayed"].includes(U)&&F.status==="succeeded"){V=F;break}}if(V){let F=V;h(W=>{let U=W.findIndex(Z=>Z.id===F.id);if(U>=0){let Z=[...W];return Z[U]=F,Z}return [...W,F]}),T(W=>{let U=new Map(W);return U.set(F.id,F.status),U}),d(F),f(!0),F.status==="succeeded"&&b?.({message:"Deposit completed successfully",executionId:F.id}),v?.([...c,F]);}}catch(y){x?.({message:"Failed to check deposit status",error:y});}},hg);return ()=>clearInterval(S)},[r,s,i,a,p,c,v,b,x]),ws.useEffect(()=>{if(!r||!k||!l)return;let u=async()=>{try{await jc(l,i);}catch{}};u();let S=setInterval(u,gg);return ()=>clearInterval(S)},[r,k,l,i]),{pollingEnabled:k,showWaitingUi:w,handleIveDeposited:()=>{R(true),I(true);}}}function Cg({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(uc,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(tf,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function uc({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=L(),n=ws.useRef(new reactNative.Animated.Value(0)).current;ws.useEffect(()=>{if(e&&!t){n.setValue(0);let i=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Wd.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:s}]},children:jsxRuntime.jsx(kl,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Wd.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function tf({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=L();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Wd.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Wd.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var Wd=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Md(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ie(t||r||e.icon_url)}function uS(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=reactNative.Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var zd=18,Ud=12,pS=2;function fS({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),s=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(xo,{uri:e,width:r,height:r,borderRadius:10}),s?jsxRuntime.jsxs(reactNative.View,{style:gi.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[gi.badge,gi.backBadge],children:jsxRuntime.jsx(ha,{size:Ud})}),jsxRuntime.jsx(reactNative.View,{style:[gi.badge,gi.frontBadge],children:jsxRuntime.jsx(pa,{size:Ud})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[gi.badge,gi.singleBadge],children:jsxRuntime.jsx(pa,{size:Ud})}):n?jsxRuntime.jsx(reactNative.View,{style:[gi.badge,gi.singleBadge],children:jsxRuntime.jsx(ha,{size:Ud})}):null]})}var gi=reactNative.StyleSheet.create({badge:{width:zd,height:zd,borderRadius:zd/2,borderWidth:pS,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function Nd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,onBack:i,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:h,onShowStatusSheet:T}){let{colors:d,fonts:f,components:b}=L(),v=ws.useRef(true);ws.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let x=ws.useRef(false),[k,R]=ws.useState("selectWallet"),[w,I]=ws.useState([]),[m,u]=ws.useState(true),[S,y]=ws.useState(null),[D,B]=ws.useState(null),[V,F]=ws.useState(null),[W,U]=ws.useState(null),[Z,le]=ws.useState(null),[ne,ze]=ws.useState([]),[K,de]=ws.useState(false),[X,G]=ws.useState(null),[q,te]=ws.useState([]),[xe,rt]=ws.useState(new Map),[Ue]=ws.useState(()=>new Date),[se,Fe]=ws.useState(null),[Ne,ot]=ws.useState(false),[lt,qe]=ws.useState(null),[Ee,De]=ws.useState(false);ws.useEffect(()=>{if(k==="depositProcessing"||k==="depositComplete")return;if(k!=="waitingForDeposit"){De(false);return}reactNative.AppState.currentState==="active"&&De(true);let A=reactNative.AppState.addEventListener("change",E=>{E==="active"&&De(true);});return ()=>A.remove()},[k]);let _e=k==="waitingForDeposit"&&Ee||k==="depositProcessing",Se=W||V||D?.chain_types[0]||o||"ethereum",Ge=Io(ne,Se),Qe=Ge?.address||"",dt=Ge?.id??"",er=`${Se}:${n||""}`;ws.useEffect(()=>(v.current=true,()=>{v.current=false;}),[]),ws.useEffect(()=>{ut();},[t]),ws.useEffect(()=>{se&&h?.(se);},[se]),ws.useEffect(()=>{p?.(q);},[q]);let[He,ve]=ws.useState(false);ws.useEffect(()=>{!Ne||!se||(ot(false),se.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:se.id,transaction:se})):se.status==="failed"||se.status==="refunded"?(R("failed"),c?.({message:`Deposit ${se.status}`,code:se.status})):R("depositProcessing"));},[Ne,se]),ws.useEffect(()=>{k!=="depositProcessing"||!se||(se.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:se.id,transaction:se})):(se.status==="failed"||se.status==="refunded")&&(R("failed"),c?.({message:`Deposit ${se.status}`,code:se.status})));},[se?.status]);let{showWaitingUi:nt}=kn({depositConfirmationMode:"auto_ui",enabled:_e,depositAddress:Qe,chain:er,externalUserId:e,publishableKey:t,modalOpenedAt:lt??Ue,depositWalletId:dt,depositExecutions:q,trackedExecutions:xe,setDepositExecutions:te,setTrackedExecutions:rt,setLatestExecution:Fe,setShowStatusSheet:ot,onExecutionsChange:p,onDepositError:c});async function ut(){u(true),y(null);try{let A=await ep(t);if(!v.current)return;let E=A.data.filter(uS),rr=E.map(Md).filter(Boolean);if(rr.length>0&&await ec(rr),!v.current)return;I(E);}catch(A){if(!v.current)return;y(A instanceof Error?A.message:"Failed to load wallets");}finally{v.current&&u(false);}}function Ve(A){B(A),U(null),G(null),A.chain_types.length>1?(F(null),R("selectNetwork")):Be(A);}function ye(A){F(A),D&&Be(D,A);}async function Be(A,E){if(x.current)return;x.current=true,de(true),R("connecting");let rr=E||A.chain_types[0]||null;try{let Oe=await zo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:s,recipient_address:r},t);if(!v.current)return;ze(Oe.data);let be=Oe.data.map(St=>({chain_type:St.chain_type,address:St.address})),gt=rr?be.filter(St=>St.chain_type===rr):be,it=gt.length>0,Je=it?gt:be,et=it?rr:Je[0]?.chain_type??rr;U(et??null);let Me=await tp(A.id,Je,t);if(!v.current)return;if(le(Me),de(!1),!Me.supported||!Me.deeplink&&!Me.pay_url){G(`${A.name} doesn't support in-app browser on this device`),R("failed");return}let qt=Me.deeplink||Me.pay_url;try{await reactNative.Linking.openURL(qt);}catch{if(!v.current)return;G(`Could not open ${A.name}. Make sure it is installed.`),R("failed");return}if(!v.current)return;qe(new Date),R("waitingForDeposit");}catch(Oe){if(!v.current)return;de(false),G(Oe instanceof Error?Oe.message:"Failed to connect wallet"),R("failed");}}function Nt(){if(!Z)return;let A=Z.deeplink||Z.pay_url;reactNative.Linking.openURL(A).catch(()=>{});}function he(){x.current=false,B(null),F(null),U(null),le(null),ze([]),qe(null),G(null),de(false),R("selectWallet");}function st(){return m?jsxRuntime.jsx(reactNative.View,{style:bt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary})}):S?jsxRuntime.jsxs(reactNative.View,{style:bt.centeredContainer,children:[jsxRuntime.jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[bt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:S}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:ut,style:[bt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[bt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):w.length===0?jsxRuntime.jsxs(reactNative.View,{style:bt.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:bt.walletList,contentContainerStyle:bt.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),w.map(A=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Ve(A),activeOpacity:.7,disabled:K,style:[bt.walletRow,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor,opacity:K?.5:1}],children:[jsxRuntime.jsx(fS,{uri:Md(A),chainTypes:A.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:bt.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.walletName,{color:d.foreground,fontFamily:f.medium}],children:A.name}),jsxRuntime.jsx(reactNative.Text,{style:[bt.walletChains,{color:d.foregroundMuted,fontFamily:f.regular}],children:A.chain_types.map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},A.id))]})}function ht(){if(!D)return null;let A=Md(D),E=Oe=>Oe==="n1"?"N1":Oe==="xrpl"?"XRPL":Oe.charAt(0).toUpperCase()+Oe.slice(1),rr=D.chain_types.map(Oe=>({id:Oe,name:E(Oe),Icon:Oe==="ethereum"?pa:ha}));return jsxRuntime.jsxs(reactNative.View,{style:bt.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:bt.networkPickerHeader,children:[jsxRuntime.jsx(xo,{uri:A,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",D.name]})]}),jsxRuntime.jsx(reactNative.View,{style:bt.networkList,children:rr.map(({id:Oe,name:be,Icon:gt})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>ye(Oe),activeOpacity:.7,disabled:K,style:[bt.networkRow,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor,opacity:K?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:bt.networkIconContainer,children:jsxRuntime.jsx(gt,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[bt.networkName,{color:d.foreground,fontFamily:f.medium}],children:be}),jsxRuntime.jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},Oe))})]})}function tr(){return jsxRuntime.jsxs(reactNative.View,{style:bt.centeredContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Opening ",D?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function je(){let A=D?.name??"your wallet",E=D?Md(D):null;return jsxRuntime.jsxs(reactNative.View,{style:bt.centeredContainer,children:[E?jsxRuntime.jsx(vt,{size:80,children:jsxRuntime.jsx(xo,{uri:E,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Continue in ",A]}),jsxRuntime.jsx(reactNative.Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Nt,activeOpacity:.8,style:[bt.primaryButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],children:[jsxRuntime.jsx(Zo,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[bt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",A]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(uc,{showWaitingUi:nt,latestExecution:se})})]})}function kt(A,E){let rr=parseFloat(A)/Math.pow(10,E);return rr===0?"0.00":rr>=1?rr.toFixed(2):parseFloat(rr.toPrecision(6)).toString()}function Xe(A,E){let rr={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return A==="n1"?"N1":A==="cardano"?"Cardano":rr[E]??`${A.charAt(0).toUpperCase()+A.slice(1)} (${E})`}function Re(A){if(!A)return "";let E=A.indexOf(".");return E!==-1?A.slice(0,E).toUpperCase()+A.slice(E):A.toUpperCase()}function Ye(A){return A.length<=12?A:`${A.slice(0,6)}...${A.slice(-4)}`}function $(A){if(!A)return "";try{return new Date(A).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Te(A){let E=A.destination_amount_base_unit;return E?kt(E,A.destination_token_metadata?.decimals??6):"\u2014"}function _(A){let E=A.destination_token_metadata;return E?E.icon_urls?.length?Pn(E.icon_urls,"png")??E.icon_url??null:E.icon_url??null:null}function C(){if(!se)return null;let A=_(se);return jsxRuntime.jsx(reactNative.View,{style:tt.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:tt.centeredContent,children:[jsxRuntime.jsx(vt,{size:84,strokeWidth:4,iconSize:48,children:A?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(A)},style:tt.loaderIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[tt.loaderIcon,{backgroundColor:d.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[tt.stateTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Deposit Processing"}),jsxRuntime.jsx(reactNative.Text,{style:[tt.stateDescription,{color:d.foregroundMuted,fontFamily:f.regular}],children:"This usually takes less than a minute."})]})})}function O(){if(!se)return C();let A=se,E=["pending","waiting","delayed"].includes(A.status),rr=_(A),Oe=$(A.created_at);return jsxRuntime.jsxs(reactNative.View,{style:tt.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:tt.flex,contentContainerStyle:tt.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:tt.tokenIconWrapper,children:[rr?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(rr)},style:tt.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[tt.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[tt.statusBadge,{backgroundColor:E?d.warning:b.container.iconBackgroundColor}],children:E?jsxRuntime.jsx(reactNative.Text,{style:tt.statusBadgeText,children:"\u21BB"}):jsxRuntime.jsx(pt,{size:14,color:b.container.iconColor,strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:tt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[tt.statusDot,{backgroundColor:E?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[tt.statusText,{color:d.foreground,fontFamily:f.semibold}],children:E?"In Progress":"Completed"})]}),Oe?jsxRuntime.jsx(reactNative.Text,{style:[tt.dateText,{color:d.foregroundMuted,fontFamily:f.regular}],children:Oe}):null,jsxRuntime.jsxs(reactNative.View,{style:[tt.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[A.source_amount_usd?jsxRuntime.jsxs(reactNative.View,{style:tt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:["$",parseFloat(A.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxRuntime.jsxs(reactNative.View,{style:tt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:[Te(A)," ",Re(A.destination_currency)]})]}),A.source_chain_id?jsxRuntime.jsxs(reactNative.View,{style:tt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:Xe(A.source_chain_type??"",A.source_chain_id)})]}):null,A.destination_chain_id?jsxRuntime.jsxs(reactNative.View,{style:tt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:Xe(A.destination_chain_type??"",A.destination_chain_id)})]}):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:tt.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),ve(be=>!be);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.seeMoreText,{color:d.foreground,fontFamily:f.medium}],children:He?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[tt.seeMoreChevron,{color:d.foregroundMuted}],children:He?"\u25B2":"\u25BC"})]}),He&&jsxRuntime.jsxs(reactNative.View,{style:tt.txHashSection,children:[A.explorer_url?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[tt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(A.explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:tt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.txHash,{color:d.foregroundMuted}],children:Ye(A.transaction_hash)}),jsxRuntime.jsx(reactNative.Text,{style:[tt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!E&&A.destination_explorer_url&&A.destination_transaction_hashes?.[0]?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[tt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(A.destination_explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:tt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.txHash,{color:d.foregroundMuted}],children:Ye(A.destination_transaction_hashes[0])}),jsxRuntime.jsx(reactNative.Text,{style:[tt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsxRuntime.jsx(reactNative.View,{style:tt.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[bt.primaryButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],onPress:a,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[bt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.medium}],children:"Done"})})})]})}function N(){return jsxRuntime.jsxs(reactNative.View,{style:bt.centeredContainer,children:[jsxRuntime.jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:X||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:he,activeOpacity:.8,style:[bt.primaryButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[bt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function H(){switch(k){case "selectWallet":return st();case "selectNetwork":return ht();case "connecting":return tr();case "waitingForDeposit":return je();case "depositProcessing":return C();case "depositComplete":return O();case "failed":return N()}}let j=k==="selectWallet"||k==="selectNetwork"||k==="failed",pe=k==="selectNetwork"?D?.name??"Select Network":k==="depositProcessing"?"Deposit Processing":k==="depositComplete"?"Deposit Summary":"Connect Wallet";function $e(){k==="selectNetwork"?(x.current=false,B(null),F(null),U(null),R("selectWallet")):i();}return jsxRuntime.jsxs(reactNative.View,{style:bt.container,children:[jsxRuntime.jsx(Gr,{title:pe,showBack:j,onBack:$e,onClose:a}),H()]})}var bt=reactNative.StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}}),tt=reactNative.StyleSheet.create({flex:{flex:1},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},loaderIcon:{width:48,height:48,borderRadius:24},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:24,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:28},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8}});var bi=7,yi=4,Ka=4;function wS(e,t,r){return e<bi&&t<bi||e<bi&&t>=r-bi||e>=r-bi&&t<bi}function ds({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=L(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,h=ws.useMemo(()=>{try{return CS__default.default(e||"placeholder","H")}catch{return null}},[e]),T=h?h.length:0,d=T?(t-yi*2)/T:0,f=d*.38,b=o+12,v=b/2+4,x=t/2,k=t/2,R=T?[{x:yi,y:yi},{x:yi+(T-bi)*d,y:yi},{x:yi,y:yi+(T-bi)*d}]:[],w=bi*d,I=5*d,m=d,u=3*d,S=2*d;return jsxRuntime.jsxs(reactNative.View,{style:[af.container,{width:t,height:t}],children:[jsxRuntime.jsxs(sr__default.default,{width:t,height:t,children:[jsxRuntime.jsx(sr.Rect,{x:0,y:0,width:t,height:t,fill:l}),h?.map((y,D)=>y.map((B,V)=>{if(!B||wS(D,V,T))return null;let F=yi+V*d+d/2,W=yi+D*d+d/2;if(r){let U=F-x,Z=W-k;if(Math.sqrt(U*U+Z*Z)<v)return null}return jsxRuntime.jsx(sr.Circle,{cx:F,cy:W,r:f,fill:c},`${D}-${V}`)})),R.map((y,D)=>jsxRuntime.jsxs(ws__namespace.default.Fragment,{children:[jsxRuntime.jsx(sr.Rect,{x:y.x,y:y.y,width:w,height:w,rx:Ka,ry:Ka,fill:c}),jsxRuntime.jsx(sr.Rect,{x:y.x+m,y:y.y+m,width:I,height:I,rx:Ka-1,ry:Ka-1,fill:l}),jsxRuntime.jsx(sr.Rect,{x:y.x+S,y:y.y+S,width:u,height:u,rx:Ka-1.5,ry:Ka-1.5,fill:c})]},`finder-${D}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[af.logoContainer,{width:b,height:b,top:k-b/2,left:x-b/2,backgroundColor:p,borderRadius:b/2}],children:[jsxRuntime.jsx(xo,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[af.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(xo,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var af=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var vS=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ya=(e,t)=>`${t}:${e}`,RS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function qd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:b,onSelectedTokenIconUrl:v,borderTopLeftRadius:x,borderTopRightRadius:k,sheetBorderRadius:R}){let{colors:w,fonts:I,components:m}=L(),u=a&&l?`${a}:${l}`:"solana:mainnet",[S,y]=ws.useState("USDC"),[D,B]=ws.useState(u),[V,F]=ws.useState([]),[W,U]=ws.useState(true),[Z,le]=ws.useState([]),[ne,ze]=ws.useState(true),[K,de]=ws.useState(false),[X,G]=ws.useState(false),[q,te]=ws.useState(false),[xe,rt]=ws.useState(false),[Ue,se]=ws.useState([]),[Fe,Ne]=ws.useState(new Map),[ot]=ws.useState(()=>new Date),[lt,qe]=ws.useState(null),[Ee,De]=ws.useState(false),[_e,Se]=ws.useState(null),[Ge,Qe]=ws.useState(false);ws.useEffect(()=>{_e&&f?.(_e);},[_e]),ws.useEffect(()=>{Ee&&(b?.(true),De(false));},[Ee]);let dt=new Map;Z.forEach(_=>{_.chains.forEach(C=>{let O=`${C.chain_type}:${C.chain_id}`;dt.has(O)||dt.set(O,C);});});let er=Array.from(dt.values()),He=RS(D),nt=er.find(_=>_.chain_type===He.chainType&&_.chain_id===He.chainId)?.chain_type||"ethereum",ut=Io(V,nt),Ve=ut?.address||"",ye=ws.useRef(false);ws.useEffect(()=>{async function _(){try{ze(!0),qe(null);let O=await ii(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(le(O.data),O.data.length>0&&!ye.current){ye.current=!0;let N,H;if(a&&l)if(c)for(let j of O.data){let pe=j.chains.find($e=>$e.chain_type===a&&$e.chain_id===l&&$e.token_address.toLowerCase()===c.toLowerCase());if(pe){N=j,H=pe;break}}else {let j=$e=>$e.chain_type===a&&$e.chain_id===l,pe=O.data.find($e=>$e.symbol==="USDC"&&$e.chains.some(j));if(pe)N=pe,H=pe.chains.find(j);else for(let $e of O.data){let A=$e.chains.find(j);if(A){N=$e,H=A;break}}}if(!N&&s)for(let j of O.data){let pe=j.chains.find($e=>$e.token_address.toLowerCase()===s.toLowerCase());if(pe){N=j,H=pe;break}}N||(N=O.data.find(j=>j.symbol==="USDC"),N&&N.chains.length>0&&(H=N.chains[0])),N||(N=O.data.find(j=>j.symbol==="USDT"),N&&N.chains.length>0&&(H=N.chains[0])),N||(N=O.data[0],N.chains.length>0&&(H=N.chains[0])),N&&y(N.symbol),H&&B(Ya(H.chain_id,H.chain_type));}}catch(C){console.error("Error fetching supported tokens:",C),qe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:C});}finally{ze(false);}}_();},[t,d,a,l,c,s,n,o]),ws.useEffect(()=>{async function _(){try{U(!0),qe(null);let C=await zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);F(C.data);}catch(C){console.error("Error fetching wallets:",C),qe("Failed to load wallets"),d?.({message:"Failed to load wallets",error:C});}finally{U(false);}}_();},[e,r,o,n,s,t,d]);let Be=ut?.id??"",{showWaitingUi:Nt,handleIveDeposited:he}=kn({depositConfirmationMode:p,depositAddress:Ve,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:ot,depositWalletId:Be,depositExecutions:Ue,trackedExecutions:Fe,setDepositExecutions:se,setTrackedExecutions:Ne,setLatestExecution:Se,setShowStatusSheet:De,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});ws.useEffect(()=>{if(!Z.length)return;let _=Z.find(O=>O.symbol===S);if(!_||_.chains.length===0){let O=Z.find(N=>N.symbol==="USDC")||Z[0];O&&(y(O.symbol),O.chains.length>0&&B(Ya(O.chains[0].chain_id,O.chains[0].chain_type)));return}if(!_.chains.some(O=>Ya(O.chain_id,O.chain_type)===D)){let O=_.chains[0];B(Ya(O.chain_id,O.chain_type));}},[S,Z,D]);let st=Z.find(_=>_.symbol===S),ht=Ae(st,"png")||void 0;ws.useEffect(()=>{v?.(ht);},[ht]);let tr=st?.chains||[],je=tr.find(_=>Ya(_.chain_id,_.chain_type)===D),kt=async()=>{if(Ve)try{reactNative.Clipboard.setString(Ve),de(!0),setTimeout(()=>de(!1),2e3);}catch(_){console.error("Failed to copy:",_);}},Xe=je?.estimated_price_impact_percent??0,Re=je?.max_slippage_percent??.25,Ye=je?.minimum_deposit_amount_usd??3;if(ne)return jsxRuntime.jsxs(reactNative.View,{style:Q.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:I.regular}],children:"Loading currencies..."})]});if(lt&&Z.length===0)return jsxRuntime.jsxs(reactNative.View,{style:Q.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.errorText,{color:w.error,fontFamily:I.regular}],children:lt}),jsxRuntime.jsx(reactNative.Text,{style:[Q.errorHint,{color:w.foregroundMuted,fontFamily:I.regular}],children:"Please check your network connection and try again."})]});let $=()=>jsxRuntime.jsxs(Mt,{visible:q,onClose:()=>te(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.tokenSelector?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(false),style:Q.sheetCloseButton,children:jsxRuntime.jsx(_t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Bt,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:Z.map(_=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{y(_.symbol),te(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:S===_.symbol?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(_,"png"))},style:Q.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:Q.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:_.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:I.regular}],children:[_.chains.length," network",_.chains.length!==1?"s":""," available"]})]}),S===_.symbol&&jsxRuntime.jsx(pt,{size:20,color:w.primary,strokeWidth:2})]},_.symbol))})]}),Te=()=>jsxRuntime.jsxs(Mt,{visible:xe,onClose:()=>rt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.chainSelector?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(false),style:Q.sheetCloseButton,children:jsxRuntime.jsx(_t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Bt,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:tr.map(_=>{let C=Ya(_.chain_id,_.chain_type),O=D===C;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{B(C),rt(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:O?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(_,"png"))},style:Q.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:Q.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:_.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.sheetItemSubtitle,{fontFamily:I.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:m.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:w.warning},children:["$",_.minimum_deposit_amount_usd]})]})]}),O&&jsxRuntime.jsx(pt,{size:20,color:w.primary,strokeWidth:2})]},C)})})]});return jsxRuntime.jsxs(reactNative.View,{style:Q.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:I.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[st&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(st,"png"))},style:Q.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:I.medium}],children:S}),jsxRuntime.jsx(cr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:I.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[Q.minDeposit,{color:w.warning,fontFamily:I.regular}],children:["($",Ye," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[je&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(je,"png"))},style:Q.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:I.medium}],numberOfLines:1,children:je?.chain_name||"Select network"}),jsxRuntime.jsx(cr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.intentAddressLabel,{color:w.foregroundMuted,fontFamily:I.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:Q.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Q.qrWrapper,{backgroundColor:w.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:W?jsxRuntime.jsxs(reactNative.View,{style:Q.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:I.regular}],children:"Loading..."})]}):Ve?jsxRuntime.jsx(ds,{value:Ve,size:160,logoUri:ie(Ae(je,"png")||or("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:Q.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Q.errorText,{color:w.error,fontFamily:I.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:kt,disabled:W||!Ve,style:Q.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.addressTruncated,{color:w.foregroundMuted,fontFamily:I.regular}],numberOfLines:1,children:W?"Loading...":Ve?vS(Ve):"No address"}),K?jsxRuntime.jsx(pt,{size:16,color:w.success,strokeWidth:2}):jsxRuntime.jsx(pn,{size:16,color:w.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(uc,{showWaitingUi:Nt,latestExecution:_e}),jsxRuntime.jsxs(reactNative.View,{style:[Q.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(!X),style:Q.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ho,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:Q.chevronContainer,children:X?jsxRuntime.jsx(_n,{size:16,color:m.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(cr,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),X&&jsxRuntime.jsxs(reactNative.View,{style:Q.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Price impact: ",Xe.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(mn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(To,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Slippage: Auto \u2022 ",Re.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(mn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.detailsLabel,{color:w.primary,fontFamily:I.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(tf,{depositConfirmationMode:p,depositAddress:Ve,showWaitingUi:Nt,onIveDeposited:he}),$(),Te(),jsxRuntime.jsxs(Mt,{visible:Ge,onClose:()=>Qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:R?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:R?.infoSheet?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(false),style:Q.sheetCloseButton,children:jsxRuntime.jsx(_t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:I.medium}],children:[Xe.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardDescription,{color:m.card.descriptionColor,fontFamily:I.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:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(To,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:I.medium}],children:[Re.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardDescription,{color:m.card.descriptionColor,fontFamily:I.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."})]})]})]})]})}var Q=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"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},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},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 Qd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=L();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Hs.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Hs.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Hs.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(e,"png"))},style:Hs.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Hs.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Hs.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Hs.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(pt,{size:16,color:o.primary,strokeWidth:2})]})}var Hs=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 fc({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=L();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Dg.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Dg.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(Qd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Dg=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Gd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=L(),[h,T]=ws.useState(""),d=o.map(w=>r.find(I=>I.currency_code.toLowerCase()===w.toLowerCase())).filter(w=>w!==void 0),f=r.filter(w=>!o.includes(w.currency_code.toLowerCase())),b=w=>{if(!h)return w;let I=h.toLowerCase();return w.filter(m=>m.name.toLowerCase().includes(I)||m.currency_code.toLowerCase().includes(I))},v=b(d),x=b(f),k=w=>{s(w),t(false),T("");},R=()=>{t(false),T("");};return jsxRuntime.jsxs(Mt,{visible:e,onClose:R,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(Gr,{title:"Currency",showBack:false,onClose:R}),jsxRuntime.jsx(reactNative.View,{style:js.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[js.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:h,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(Bt,{style:js.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:js.listContent,children:[jsxRuntime.jsx(fc,{title:"Popular currencies",currencies:v,selectedCurrency:n,onSelect:k}),v.length>0&&x.length>0&&jsxRuntime.jsx(reactNative.View,{style:js.sectionSpacer}),jsxRuntime.jsx(fc,{title:"All currencies",currencies:x,selectedCurrency:n,onSelect:k}),v.length===0&&x.length===0&&jsxRuntime.jsx(reactNative.View,{style:js.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[js.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var js=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 pf(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 Zd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:h,onLatestExecution:T,onShowStatusSheet:d,onSelectedTokenIconUrl:f,borderTopLeftRadius:b,borderTopRightRadius:v,sheetBorderRadius:x}){let{colors:k,fonts:R,components:w}=L(),[I,m]=ws.useState(""),[u,S]=ws.useState("usd"),[y,D]=ws.useState(false),[B,V]=ws.useState(false),[F,W]=ws.useState([]),[U,Z]=ws.useState(false),[le,ne]=ws.useState(null),[ze,K]=ws.useState(null),[de,X]=ws.useState("amount"),[G,q]=ws.useState(null),[te,xe]=ws.useState(true),[rt,Ue]=ws.useState(null),[se,Fe]=ws.useState(false),Ne=ws.useRef(null),ot=ws.useRef(false);ws.useEffect(()=>{Ne.current=G;},[G]),ws.useEffect(()=>{ot.current=se;},[se]);let[lt,qe]=ws.useState([]),[Ee,De]=ws.useState(true),[_e,Se]=ws.useState(60),[Ge,Qe]=ws.useState([]),[dt,er]=ws.useState([]),[He,ve]=ws.useState(null),[nt,ut]=ws.useState(null),[Ve,ye]=ws.useState(true),[Be,Nt]=ws.useState(null),[he,st]=ws.useState(false),[ht,tr]=ws.useState(null),[je,kt]=ws.useState(false),[Xe,Re]=ws.useState(false),[Ye,$]=ws.useState(false),[Te,_]=ws.useState(null),C=r??de,O=ws.useRef(null),N=Ge.find(ge=>ge.currency_code.toLowerCase()===u.toLowerCase()),H=ws.useCallback(ge=>{X(ge),ge==="quotes"?o?.(ge,F.length):o?.(ge);},[F.length,o]);ws.useEffect(()=>{async function ge(){try{let Ze=await Ol();ut(Ze);}catch(Ze){console.error("Error fetching user IP:",Ze);}finally{ye(false);}}ge();},[]),ws.useEffect(()=>{async function ge(){try{let Ze=await zo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);qe(Ze.data);}catch(Ze){console.error("Error fetching wallets:",Ze),ne("Failed to load wallet addresses");}finally{De(false);}}ge();},[e,s,i,a,l,t]);let j=n||He?.symbol.toUpperCase()||"USDC",pe=Pn(He?.icon_urls,"png")||He?.icon_url,$e=Pn(He?.chain_icon_urls,"png")||He?.chain_icon_url,[A,E]=ws.useState([]),[rr,Oe]=ws.useState(new Map),[be]=ws.useState(()=>new Date),[gt,it]=ws.useState(null),[Je,et]=ws.useState(false),[Me,qt]=ws.useState(null);ws.useEffect(()=>{C==="onramp"&&!Me&&qt(new Date);},[C,Me]);let St=Be?.destination_token_metadata?.chain_type||i||"ethereum",wo=Be?.destination_token_metadata?.chain_id||a||"",Qr=`${St}:${wo}`,Fc=Io(lt,St),ks=Fc?.address||"",Dc=Fc?.id??"";ws.useEffect(()=>{gt&&T?.(gt);},[gt]),ws.useEffect(()=>{Je&&(d?.(true),et(false));},[Je]),ws.useEffect(()=>{f?.(pe||void 0);},[pe]),ws.useEffect(()=>{h?.(A);},[A]),kn({depositConfirmationMode:"auto_silent",enabled:C==="onramp",depositAddress:ks,chain:Qr,externalUserId:e,publishableKey:t,modalOpenedAt:Me??be,depositWalletId:Dc,depositExecutions:A,trackedExecutions:rr,setDepositExecutions:E,setTrackedExecutions:Oe,setLatestExecution:it,setShowStatusSheet:et,onDepositSuccess:c,onExecutionsChange:h,onDepositError:p}),ws.useEffect(()=>{async function ge(){try{let Ze=await Dl(t);Qe(Ze.data),er(Ze.preferred||[]);}catch(Ze){console.error("Error fetching fiat currencies:",Ze);}}ge();},[t]),ws.useEffect(()=>{if(y||Ge.length===0||!nt?.alpha2)return;let ge=nt.alpha2.toUpperCase(),Ze=Ge.find(xr=>xr.country_codes.includes(ge));if(Ze)S(Ze.currency_code.toLowerCase()),!I&&!B&&m(String(Ze.default_amount??100));else if(!I&&!B){let xr=Ge.find(In=>In.currency_code.toLowerCase()==="usd");xr&&m(String(xr.default_amount??100));}},[Ge,nt,y,I,B]),ws.useEffect(()=>{if(Ge.length!==0){if(O.current!==null&&O.current!==u){let ge=Ge.find(Ze=>Ze.currency_code.toLowerCase()===u.toLowerCase());ge&&m(String(ge.default_amount??100));}O.current=u;}},[u,Ge]),ws.useEffect(()=>{async function ge(){try{let Ze=await ju({chain_type:i||"",chain_id:a||"",token_address:l||""},t);ve(Ze);}catch(Ze){console.error("Error fetching supported tokens:",Ze);}}ge();},[i,a,l,t]),ws.useEffect(()=>{async function ge(){if(!(!l||!a||!i)&&!Ve){st(true);try{let Ze=await Qu({country_code:nt?.alpha2?.toUpperCase()||"US",subdivision_code:nt?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Nt(Ze);}catch(Ze){console.error("Error fetching default onramp token:",Ze);}finally{st(false);}}}ge();},[l,a,i,nt,Ve,t]),ws.useEffect(()=>{let ge=parseFloat(I);if(isNaN(ge)||ge<=0){W([]),K(null);return}if(!Be||he){W([]),q(null);return}let Ze=Ge.find(In=>In.currency_code.toLowerCase()===u.toLowerCase());if(Ze){if(ge<Ze.minimum_amount){W([]),q(null),K(`Minimum amount is ${pf(u)}${Ze.minimum_amount.toLocaleString()}`);return}if(ge>Ze.maximum_amount){W([]),q(null),K(`Maximum amount is ${pf(u)}${Ze.maximum_amount.toLocaleString()}`);return}}K(null);let xr=setTimeout(()=>{xs(ge);},500);return ()=>clearTimeout(xr)},[I,u,t,Be,he,Ge]);let xs=async ge=>{if(!Be){ne("Loading token information...");return}Z(true),ne(null);try{let Ze={country_code:nt?.alpha2?.toUpperCase()||"US",source_amount:ge.toString(),source_currency:u.toLowerCase(),destination_currency:Be.destination_currency,destination_network:Be.destination_network,subdivision_code:nt?.state||void 0},xr=await $u(Ze,t);W(xr.data);let In=ot.current,Oc=Ne.current;if(In&&Oc){let Li=xr.data.find(P=>P.service_provider===Oc.service_provider);if(Li){if(q(Li),xr.data.length>0){let P=xr.data[0];rt||Ue(P.service_provider),xe(Li.service_provider===rt);}}else if(xr.data.length>0){let P=xr.data[0];q(P),Ue(P.service_provider),xe(!0),Fe(!1);}}else if(xr.data.length>0){let Li=xr.data[0];q(Li),Ue(Li.service_provider),xe(!0);}Se(60);}catch(Ze){console.error("Failed to fetch quotes:",Ze),ne("Failed to fetch quotes. Please try again."),W([]);}finally{Z(false);}};ws.useEffect(()=>{if(F.length===0)return;let ge=setInterval(()=>{Se(Ze=>{if(Ze<=1){let xr=parseFloat(I);return !isNaN(xr)&&xr>0&&xs(xr),60}return Ze-1});},1e3);return ()=>clearInterval(ge)},[F.length,I]);let Vc=ge=>{(/^\d*\.?\d{0,2}$/.test(ge)||ge==="")&&(m(ge),V(true));},na=ge=>{m(ge.toString()),V(true);},Du=async()=>{if(G&&Be)try{let ge=Be.destination_token_metadata.chain_type,Ze=Io(lt,ge);if(!Ze?.address){ne("Wallet address not available");return}let xr={service_provider:G.service_provider,country_code:G.country_code?.toUpperCase()||nt?.alpha2?.toUpperCase()||"US",source_currency:G.source_currency,source_amount:I,destination_currency:G.destination_currency,destination_network:G.destination_network,wallet_address:Ze.address,subdivision_code:nt?.state||void 0},In=await qu(xr,t);tr({provider:G,sourceCurrency:u,sourceAmount:I,sessionUrl:In.url}),_(In.url),$(!0);}catch(ge){console.error("Failed to create session:",ge),ne("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:ge});}},Oi=pf(u),Cl=()=>{$(false),H("onramp"),c?.({message:"Payment flow completed"});},Vu=()=>jsxRuntime.jsx(zS,{visible:Ye,onClose:Cl,url:Te,providerName:G?.service_provider_display_name||"Complete Payment",colors:k,fonts:R,borderTopLeftRadius:x?.webView?.borderTopLeftRadius??b,borderTopRightRadius:x?.webView?.borderTopRightRadius??v});return C==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ce.amountViewContainer,children:[jsxRuntime.jsxs(Bt,{style:ce.scrollContainer,contentContainerStyle:ce.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:ce.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>kt(true),style:[ce.currencyButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.input.borderRadius,borderWidth:w.input.borderWidth,borderColor:w.input.borderColor}],children:[N&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(N,"png"))},style:ce.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ce.currencyText,{color:w.card.titleColor,fontFamily:R.medium}],children:u.toUpperCase()}),jsxRuntime.jsx(cr,{size:16,color:w.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Gd,{open:je,onOpenChange:kt,currencies:Ge,preferredCurrencyCodes:dt,selectedCurrency:u,onSelectCurrency:ge=>{S(ge.toLowerCase()),D(true);},borderTopLeftRadius:x?.currencyModal?.borderTopLeftRadius??b,borderTopRightRadius:x?.currencyModal?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:ce.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:ce.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.currencySymbol,{color:w.container.titleColor,fontFamily:R.medium}],children:Oi}),jsxRuntime.jsx(reactNative.TextInput,{style:[ce.amountInput,{color:w.container.titleColor,fontFamily:R.medium}],value:I,onChangeText:Vc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:k.foregroundMuted})]})}),N?.suggested_amounts&&N.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:ce.quickAmounts,children:N.suggested_amounts.map(ge=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>na(ge),style:[ce.quickAmountButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.button.borderRadius,borderWidth:parseFloat(I)===ge?2:w.button.borderWidth,borderColor:parseFloat(I)===ge?k.primary:w.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ce.quickAmountText,{color:w.card.titleColor,fontFamily:R.medium}],children:[Oi,ge.toLocaleString()]})},ge))}),ze&&jsxRuntime.jsx(reactNative.Text,{style:[ce.validationError,{color:k.error,fontFamily:R.regular}],children:ze}),jsxRuntime.jsxs(reactNative.View,{style:ce.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.providerLabel,{color:w.card.labelColor,fontFamily:R.medium}],children:"Provider"}),F.length>0&&!U&&jsxRuntime.jsxs(reactNative.Text,{style:[ce.refreshText,{color:w.card.labelRightColor,fontFamily:R.regular}],children:["Refreshing in ",_e,"s"]})]}),jsxRuntime.jsx(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:U||F.length===0?void 0:()=>Re(true),contentStyle:reactNative.StyleSheet.flatten([ce.providerButton,(U||F.length===0)&&ce.disabled]),children:U?jsxRuntime.jsxs(reactNative.View,{style:ce.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ce.loadingText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Finding best rates..."})]}):G?jsxRuntime.jsxs(reactNative.View,{style:ce.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.providerInfo,children:[te&&jsxRuntime.jsx(reactNative.Text,{style:[ce.autoPickedText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:ce.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie($c(G.icon_urls,"png",G.icon_url))},style:ce.providerIconImage},`provider-${G.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.providerName,{color:w.card.titleColor,fontFamily:R.medium}],children:G.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[ce.bestPriceText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:[G.destination_amount.toFixed(2)," ",j]})]})]})]}),jsxRuntime.jsx(Wr,{size:20,color:w.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[ce.noProviderText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:parseFloat(I)>0?"No providers available":"Enter an amount to see providers"})}),le&&jsxRuntime.jsx(reactNative.Text,{style:[ce.errorText,{color:k.error,fontFamily:R.regular}],children:le})]}),jsxRuntime.jsxs(Mt,{visible:Xe,onClose:()=>Re(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:x?.providerModal?.borderTopLeftRadius??b,borderTopRightRadius:x?.providerModal?.borderTopRightRadius??v,children:[jsxRuntime.jsx(Gr,{title:"Select Provider",showBack:false,onClose:()=>Re(false)}),jsxRuntime.jsx(Bt,{style:ce.providerModalList,contentContainerStyle:ce.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:ce.quotesList,children:F.map(ge=>{let Ze=G?.service_provider===ge.service_provider;return jsxRuntime.jsxs(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:()=>{q(ge),Fe(true),xe(ge.service_provider===rt),Re(false);},contentStyle:reactNative.StyleSheet.flatten([ce.quoteItem,Ze&&{borderWidth:2,borderColor:k.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:ce.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie($c(ge.icon_urls,"png",ge.icon_url))},style:ce.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[ce.quoteName,{color:w.card.titleColor,fontFamily:R.medium}],children:ge.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:ce.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ce.quoteAmount,{color:w.card.textRightColor,fontFamily:R.medium}],children:[ge.destination_amount.toFixed(2)," ",j]}),jsxRuntime.jsxs(reactNative.Text,{style:[ce.quoteSource,{color:w.card.subtextRightColor,fontFamily:R.regular}],children:["Fee: ",Oi,ge.total_fee.toFixed(2)]})]})]},ge.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ce.continueButtonContainer,{backgroundColor:k.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:U||Ee||!G||parseFloat(I)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Du,disabled:U||Ee||!G||parseFloat(I)<=0,style:[ce.continueButton,{backgroundColor:w.container.buttonColor,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.continueButtonText,{color:w.container.buttonTitleColor,fontFamily:R.medium}],children:Ee?"Loading...":"Continue"})})})})]}),Vu()]}):C==="onramp"&&ht?jsxRuntime.jsxs(reactNative.View,{style:ce.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie($c(ht.provider.icon_urls,"png",ht.provider.icon_url))},style:ce.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[ce.onrampTitle,{color:w.container.titleColor,fontFamily:R.medium}],children:["Complete transaction with ",ht.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[ce.onrampSubtitle,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[ce.flowDiagram,{backgroundColor:w.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ce.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:or(`/icons/currencies/png/${ht.sourceCurrency.toLowerCase()}.png`)},style:ce.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[ce.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[ce.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:ht.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ce.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Pn(Be?.destination_token_metadata?.icon_urls,"png")||Be?.destination_token_metadata?.icon_url||or("/icons/tokens/png/usdc.png")},style:ce.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Pn(Be?.destination_token_metadata?.chain?.icon_urls,"png")||Be?.destination_token_metadata?.chain?.icon_url||or("/icons/networks/png/polygon.png")},style:[ce.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ce.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[ce.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:"USDC"})]}),jsxRuntime.jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ce.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:pe||or("/icons/tokens/png/usdc.png")},style:ce.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:$e||or("/icons/networks/png/polygon.png")},style:[ce.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ce.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[ce.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:j})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ce.onrampInfoBox,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.onrampInfoText,{color:w.card.descriptionColor,fontFamily:R.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 zS({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(Mt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:$s.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:$s.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[$s.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:$s.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:$s.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:$s.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:$s.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var $s=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"}}),ce=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 jS(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 $S(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function tu({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=L(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ie(Ae(e.destination_token_metadata,"png")||or("/icons/tokens/png/usdc.png")),c=i?"Deposit Processing":"Deposit Completed",p=jS(e.created_at||new Date().toISOString()),h=$S(e.source_amount_usd);return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Si.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Si.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Si.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Si.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Si.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Si.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[Si.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:Si.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Si.amount,{color:s.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Si=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 Bg(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Ag(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 QS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Wg=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Eg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function KS(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 GS({count:e=4}){let{colors:t,components:r}=L(),o=ws.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return ws.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:qs.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[qs.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[qs.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:qs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[qs.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[qs.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[qs.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var qs=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 hf({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=L(),[l,c]=ws.useState(r),[p,h]=ws.useState(false),[T,d]=ws.useState(null),[f,b]=ws.useState(false),v=ws.useRef(null);ws.useEffect(()=>{if(!e||!o)return;let u=async()=>{h(true);try{let D=[...(await hn(o,n,"deposit")).data].sort((B,V)=>{let F=B.created_at?new Date(B.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-F});c(D);}catch(y){console.error("Failed to fetch executions:",y),c(r);}finally{h(false);}};u();let S=setInterval(u,1e4);return ()=>clearInterval(S)},[e,o,n,r]),ws.useEffect(()=>{r.length>0&&c(u=>{let S=new Set(u.map(D=>D.id)),y=r.filter(D=>!S.has(D.id));return y.length>0?[...y,...u]:u});},[r]),ws.useEffect(()=>{e||d(null);},[e]);let x=u=>{d(u);},k=()=>{d(null),b(false);},R=()=>{d(null),t();},w=()=>{if(!T)return null;let u=T,S=u.status==="pending"||u.status==="waiting"||u.status==="delayed",y=u.status==="succeeded",D=ie(Ae(u.destination_token_metadata,"png")||or("/icons/tokens/png/usdc.png")),B=u.provider_metadata?.details,V=B?.currencyIn,F=B?.currencyOut;V?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let Z=Ag(u.source_amount_base_unit,u.source_token_metadata?.decimals),le=Ag(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),ne=QS(u.source_amount_usd),ze=Bg(u.source_chain_type,u.source_chain_id),K=Bg(u.destination_chain_type,u.destination_chain_id),de=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},X=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(Bt,{ref:v,style:Ke.scrollContainer,contentContainerStyle:Ke.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:D},style:Ke.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ke.statusBadge,{backgroundColor:S?s.warning:s.success,borderColor:s.background}],children:S?jsxRuntime.jsx(cr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ke.statusDot,{backgroundColor:S?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:S?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:KS(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Z," ",Eg(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[le," ",Eg(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ne})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ze})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:K})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let G=!f;b(G),G?setTimeout(()=>{v.current?.scrollToEnd({animated:true});},100):v.current?.scrollTo({y:0,animated:true});},style:Ke.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(_n,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(cr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:de,style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Wg(u.transaction_hash)}),jsxRuntime.jsx(Zo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&y&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:X,style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Wg(u.destination_transaction_hashes[0])}),jsxRuntime.jsx(Zo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},I=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{title:T?"Deposit Details":"Deposit Tracker",onClose:R,showClose:!T,showBack:!!T,onBack:k}),T?w():I?jsxRuntime.jsx(GS,{}):jsxRuntime.jsx(Bt,{style:Ke.scrollContainer,contentContainerStyle:Ke.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ke.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:Ke.executionsList,children:l.map(u=>jsxRuntime.jsx(tu,{execution:u,onPress:()=>x(u)},u.id))})})]})}var Ke=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 mc(e,t=true){let[r,o]=ws.useState(null),[n,s]=ws.useState(null),[i,a]=ws.useState(false),[l,c]=ws.useState(false),[p,h]=ws.useState(null),[T,d]=ws.useState(null);ws.useEffect(()=>{!t||r||(a(true),Ol().then(x=>{o(x),h(null);}).catch(x=>{h(x instanceof Error?x:new Error(String(x)));}).finally(()=>{a(false);}));},[t,r]),ws.useEffect(()=>{!t||!e||n||(c(true),Vl(e).then(x=>{s(x),d(null);}).catch(x=>{d(x instanceof Error?x:new Error(String(x)));}).finally(()=>{c(false);}));},[t,e,n]);let f=i||l,b=p||T||null,v=null;if(r&&n){let x=n.blocked_country_codes||[],k=r.alpha2.toUpperCase();v=!x.some(R=>R.toUpperCase()===k);}return {isAllowed:v,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:b}}var bf="unifold_recent_tokens",eT=5,jg=[{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 su(){try{let e=await xp__default.default.getItem(bf);return e?JSON.parse(e):[]}catch{return []}}async function tT(e){try{let r=(await su()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,eT);await xp__default.default.setItem(bf,JSON.stringify(o));}catch{}}async function rT(e){try{let r=(await su()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await xp__default.default.setItem(bf,JSON.stringify(r)),r}catch{return []}}function Cf({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:h=true}){let{colors:T,fonts:d,components:f}=L(),[b,v]=ws.useState(""),[x,k]=ws.useState([]);ws.useEffect(()=>{e&&su().then(k);},[e]),ws.useEffect(()=>{e||v("");},[e]);let R=ws.useMemo(()=>{let y=[];return r.forEach(D=>{D.chains.forEach(B=>{y.push({token:D,chain:B});});}),y},[r]),w=ws.useMemo(()=>{let y=[],D=new Set,B=(V,F,W,U)=>{let Z=`${V}-${F}:${W}`;if(D.has(Z))return;let le=r.find(ze=>ze.symbol===V);if(!le)return;let ne=le.chains.find(ze=>ze.chain_type===F&&ze.chain_id===W);ne&&(D.add(Z),y.push({token:le,chain:ne,isRecent:U}));};return x.forEach(V=>{B(V.symbol,V.chainType,V.chainId,true);}),jg.forEach(V=>{B(V.symbol,V.chainType,V.chainId,false);}),y},[r,x]),I=ws.useMemo(()=>{if(!b.trim())return R;let y=b.toLowerCase();return R.filter(({token:D,chain:B})=>D.symbol.toLowerCase().includes(y)||D.name.toLowerCase().includes(y)||B.chain_name.toLowerCase().includes(y))},[R,b]),m=(y,D,B)=>jg.some(V=>V.symbol===y&&V.chainType===D&&V.chainId===B),u=async(y,D)=>{let B=`${D.chain_type}:${D.chain_id}`;if(!m(y.symbol,D.chain_type,D.chain_id)){await tT({symbol:y.symbol,chainType:D.chain_type,chainId:D.chain_id});let V=await su();k(V);}v(""),s(y.symbol,B),t();},S=async(y,D)=>{let B=await rT({symbol:y.symbol,chainType:D.chain_type,chainId:D.chain_id});k(B);};return jsxRuntime.jsxs(Mt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:h,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[Zt.header,!h&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:Zt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.headerTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Zt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(_t,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Zt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Zt.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:d.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:b,onChangeText:v,autoCapitalize:"none",autoCorrect:false})}),!l&&w.length>0&&!b&&jsxRuntime.jsxs(reactNative.View,{style:Zt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.quickSelectScroll,children:w.map(({token:y,chain:D,isRecent:B})=>{let V=`${D.chain_type}:${D.chain_id}`;y.symbol===o&&V===n;return jsxRuntime.jsxs(reactNative.View,{children:[B&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>S(y,D),style:Zt.removeButton,children:jsxRuntime.jsx(_t,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(y,D),activeOpacity:.7,style:[Zt.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Zt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(y,"png"))},style:Zt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(D,"png"))},style:[Zt.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Zt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.quickSelectSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.quickSelectChain,{color:f.card.subtitleColor,fontFamily:d.regular}],children:D.chain_name})]})]})]},`quick-${y.symbol}-${V}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Bt,{style:Zt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.tokenListContent,children:I.length===0?jsxRuntime.jsx(reactNative.View,{style:Zt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Zt.emptyText,{color:T.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):I.map(({token:y,chain:D})=>{let B=`${D.chain_type}:${D.chain_id}`,V=y.symbol===o&&B===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(y,D),activeOpacity:.7,style:[Zt.tokenItem,{backgroundColor:V?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Zt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(y,"png"))},style:Zt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(D,"png"))},style:[Zt.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Zt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.tokenSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.tokenChainName,{color:f.card.subtitleColor,fontFamily:d.regular}],children:D.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Zt.minDeposit,{color:f.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",D.minimum_deposit_amount_usd]})]})]},`${y.symbol}-${B}`)})})]})}var Zt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},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 hc=(e,t)=>`${t}:${e}`,aT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function wf({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:b,onSelectedTokenIconUrl:v,wallets:x,borderTopLeftRadius:k,borderTopRightRadius:R,sheetBorderRadius:w}){let{colors:I,fonts:m,components:u}=L(),S=a&&l?`${a}:${l}`:"solana:mainnet",[y,D]=ws.useState("USDC"),[B,V]=ws.useState(S),[F,W]=ws.useState([]),[U,Z]=ws.useState(!x?.length),le=x?.length?x:F,[ne,ze]=ws.useState([]),[K,de]=ws.useState(true),[X,G]=ws.useState(false),[q,te]=ws.useState(false),[xe,rt]=ws.useState(false),[Ue,se]=ws.useState([]),[Fe,Ne]=ws.useState(new Map),[ot]=ws.useState(()=>new Date),[lt,qe]=ws.useState(null),[Ee,De]=ws.useState(false),[_e,Se]=ws.useState(null),[Ge,Qe]=ws.useState(false);ws.useEffect(()=>{_e&&f?.(_e);},[_e]),ws.useEffect(()=>{Ee&&(b?.(true),De(false));},[Ee]);let dt=new Map;ne.forEach($=>{$.chains.forEach(Te=>{let _=`${Te.chain_type}:${Te.chain_id}`;dt.has(_)||dt.set(_,Te);});});let er=Array.from(dt.values()),He=aT(B),ve=er.find($=>$.chain_type===He.chainType&&$.chain_id===He.chainId),nt=ve?.chain_type||"ethereum",ut=Io(le,nt),Ve=ut?.address||"",ye=ws.useRef(false);ws.useEffect(()=>{async function $(){try{de(!0),qe(null);let _=await ii(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(ze(_.data),_.data.length>0&&!ye.current){ye.current=!0;let C,O;if(a&&l)if(c)for(let N of _.data){let H=N.chains.find(j=>j.chain_type===a&&j.chain_id===l&&j.token_address.toLowerCase()===c.toLowerCase());if(H){C=N,O=H;break}}else {let N=j=>j.chain_type===a&&j.chain_id===l,H=_.data.find(j=>j.symbol==="USDC"&&j.chains.some(N));if(H)C=H,O=H.chains.find(N);else for(let j of _.data){let pe=j.chains.find(N);if(pe){C=j,O=pe;break}}}if(!C&&s)for(let N of _.data){let H=N.chains.find(j=>j.token_address.toLowerCase()===s.toLowerCase());if(H){C=N,O=H;break}}C||(C=_.data.find(N=>N.symbol==="USDC"),C&&C.chains.length>0&&(O=C.chains[0])),C||(C=_.data.find(N=>N.symbol==="USDT"),C&&C.chains.length>0&&(O=C.chains[0])),C||(C=_.data[0],C.chains.length>0&&(O=C.chains[0])),C&&D(C.symbol),O&&V(hc(O.chain_id,O.chain_type));}}catch(Te){console.error("Error fetching supported tokens:",Te),qe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Te});}finally{de(false);}}$();},[t,s,n,o,a,l,c,d]),ws.useEffect(()=>{h&&h(Ue);},[Ue,h]),ws.useEffect(()=>{if(x?.length){Z(false);return}if(F.length>0){Z(false);return}let $=null,Te=false,_=async()=>{if(!Te){Z(true);try{let C=await zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Te||(W(C.data),qe(null),Z(!1));}catch(C){console.error("Error fetching wallets, retrying in 5s:",C),Te||(qe(C instanceof Error?C.message:"Failed to load wallets"),Z(false),$=setTimeout(_,5e3));}}};return _(),()=>{Te=true,$&&clearTimeout($);}},[e,r,o,n,s,t,x,F.length]);let Be=ut?.id??"",{showWaitingUi:Nt,handleIveDeposited:he}=kn({depositConfirmationMode:p,depositAddress:Ve,chain:B,externalUserId:e,publishableKey:t,modalOpenedAt:ot,depositWalletId:Be,depositExecutions:Ue,trackedExecutions:Fe,setDepositExecutions:se,setTrackedExecutions:Ne,setLatestExecution:Se,setShowStatusSheet:De,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});ws.useEffect(()=>{if(!ne.length)return;let $=ne.find(_=>_.symbol===y);if(!$||$.chains.length===0){let _=ne.find(C=>C.symbol==="USDC")||ne[0];_&&(D(_.symbol),_.chains.length>0&&V(hc(_.chains[0].chain_id,_.chains[0].chain_type)));return}if(!$.chains.some(_=>hc(_.chain_id,_.chain_type)===B)){let _=$.chains[0];V(hc(_.chain_id,_.chain_type));}},[y,ne,B]);let st=ne.find($=>$.symbol===y),ht=Ae(st,"png")||void 0;ws.useEffect(()=>{v?.(ht);},[ht]);let je=(st?.chains||[]).find($=>hc($.chain_id,$.chain_type)===B),kt=async()=>{if(Ve)try{reactNative.Clipboard.setString(Ve),G(!0),setTimeout(()=>G(!1),2e3);}catch($){console.error("Failed to copy:",$);}},Xe=je?.estimated_price_impact_percent??0,Re=je?.max_slippage_percent??.25,Ye=je?.minimum_deposit_amount_usd??3;return K?jsxRuntime.jsxs(reactNative.View,{style:ae.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ae.loadingText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):lt&&ne.length===0?jsxRuntime.jsxs(reactNative.View,{style:ae.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.errorText,{color:I.error,fontFamily:m.regular}],children:lt}),jsxRuntime.jsx(reactNative.Text,{style:[ae.errorHint,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ae.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(true),disabled:K||ne.length===0,style:[ae.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:K?jsxRuntime.jsxs(reactNative.View,{style:ae.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.loadingIcon,{backgroundColor:I.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:ae.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.loadingLine,{backgroundColor:I.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[ae.loadingLine,{backgroundColor:I.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ae.tokenIconWrapper,children:[st&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(st,"png"))},style:ae.tokenMainIcon}),(je||ve)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(je||ve,"png"))},style:[ae.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:st?.symbol||y}),jsxRuntime.jsx(reactNative.Text,{style:[ae.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:je?.chain_name||ve?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ae.minDepositText,{color:I.warning,fontFamily:m.medium}],children:["$",Ye," minimum"]}),jsxRuntime.jsx(Wr,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Cf,{visible:xe,onClose:()=>rt(false),tokens:ne,selectedToken:y,selectedChainKey:B,onSelect:($,Te)=>{D($),V(Te);},borderTopLeftRadius:w?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:w?.tokenSelector?.borderTopRightRadius??R}),jsxRuntime.jsx(reactNative.View,{style:ae.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ae.qrWrapper,{backgroundColor:I.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:U?jsxRuntime.jsxs(reactNative.View,{style:ae.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ae.loadingText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):Ve?jsxRuntime.jsx(ds,{value:Ve,size:180,logoUri:ie(Ae(je,"png")||or("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:ae.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ae.errorText,{color:I.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:ae.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),X&&jsxRuntime.jsxs(reactNative.View,{style:ae.copiedIndicator,children:[jsxRuntime.jsx(pt,{size:14,color:I.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ae.copiedText,{color:I.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Lr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!U&&Ve?kt:void 0,contentStyle:ae.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:U?"Loading...":Ve||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:ae.addressCopyIcon,children:jsxRuntime.jsx(pn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ae.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(!q),style:ae.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ho,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ae.chevronContainer,children:q?jsxRuntime.jsx(_n,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(cr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),q&&jsxRuntime.jsxs(reactNative.View,{style:ae.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",Xe.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(mn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(To,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",Re.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(mn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Cg,{depositConfirmationMode:p,depositAddress:Ve,showWaitingUi:Nt,latestExecution:_e,onIveDeposited:he}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:ae.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[ae.termsText,{color:I.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Mt,{visible:Ge,onClose:()=>Qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:w?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:w?.infoSheet?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[ae.sheetHeader,{borderBottomColor:I.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ae.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ae.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(false),style:ae.sheetCloseButton,children:jsxRuntime.jsx(_t,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ae.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Xe.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.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:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ae.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(To,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Re.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.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."})]})]})]})]})}var ae=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 Xa=(e,t)=>`${t}:${e}`,pT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},fT=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function cu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:b,onSelectedTokenIconUrl:v,onShowInfoSheet:x,onInfoSheetData:k,wallets:R,borderTopLeftRadius:w,borderTopRightRadius:I,sheetBorderRadius:m}){let{colors:u,fonts:S,components:y}=L(),D=a&&l?`${a}:${l}`:"solana:mainnet",[B,V]=ws.useState("USDC"),[F,W]=ws.useState(D),[U,Z]=ws.useState([]),[le,ne]=ws.useState(!R?.length),ze=R?.length?R:U,[K,de]=ws.useState([]),[X,G]=ws.useState(true),[q,te]=ws.useState(false),[xe,rt]=ws.useState(false),[Ue,se]=ws.useState(false),[Fe,Ne]=ws.useState([]),[ot,lt]=ws.useState(new Map),[qe]=ws.useState(()=>new Date),[Ee,De]=ws.useState(null),[_e,Se]=ws.useState(false),[Ge,Qe]=ws.useState(null),[dt,er]=ws.useState(false),[He,ve]=ws.useState(false),[nt,ut]=ws.useState(""),[Ve,ye]=ws.useState(""),Be=ws.useRef(new reactNative.Animated.Value(0)).current;ws.useEffect(()=>{let be=reactNative.Animated.loop(reactNative.Animated.timing(Be,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return be.start(),()=>be.stop()},[Be]);let Nt=Be.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});ws.useEffect(()=>{Ge&&f?.(Ge);},[Ge]),ws.useEffect(()=>{_e&&(b?.(true),Se(false));},[_e]);let he=new Map;K.forEach(be=>{be.chains.forEach(gt=>{let it=`${gt.chain_type}:${gt.chain_id}`;he.has(it)||he.set(it,gt);});});let st=Array.from(he.values()),ht=pT(F),tr=st.find(be=>be.chain_type===ht.chainType&&be.chain_id===ht.chainId),je=tr?.chain_type||"ethereum",kt=Io(ze,je),Xe=kt?.address||"",Re=ws.useRef(false);ws.useEffect(()=>{async function be(){try{G(!0),De(null);let it=await ii(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(de(it.data),it.data.length>0&&!Re.current){Re.current=!0;let Je,et;if(a&&l)if(c)for(let Me of it.data){let qt=Me.chains.find(St=>St.chain_type===a&&St.chain_id===l&&St.token_address.toLowerCase()===c.toLowerCase());if(qt){Je=Me,et=qt;break}}else {let Me=St=>St.chain_type===a&&St.chain_id===l,qt=it.data.find(St=>St.symbol==="USDC"&&St.chains.some(Me));if(qt)Je=qt,et=qt.chains.find(Me);else for(let St of it.data){let wo=St.chains.find(Me);if(wo){Je=St,et=wo;break}}}if(!Je&&s)for(let Me of it.data){let qt=Me.chains.find(St=>St.token_address.toLowerCase()===s.toLowerCase());if(qt){Je=Me,et=qt;break}}Je||(Je=it.data.find(Me=>Me.symbol==="USDC"),Je&&Je.chains.length>0&&(et=Je.chains[0])),Je||(Je=it.data.find(Me=>Me.symbol==="USDT"),Je&&Je.chains.length>0&&(et=Je.chains[0])),Je||(Je=it.data[0],Je.chains.length>0&&(et=Je.chains[0])),Je&&V(Je.symbol),et&&W(Xa(et.chain_id,et.chain_type));}}catch(gt){console.error("Error fetching supported tokens:",gt),De("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:gt});}finally{G(false);}}be();},[t,s,n,o,a,l,c,d]),ws.useEffect(()=>{h&&h(Fe);},[Fe,h]),ws.useEffect(()=>{if(R?.length){ne(false);return}if(U.length>0){ne(false);return}let be=null,gt=false,it=async()=>{if(!gt){ne(true);try{let Je=await zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);gt||(Z(Je.data),De(null),ne(!1));}catch(Je){console.error("Error fetching wallets, retrying in 5s:",Je),gt||(De(Je instanceof Error?Je.message:"Failed to load wallets"),ne(false),be=setTimeout(it,5e3));}}};return it(),()=>{gt=true,be&&clearTimeout(be);}},[e,r,o,n,s,t,R,U.length]);let Ye=kt?.id??"",{showWaitingUi:$,handleIveDeposited:Te}=kn({depositConfirmationMode:p,depositAddress:Xe,chain:F,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:Ye,depositExecutions:Fe,trackedExecutions:ot,setDepositExecutions:Ne,setTrackedExecutions:lt,setLatestExecution:Qe,setShowStatusSheet:Se,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d}),_=p==="manual"&&Xe&&!$;ws.useEffect(()=>{if(!K.length)return;let be=K.find(it=>it.symbol===B);if(!be||be.chains.length===0){let it=K.find(Je=>Je.symbol==="USDC")||K[0];it&&(V(it.symbol),it.chains.length>0&&W(Xa(it.chains[0].chain_id,it.chains[0].chain_type)));return}if(!be.chains.some(it=>Xa(it.chain_id,it.chain_type)===F)){let it=be.chains[0];W(Xa(it.chain_id,it.chain_type));}},[B,K,F]);let C=K.find(be=>be.symbol===B),O=Ae(C,"png")||void 0;ws.useEffect(()=>{v?.(O);},[O]);let N=C?.chains||[],H=N.find(be=>Xa(be.chain_id,be.chain_type)===F),j=async()=>{if(Xe)try{reactNative.Clipboard.setString(Xe),te(!0),setTimeout(()=>te(!1),2e3);}catch(be){console.error("Failed to copy:",be);}},pe=H?.estimated_price_impact_percent??0,$e=H?.max_slippage_percent??.25,A=H?.minimum_deposit_amount_usd??3,E=H?.chain_name||tr?.chain_name||"Network",rr=ws.useMemo(()=>{if(!nt.trim())return N;let be=nt.toLowerCase();return N.filter(gt=>gt.chain_name.toLowerCase().includes(be))},[N,nt]),Oe=ws.useMemo(()=>{if(!Ve.trim())return K;let be=Ve.toLowerCase();return K.filter(gt=>gt.symbol.toLowerCase().includes(be)||gt.name?.toLowerCase().includes(be)||gt.chains.some(it=>it.chain_name.toLowerCase().includes(be)))},[K,Ve]);return X?jsxRuntime.jsxs(reactNative.View,{style:ue.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ue.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading currencies..."})]}):Ee&&K.length===0?jsxRuntime.jsxs(reactNative.View,{style:ue.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.errorText,{color:u.error,fontFamily:S.regular}],children:Ee}),jsxRuntime.jsx(reactNative.Text,{style:[ue.errorHint,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ue.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ue.content,children:[jsxRuntime.jsxs(reactNative.View,{style:ue.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.intentAddressLabel,{color:u.foregroundMuted,fontFamily:S.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[ue.qrCard,{backgroundColor:u.background,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth>0?y.card.borderWidth:1,borderColor:y.card.borderColor}],children:le?jsxRuntime.jsxs(reactNative.View,{style:ue.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ue.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading..."})]}):Xe?jsxRuntime.jsx(reactNative.View,{style:ue.qrWrapper,children:jsxRuntime.jsx(ds,{value:Xe,size:200,logoUri:ie(Ae(C,"png")||or("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ie(Ae(H,"png")||or("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:ue.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ue.errorText,{color:u.error,fontFamily:S.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:ue.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{ut(""),ve(true);},style:[ue.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[(H||tr)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(H||tr,"png"))},style:ue.selectorPillIcon}),jsxRuntime.jsx(cr,{size:14,color:y.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{ye(""),se(true);},disabled:X||K.length===0,style:[ue.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[C&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(C,"png"))},style:ue.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ue.selectorPillText,{color:y.card.titleColor,fontFamily:S.semibold}],children:C?.symbol||B}),jsxRuntime.jsx(cr,{size:14,color:y.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:ue.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:j,style:[ue.addressPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.addressPillText,{color:y.card.titleColor,fontFamily:S.regular}],numberOfLines:1,children:le?"Loading...":Xe?fT(Xe):"No address"}),q?jsxRuntime.jsx(pt,{size:14,color:u.success,strokeWidth:2}):jsxRuntime.jsx(pn,{size:14,color:y.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:$&&!Ge?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:Nt}]},children:jsxRuntime.jsx(kl,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:S.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k?.({priceImpact:pe,maxSlippage:$e,minDepositUsd:A,chainName:E}),x?.(true);},style:ue.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(mn,{size:14,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[ue.infoFooterText,{color:y.card.subtitleColor,fontFamily:S.regular}],numberOfLines:1,children:["$",A," ",E," Minimum and ","<","1 min Processing"]})]}),_?jsxRuntime.jsxs(reactNative.View,{style:ue.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:ue.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Te,activeOpacity:.8,style:[ue.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ue.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:S.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:ue.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:j,activeOpacity:.8,style:[ue.ctaButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[ue.ctaText,{color:u.foreground,fontFamily:S.semibold}],children:q?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:j,activeOpacity:.8,style:[ue.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[ue.ctaText,{color:"#FFFFFF",fontFamily:S.semibold}],children:q?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(Mt,{visible:Ue,onClose:()=>{se(false),ye("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[ue.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ue.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ue.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{se(false),ye("");},style:ue.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(_t,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ue.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ue.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:y.search.placeholderColor,value:Ve,onChangeText:ye,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Bt,{style:ue.sheetList,contentContainerStyle:ue.sheetListContent,showsVerticalScrollIndicator:false,children:Oe.length===0?jsxRuntime.jsx(reactNative.View,{style:ue.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ue.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No tokens found"})}):Oe.map(be=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(be.symbol),se(false),ye("");},activeOpacity:.7,style:[ue.sheetItem,{backgroundColor:B===be.symbol?y.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(be,"png"))},style:ue.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ue.sheetItemTitle,{color:y.card.titleColor,fontFamily:S.medium}],children:be.symbol}),jsxRuntime.jsx(reactNative.View,{style:ue.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[ue.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ue.sheetItemBadgeText,{color:y.card.subtitleColor,fontFamily:S.medium}],children:[be.chains.length," chain",be.chains.length!==1?"s":""]})})]},be.symbol))})]}),jsxRuntime.jsxs(Mt,{visible:He,onClose:()=>{ve(false),ut("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[ue.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ue.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ue.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{ve(false),ut("");},style:ue.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(_t,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ue.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ue.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search networks",placeholderTextColor:y.search.placeholderColor,value:nt,onChangeText:ut,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Bt,{style:ue.sheetList,contentContainerStyle:ue.sheetListContent,showsVerticalScrollIndicator:false,children:rr.length===0?jsxRuntime.jsx(reactNative.View,{style:ue.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ue.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No networks found"})}):rr.map(be=>{let gt=Xa(be.chain_id,be.chain_type),it=F===gt;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{W(gt),ve(false),ut("");},activeOpacity:.7,style:[ue.chainItem,{backgroundColor:it?y.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(be,"png"))},style:ue.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:ue.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[ue.chainItemName,{color:y.card.titleColor,fontFamily:S.medium}],children:be.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[ue.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ue.chainMinBadgeText,{color:u.warning,fontFamily:S.medium}],children:["$",be.minimum_deposit_amount_usd," Minimum"]})})]},gt)})})]})]})}var ue=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},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"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Xg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function gT(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 uu({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:h,heightCompleted:T,heightCompletedExpanded:d}){let{components:f}=L(),[b,v]=ws.useState(false),x=t==="succeeded";return jsxRuntime.jsx(Mt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:x?b?d??T??.55:T??.55:h??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:fr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:fr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_t,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.ScrollView,{style:fr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:fr.scrollContent,children:jsxRuntime.jsx(yT,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,showDetails:b,onToggleDetails:()=>v(!b)})})]})})}function yT({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:s,showDetails:i,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:p,components:h}=L(),[T,d]=ws.useState(false),f=i??T,b=a??(()=>d(I=>!I)),v=e==="pending"||e==="waiting"||e==="delayed",x=e==="succeeded",k=!!r||!!o,R=()=>{r&&reactNative.Linking.openURL(r);},w=()=>{o&&reactNative.Linking.openURL(o);};return jsxRuntime.jsxs(reactNative.View,{style:[fr.container,l],children:[jsxRuntime.jsx(reactNative.View,{style:fr.iconContainer,children:v?jsxRuntime.jsx(vt,{size:80,strokeWidth:4,iconSize:56,children:t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(t)},style:fr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[fr.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(t)},style:fr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[fr.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[fr.statusBadge,{backgroundColor:h.container.iconBackgroundColor}],children:jsxRuntime.jsx(pt,{size:16,color:h.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[fr.title,{color:h.container.titleColor,fontFamily:p.semibold}],children:v?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[fr.amount,{color:h.container.titleColor,fontFamily:p.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[fr.date,{color:h.container.subtitleColor,fontFamily:p.regular}],children:gT(n)}),jsxRuntime.jsx(reactNative.Text,{style:[fr.subtitle,{color:h.container.subtitleColor,fontFamily:p.regular}],children:v?"This usually takes less than a minute.":"Your account has been credited successfully!"}),x&&k&&jsxRuntime.jsxs(reactNative.View,{style:fr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[fr.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:fr.detailsToggle,onPress:b,children:[jsxRuntime.jsx(reactNative.Text,{style:[fr.detailsToggleText,{color:h.container.actionTitle,fontFamily:p.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(_n,{size:18,color:h.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(cr,{size:18,color:h.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:fr.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[fr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:R,children:[jsxRuntime.jsx(reactNative.Text,{style:[fr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[fr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Xg(r)}),jsxRuntime.jsx(Zo,{size:16,color:h.card.actionColor,strokeWidth:2})]}),o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[fr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:w,children:[jsxRuntime.jsx(reactNative.Text,{style:[fr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[fr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Xg(o)}),jsxRuntime.jsx(Zo,{size:16,color:h.card.actionColor,strokeWidth:2})]})]})]})]})}var fr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},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 Sf({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:h}=L(),T=[{icon:jsxRuntime.jsx(ho,{size:14,color:h.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(fn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(fn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(To,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(Mt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:cn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:cn.header,children:[jsxRuntime.jsxs(reactNative.View,{style:cn.titleRow,children:[jsxRuntime.jsx(mn,{size:16,color:h.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[cn.title,{color:h.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:cn.closeButton,children:jsxRuntime.jsx(_t,{size:18,color:h.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:cn.rows,children:[T.map((d,f)=>jsxRuntime.jsxs(reactNative.View,{style:cn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[cn.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:d.icon}),jsxRuntime.jsx(reactNative.Text,{style:[cn.label,{color:h.card.titleColor,fontFamily:p.regular}],children:d.label})]},f)),jsxRuntime.jsxs(reactNative.View,{style:cn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[cn.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:14,color:h.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[cn.label,{color:h.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var cn=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var Rn={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"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function xT(){let{colors:e,components:t}=L(),r=ws.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ws.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:[ms.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:ms.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:ms.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:ms.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var ms=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 vT({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=L(),s=({tab:i,label:a,glyph:l})=>{let c=e===i,p=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:gc.item,activeOpacity:.8,onPress:()=>t(i),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[gc.badge,{backgroundColor:p}],children:jsxRuntime.jsx(reactNative.Text,{style:[gc.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[gc.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[gc.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(s,{tab:"crypto",label:Rn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(s,{tab:"cash",label:Rn.tabs.cash,glyph:"$"})]})}var gc=reactNative.StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function RT({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,showBalance:d=false,hideDepositTracker:f,enableTransferCrypto:b,enableCashApp:v,enableConnectWallet:x,enableFiatOnramp:k,enableStripeLinkPay:R=false,StripeOnrampComponent:w,stripeOnrampEmail:I,stripeOnrampPhone:m,stripeMerchantIdentifier:u,stripePaymentSelectorPosition:S,stripeSkipSuccessConfirmation:y,stripeTheme:D,depositConfirmationMode:B="auto_ui",transferInputVariant:V="double_input",depositMenuDisplay:F="stacked",initialScreen:W="main",onDepositSuccess:U,onDepositError:Z,sheetBorderRadius:le}){let ne=le?.globalBorderTopLeftRadius,ze=le?.globalBorderTopRightRadius,{colors:K,fonts:de}=L(),[X,G]=ws.useState([]),[q,te]=ws.useState(null),[xe,rt]=ws.useState("amount"),[Ue,se]=ws.useState(false),[Fe,Ne]=ws.useState(null),[ot,lt]=ws.useState(void 0),[qe,Ee]=ws.useState(false),[De,_e]=ws.useState(null),Se=b??q?.transfer_crypto?.enabled??true,Ge=x??q?.connect_wallet?.enabled??false,Qe=v??q?.cash_app?.enabled??false,dt=k??q?.fiat_onramp?.enabled??true,er=f?false:q?.deposit_tracker?.enabled??true,He=b??q?.transfer_crypto?.enabled??false,ve=x??q?.connect_wallet?.enabled??false,nt=v??q?.cash_app?.enabled??false,ut=k??q?.fiat_onramp?.enabled??false,Ve=f?false:q?.deposit_tracker?.enabled??false,ye=W==="tracker"&&Ve?"tracker":W==="transfer"&&He?"transfer":W==="card"&&ut?"card":W==="cashapp"&&nt?"cashapp":W==="wallet"&&ve?"wallet":"main",[Be,Nt]=ws.useState(ye==="main"),[he,st]=ws.useState(ye),[ht,tr]=ws.useState("crypto"),{isAllowed:je,isLoading:kt}=mc(o,e);ws.useEffect(()=>{if(!e||q)return;let et=false;return Vl(o).then(async Me=>{if(et)return;let qt=[];for(let St of Me?.transfer_crypto?.networks??[]){let wo=St.icon_urls.find(Qr=>Qr.format==="png")?.url||St.icon_urls.find(Qr=>Qr.format==="svg")?.url;wo&&qt.push(ie(wo));}for(let St of Me?.payment_networks?.networks??[]){let wo=St.icon_urls.find(Qr=>Qr.format==="png")?.url||St.icon_urls.find(Qr=>Qr.format==="svg")?.url;wo&&qt.push(ie(wo));}qt.length>0&&await ec(qt),et||te(Me);}).catch(console.error),()=>{et=true;}},[e,q,o]);let Xe=()=>{t();},Re=ws.useRef(false);ws.useEffect(()=>{e&&!Re.current&&(st(ye),Nt(ye==="main"),rt("amount"),Ee(false),_e(null),tr("crypto")),Re.current=e;},[e,ye]),ws.useEffect(()=>{if(!e||!q)return;let et=W==="wallet"&&Ge?"wallet":W==="transfer"&&Se?"transfer":W==="card"&&dt?"card":W==="cashapp"&&Qe?"cashapp":W==="tracker"&&er?"tracker":null;et&&st(Me=>Me==="main"?et:Me);},[e,q,W,Ge,Se,dt,Qe,er]),ws.useEffect(()=>{if(!q)return;(he==="transfer"&&!Se||he==="card"&&!dt||he==="cashapp"&&!Qe||he==="wallet"&&!Ge||he==="tracker"&&!er)&&(st("main"),Nt(true));},[q,he,Se,dt,Qe,Ge,er]);let Ye=ws.useCallback(et=>{et.length!==0&&G(Me=>{let qt=new Map(Me.map(St=>[St.id,St]));for(let St of et)qt.set(St.id,St);return Array.from(qt.values())});},[]),$=ws.useCallback(()=>{Ee(false),_e(null),Be?(st("main"),rt("amount")):Xe();},[Be,Xe]),Te=ws.useRef(reactNative.AppState.currentState==="active"),_=ws.useRef(0);ws.useEffect(()=>{if(reactNative.Platform.OS!=="android")return;let et=reactNative.AppState.addEventListener("change",Me=>{Me==="active"&&!Te.current&&(_.current=Date.now()),Te.current=Me==="active";});return ()=>et.remove()},[]);let C=ws.useCallback(()=>{if(reactNative.Platform.OS==="android"){let et=!Te.current,Me=Date.now()-_.current<800;if(et||Me)return}$();},[$]),O=X.filter(et=>et.status==="pending"||et.status==="waiting").length,H=!!(i&&a&&l&&c&&o)&&d!==false&&!!q,j=Pl.includes(a)?a:void 0,pe=kt||e&&!q,$e=je===false,A=null;if(he==="stripe"&&w){let et=jsxRuntime.jsx(w,{publishableKey:o,email:I,phone:m,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,merchantIdentifier:u,paymentSelectorPosition:S,skipSuccessConfirmation:y,appName:q?.project_name??"",onClose:$});A=D?jsxRuntime.jsx(da,{...D,children:et}):et;}let E=he==="stripe"||he==="transfer"||he==="card"||he==="cashapp"||he==="wallet"?.9:he==="tracker"?.6:he==="main"?Qe||Ge?.6:.5:void 0,rr=he==="main"?.9:void 0,be={main:le?.main,transfer:le?.transferCrypto,card:le?.buyWithCard,stripe:le?.stripeLinkPay,cashapp:le?.cashApp,wallet:le?.connectWallet,tracker:le?.depositsTracker}[he],gt=be?.borderTopLeftRadius??ne,it=be?.borderTopRightRadius??ze,Je=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Fe&&jsxRuntime.jsx(uu,{visible:Ue,useModal:false,status:Fe.status,tokenIconUrl:Fe.destination_token_metadata?.icon_urls?.find(et=>et.format==="png")?.url||Fe.destination_token_metadata?.icon_url||ot,explorerUrl:Fe.explorer_url,completionExplorerUrl:Fe.destination_explorer_url,date:Fe.created_at?new Date(Fe.created_at):void 0,amountUsd:Fe.source_amount_usd?parseFloat(Fe.source_amount_usd):void 0,onClose:()=>se(false),heightProcessing:he==="card"||he==="wallet"?.35:void 0,heightCompleted:he==="card"||he==="wallet"?.41:void 0,heightCompletedExpanded:he==="card"||he==="wallet"?.53:void 0,borderTopLeftRadius:le?.depositStatus?.borderTopLeftRadius??ne,borderTopRightRadius:le?.depositStatus?.borderTopRightRadius??ze}),De&&jsxRuntime.jsx(Sf,{visible:qe,useModal:false,onClose:()=>Ee(false),priceImpact:De.priceImpact,maxSlippage:De.maxSlippage,minDepositUsd:De.minDepositUsd,chainName:De.chainName,borderTopLeftRadius:le?.infoSheet?.borderTopLeftRadius??ne,borderTopRightRadius:le?.infoSheet?.borderTopRightRadius??ze})]});return jsxRuntime.jsxs(Mt,{visible:e,onClose:he==="main"?Xe:C,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:E,maxHeightPercent:rr,borderTopLeftRadius:gt,borderTopRightRadius:it,overlay:Je,children:[he==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{title:n,showBack:false,onClose:Xe,showBalance:H,balanceAddress:i,balanceChainType:j,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:q?.project_name}),pe&&jsxRuntime.jsx(xT,{}),!pe&&$e&&jsxRuntime.jsxs(reactNative.View,{style:Xr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Xr.iconContainer,{backgroundColor:K.cardHover}],children:jsxRuntime.jsx(xl,{size:32,color:K.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Xr.blockedTitle,{color:K.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Xr.blockedDescription,{color:K.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!pe&&!$e&&(()=>{let et=Se?jsxRuntime.jsx(tc,{onPress:()=>st("transfer"),title:Rn.transferCrypto.title,subtitle:Rn.transferCrypto.subtitle,featuredTokens:q?.transfer_crypto?.networks},"transfer"):null,Me=dt?jsxRuntime.jsx(oc,{onPress:()=>st("card"),title:Rn.depositWithCard.title,subtitle:Rn.depositWithCard.subtitle,paymentNetworks:q?.payment_networks?.networks},"card"):null,qt=Ge?jsxRuntime.jsx(lc,{onPress:()=>st("wallet"),featuredWallets:q?.connect_wallet?.wallets},"wallet"):null,St=Qe?jsxRuntime.jsx(ac,{onPress:()=>st("cashapp")},"cashapp"):null,wo=R&&w?jsxRuntime.jsx(sc,{onPress:()=>st("stripe"),title:Rn.stripeLinkPay.title,subtitle:Rn.stripeLinkPay.subtitle},"stripe"):null,Qr=er?jsxRuntime.jsx(nc,{onPress:()=>st("tracker"),title:Rn.depositTracker.title,subtitle:Rn.depositTracker.subtitle,badge:O>0?O:void 0},"tracker"):null;return jsxRuntime.jsxs(reactNative.View,{style:Xr.optionsContainer,children:[F==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vT,{selected:ht,onSelect:tr}),ht==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et,qt]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Me,St,wo]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et,qt,Me,St,wo]}),Qr]})})()]}),he==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{title:Rn.transferCrypto.title,showBack:false,onClose:$,showBalance:H,balanceAddress:i,balanceChainType:j,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:q?.project_name}),kt&&jsxRuntime.jsx(reactNative.View,{style:[Xr.centeredContainer,Xr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:K.primary})}),!kt&&$e&&jsxRuntime.jsxs(reactNative.View,{style:[Xr.centeredContainer,Xr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Xr.iconContainer,{backgroundColor:K.cardHover}],children:jsxRuntime.jsx(xl,{size:32,color:K.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Xr.blockedTitle,{color:K.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Xr.blockedDescription,{color:K.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!kt&&!$e&&jsxRuntime.jsx(Bt,{style:Xr.transferScrollContainer,contentContainerStyle:V==="compact"?Xr.scrollContentCompact:Xr.scrollContent,showsVerticalScrollIndicator:false,children:V==="compact"?jsxRuntime.jsx(cu,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,depositConfirmationMode:B,onExecutionsChange:Ye,onDepositSuccess:U,onDepositError:Z,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,onShowInfoSheet:Ee,onInfoSheetData:_e,borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:le?.tokenSelector,chainSelector:le?.chainSelector,infoSheet:le?.infoSheet,depositStatus:le?.depositStatus}}):V==="single_input"?jsxRuntime.jsx(wf,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,depositConfirmationMode:B,onExecutionsChange:Ye,onDepositSuccess:U,onDepositError:Z,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:le?.tokenSelector,infoSheet:le?.infoSheet,depositStatus:le?.depositStatus}}):jsxRuntime.jsx(qd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,depositConfirmationMode:B,onExecutionsChange:Ye,onDepositSuccess:U,onDepositError:Z,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:le?.tokenSelector,chainSelector:le?.chainSelector,infoSheet:le?.infoSheet,depositStatus:le?.depositStatus}})})]}),he==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{title:`Deposit ${s||"USDC"}`,showBack:xe==="onramp",onBack:()=>rt("amount"),onClose:$,showBalance:H,balanceAddress:i,balanceChainType:j,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:q?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Xr.buyWithCardContainer,children:jsxRuntime.jsx(Zd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onDepositSuccess:U,onDepositError:Z,onExecutionsChange:Ye,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,view:xe,onViewChange:et=>rt(et),borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{providerModal:le?.providerModal,webView:le?.webView,currencyModal:le?.currencyModal}})})]}),he==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:Xr.cashAppContainer,children:jsxRuntime.jsx(Bd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:$,onClose:$,onDepositSuccess:U})}),he==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:Xr.connectWalletContainer,children:jsxRuntime.jsx(Nd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:$,onClose:$,onDepositSuccess:U,onDepositError:Z,onExecutionsChange:Ye,onLatestExecution:Ne,onShowStatusSheet:se})}),he==="stripe"&&A&&jsxRuntime.jsx(reactNative.View,{style:Xr.stripeLinkPayContainer,children:A}),he==="tracker"&&jsxRuntime.jsx(hf,{active:he==="tracker",onClose:$,executions:X,externalUserId:r,publishableKey:o})]})}function hu({theme:e="auto",...t}){return jsxRuntime.jsx(RT,{...t})}var Xr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{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}});var rl=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 Gs,gs,ol,oy,_T=(oy=class extends rl{constructor(){super();re(this,Gs);re(this,gs);re(this,ol);z(this,ol,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,gs)||this.setEventListener(g(this,ol));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,gs))==null||t.call(this),z(this,gs,void 0));}setEventListener(t){var r;z(this,ol,t),(r=g(this,gs))==null||r.call(this),z(this,gs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Gs)!==t&&(z(this,Gs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Gs)=="boolean"?g(this,Gs):globalThis.document?.visibilityState!=="hidden"}},Gs=new WeakMap,gs=new WeakMap,ol=new WeakMap,oy),ny=new _T;var PT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Xn,Ys,iy,FT=(iy=class{constructor(){re(this,Xn,PT);re(this,Ys,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Ys)&&e!==g(this,Xn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Xn),provider:e}),z(this,Xn,e),process.env.NODE_ENV!=="production"&&z(this,Ys,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,Ys,true),g(this,Xn).setTimeout(e,t)}clearTimeout(e){g(this,Xn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,Ys,true),g(this,Xn).setInterval(e,t)}clearInterval(e){g(this,Xn).clearInterval(e);}},Xn=new WeakMap,Ys=new WeakMap,iy),yc=new FT;function sy(e){setTimeout(e,0);}var kf=typeof window>"u"||"Deno"in globalThis;function nl(){}function xf(e){return typeof e=="number"&&e>=0&&e!==1/0}function dy(e,t){return Math.max(e+(t||0)-Date.now(),0)}function il(e,t){return typeof e=="function"?e(t):e}function Ko(e,t){return typeof e=="function"?e(t):e}var DT=Object.prototype.hasOwnProperty;function gu(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=ay(e)&&ay(t);if(!o&&!(ly(e)&&ly(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):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:DT.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=gu(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function yu(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 ay(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ly(e){if(!cy(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!cy(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function cy(e){return Object.prototype.toString.call(e)==="[object Object]"}function vf(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 gu(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 gu(e,t)}return t}function bu(e,t){return typeof e=="function"?e(...t):!!e}var sl=(()=>{let e=()=>kf;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Rf(){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 uy=sy;function VT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=uy,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 bc=VT();var al,ys,ll,py,OT=(py=class extends rl{constructor(){super();re(this,al,true);re(this,ys);re(this,ll);z(this,ll,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(){g(this,ys)||this.setEventListener(g(this,ll));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,ys))==null||t.call(this),z(this,ys,void 0));}setEventListener(t){var r;z(this,ll,t),(r=g(this,ys))==null||r.call(this),z(this,ys,t(this.setOnline.bind(this)));}setOnline(t){g(this,al)!==t&&(z(this,al,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,al)}},al=new WeakMap,ys=new WeakMap,ll=new WeakMap,py),fy=new OT;function my(e){return (e??"online")==="online"?fy.isOnline():true}function hy(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:my(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var Ao,Wt,wc,vo,Js,cl,Ii,bs,Sc,dl,ul,Zs,Xs,Cs,pl,Xt,Cc,If,_f,Pf,Ff,Df,Vf,Of,Cy,by,Bf=(by=class extends rl{constructor(t,r){super();re(this,Xt);re(this,Ao);re(this,Wt);re(this,wc);re(this,vo);re(this,Js);re(this,cl);re(this,Ii);re(this,bs);re(this,Sc);re(this,dl);re(this,ul);re(this,Zs);re(this,Xs);re(this,Cs);re(this,pl,new Set);this.options=r,z(this,Ao,t),z(this,bs,null),z(this,Ii,Rf()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(g(this,Wt).addObserver(this),gy(g(this,Wt),this.options)?Tt(this,Xt,Cc).call(this):this.updateResult(),Tt(this,Xt,Ff).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Lf(g(this,Wt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Lf(g(this,Wt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Tt(this,Xt,Df).call(this),Tt(this,Xt,Vf).call(this),g(this,Wt).removeObserver(this);}setOptions(t){let r=this.options,o=g(this,Wt);if(this.options=g(this,Ao).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ko(this.options.enabled,g(this,Wt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Tt(this,Xt,Of).call(this),g(this,Wt).setOptions(this.options),r._defaulted&&!yu(this.options,r)&&g(this,Ao).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,Wt),observer:this});let n=this.hasListeners();n&&yy(g(this,Wt),o,this.options,r)&&Tt(this,Xt,Cc).call(this),this.updateResult(),n&&(g(this,Wt)!==o||Ko(this.options.enabled,g(this,Wt))!==Ko(r.enabled,g(this,Wt))||il(this.options.staleTime,g(this,Wt))!==il(r.staleTime,g(this,Wt)))&&Tt(this,Xt,If).call(this);let s=Tt(this,Xt,_f).call(this);n&&(g(this,Wt)!==o||Ko(this.options.enabled,g(this,Wt))!==Ko(r.enabled,g(this,Wt))||s!==g(this,Cs))&&Tt(this,Xt,Pf).call(this,s);}getOptimisticResult(t){let r=g(this,Ao).getQueryCache().build(g(this,Ao),t),o=this.createResult(r,t);return BT(this,o)&&(z(this,vo,o),z(this,cl,this.options),z(this,Js,g(this,Wt).state)),o}getCurrentResult(){return g(this,vo)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,Ii).status==="pending"&&g(this,Ii).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){g(this,pl).add(t);}getCurrentQuery(){return g(this,Wt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=g(this,Ao).defaultQueryOptions(t),o=g(this,Ao).getQueryCache().build(g(this,Ao),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Tt(this,Xt,Cc).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),g(this,vo)))}createResult(t,r){let o=g(this,Wt),n=this.options,s=g(this,vo),i=g(this,Js),a=g(this,cl),c=t!==o?t.state:g(this,wc),{state:p}=t,h={...p},T=false,d;if(r._optimisticResults){let y=this.hasListeners(),D=!y&&gy(t,r),B=y&&yy(t,o,r,n);(D||B)&&(h={...h,...hy(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:f,errorUpdatedAt:b,status:v}=h;d=h.data;let x=false;if(r.placeholderData!==void 0&&d===void 0&&v==="pending"){let y;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(y=s.data,x=true):y=typeof r.placeholderData=="function"?r.placeholderData(g(this,ul)?.state.data,g(this,ul)):r.placeholderData,y!==void 0&&(v="success",d=vf(s?.data,y,r),T=true);}if(r.select&&d!==void 0&&!x)if(s&&d===i?.data&&r.select===g(this,Sc))d=g(this,dl);else try{z(this,Sc,r.select),d=r.select(d),d=vf(s?.data,d,r),z(this,dl,d),z(this,bs,null);}catch(y){z(this,bs,y);}g(this,bs)&&(f=g(this,bs),d=g(this,dl),b=Date.now(),v="error");let k=h.fetchStatus==="fetching",R=v==="pending",w=v==="error",I=R&&k,m=d!==void 0,S={status:v,fetchStatus:h.fetchStatus,isPending:R,isSuccess:v==="success",isError:w,isInitialLoading:I,isLoading:I,data:d,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:k,isRefetching:k&&!R,isLoadingError:w&&!m,isPaused:h.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:w&&m,isStale:Af(t,r),refetch:this.refetch,promise:g(this,Ii),isEnabled:Ko(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let y=S.data!==void 0,D=S.status==="error"&&!y,B=W=>{D?W.reject(S.error):y&&W.resolve(S.data);},V=()=>{let W=z(this,Ii,S.promise=Rf());B(W);},F=g(this,Ii);switch(F.status){case "pending":t.queryHash===o.queryHash&&B(F);break;case "fulfilled":(D||S.data!==F.value)&&V();break;case "rejected":(!D||S.error!==F.reason)&&V();break}}return S}updateResult(){let t=g(this,vo),r=this.createResult(g(this,Wt),this.options);if(z(this,Js,g(this,Wt).state),z(this,cl,this.options),g(this,Js).data!==void 0&&z(this,ul,g(this,Wt)),yu(r,t))return;z(this,vo,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!g(this,pl).size)return true;let i=new Set(s??g(this,pl));return this.options.throwOnError&&i.add("error"),Object.keys(g(this,vo)).some(a=>{let l=a;return g(this,vo)[l]!==t[l]&&i.has(l)})};Tt(this,Xt,Cy).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Tt(this,Xt,Ff).call(this);}},Ao=new WeakMap,Wt=new WeakMap,wc=new WeakMap,vo=new WeakMap,Js=new WeakMap,cl=new WeakMap,Ii=new WeakMap,bs=new WeakMap,Sc=new WeakMap,dl=new WeakMap,ul=new WeakMap,Zs=new WeakMap,Xs=new WeakMap,Cs=new WeakMap,pl=new WeakMap,Xt=new WeakSet,Cc=function(t){Tt(this,Xt,Of).call(this);let r=g(this,Wt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(nl)),r},If=function(){Tt(this,Xt,Df).call(this);let t=il(this.options.staleTime,g(this,Wt));if(sl.isServer()||g(this,vo).isStale||!xf(t))return;let o=dy(g(this,vo).dataUpdatedAt,t)+1;z(this,Zs,yc.setTimeout(()=>{g(this,vo).isStale||this.updateResult();},o));},_f=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,Wt)):this.options.refetchInterval)??false},Pf=function(t){Tt(this,Xt,Vf).call(this),z(this,Cs,t),!(sl.isServer()||Ko(this.options.enabled,g(this,Wt))===false||!xf(g(this,Cs))||g(this,Cs)===0)&&z(this,Xs,yc.setInterval(()=>{(this.options.refetchIntervalInBackground||ny.isFocused())&&Tt(this,Xt,Cc).call(this);},g(this,Cs)));},Ff=function(){Tt(this,Xt,If).call(this),Tt(this,Xt,Pf).call(this,Tt(this,Xt,_f).call(this));},Df=function(){g(this,Zs)!==void 0&&(yc.clearTimeout(g(this,Zs)),z(this,Zs,void 0));},Vf=function(){g(this,Xs)!==void 0&&(yc.clearInterval(g(this,Xs)),z(this,Xs,void 0));},Of=function(){let t=g(this,Ao).getQueryCache().build(g(this,Ao),this.options);if(t===g(this,Wt))return;let r=g(this,Wt);z(this,Wt,t),z(this,wc,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Cy=function(t){bc.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(g(this,vo));}),g(this,Ao).getQueryCache().notify({query:g(this,Wt),type:"observerResultsUpdated"});});},by);function LT(e,t){return Ko(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Ko(t.retryOnMount,e)===false)}function gy(e,t){return LT(e,t)||e.state.data!==void 0&&Lf(e,t,t.refetchOnMount)}function Lf(e,t,r){if(Ko(t.enabled,e)!==false&&il(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Af(e,t)}return false}function yy(e,t,r,o){return (e!==t||Ko(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Af(e,r)}function Af(e,t){return Ko(t.enabled,e)!==false&&e.isStaleByTime(il(t.staleTime,e))}function BT(e,t){return !yu(e.getCurrentResult(),t)}var AT=ws__namespace.createContext(void 0),wy=e=>{let t=ws__namespace.useContext(AT);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var Sy=ws__namespace.createContext(false),Ty=()=>ws__namespace.useContext(Sy);Sy.Provider;function WT(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var ET=ws__namespace.createContext(WT()),ky=()=>ws__namespace.useContext(ET);var vy=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?bu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Ry=e=>{ws__namespace.useEffect(()=>{e.clearReset();},[e]);},Iy=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||bu(r,[e.error,o]));var _y=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));}},Py=(e,t)=>e.isLoading&&e.isFetching&&!t,Fy=(e,t)=>e?.suspense&&t.isPending,Wf=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Dy(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=Ty(),n=ky(),s=wy(),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`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,_y(i),vy(i,n,a),Ry(n);let c=!s.getQueryCache().get(i.queryHash),[p]=ws__namespace.useState(()=>new t(s,i)),h=p.getOptimisticResult(i),T=!o&&l;if(ws__namespace.useSyncExternalStore(ws__namespace.useCallback(d=>{let f=T?p.subscribe(bc.batchCalls(d)):nl;return p.updateResult(),f},[p,T]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ws__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),Fy(i,h))throw Wf(i,p,n);if(Iy({result:h,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw h.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,h),i.experimental_prefetchInRender&&!sl.isServer()&&Py(h,o)&&(c?Wf(i,p,n):a?.promise)?.catch(nl).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?h:p.trackResult(h)}function _i(e,t){return Dy(e,Bf)}function wu(e,t=true){return _i({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Qc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Ef(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await ii(s),c=null,p=null,h=null,T=null,d,f,b,v=l.data.some(x=>x.chains.some(k=>{let R=k.chain_type===t&&k.chain_id===r&&k.token_address.toLowerCase()===o.toLowerCase();return R&&(c=k.minimum_deposit_amount_usd,p=k.estimated_processing_time,h=k.max_slippage_percent,T=k.estimated_price_impact_percent,b=k.chain_name,f=x),R}));if(f){let x=Ae(f,"png");x&&(d=ie(x));}return {isSupported:v,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:h,priceImpactPercent:T,errorMessage:v?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:b}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Mf(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Kc(t,r,o,n,s);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",h=l.balance.amount,T=BigInt(h),d=BigInt(10**c),f=T/d,v=(T%d).toString().padStart(c,"0").replace(/0+$/,""),x=v?`${f}.${v}`:f.toString();return {balanceBaseUnit:h,balanceHuman:x,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}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 MT=2500,zT=3e3,UT=6e4;function zf({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=ws.useState([]),[l,c]=ws.useState(false),p=ws.useRef(new Date),h=ws.useRef(new Map),T=ws.useRef(false),d=ws.useRef(n),f=ws.useRef(s);return ws.useEffect(()=>{d.current=n;},[n]),ws.useEffect(()=>{f.current=s;},[s]),ws.useEffect(()=>{o&&!T.current&&(p.current=new Date,h.current.clear()),o||h.current.clear(),T.current=o;},[o]),ws.useEffect(()=>{if(!e||!o)return;let b=p.current,v=async()=>{try{let k=await hn(e,t,"withdraw"),R=new Date(b.getTime()-UT),w=[...k.data].sort((S,y)=>{let D=S.created_at?new Date(S.created_at).getTime():0;return (y.created_at?new Date(y.created_at).getTime():0)-D}),I=["pending","waiting","delayed"],m=["succeeded","failed"],u=null;for(let S of w){let y=S.created_at?new Date(S.created_at):null;if(!y||y<R)continue;let D=h.current.get(S.id);if(!D){u=S;break}if(I.includes(D)&&m.includes(S.status)){u=S;break}}if(u){let S=u,y=S.created_at?new Date(S.created_at):null;if(!y||y<p.current)return;let D=h.current.get(S.id);h.current.set(S.id,S.status),a(B=>{let V=B.findIndex(F=>F.id===S.id);if(V>=0){let F=[...B];return F[V]=S,F}return [...B,S]}),S.status==="succeeded"&&(!D||I.includes(D))?d.current?.({message:"Withdrawal completed successfully",transaction:S}):S.status==="failed"&&D!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:S});}}catch(k){console.error("Failed to fetch withdraw executions:",k),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:k});}};v();let x=setInterval(v,MT);return c(true),()=>{clearInterval(x),c(false);}},[e,t,o]),ws.useEffect(()=>{if(!o||!r)return;let b=async()=>{try{await Yu({deposit_wallet_id:r},t);}catch{}};b();let v=setInterval(b,zT);return ()=>clearInterval(v)},[o,r,t]),{executions:i,isPolling:l}}var Uf=(e,t)=>`${t}:${e}`;function Rc({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:h}){let{colors:T,fonts:d,components:f}=L(),[b,v]=ws.useState(false),[x,k]=ws.useState(false),R=f.card,w=t?e.find(S=>S.symbol===t):void 0,I=w?.chains||[],m=r?I.find(S=>Uf(S.chain_id,S.chain_type)===r):void 0,u={backgroundColor:R.backgroundColor,borderRadius:R.borderRadius,borderWidth:R.borderWidth||1,borderColor:R.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Ut.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.label,{color:R.labelColor,fontFamily:d.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ut.selectButton,u],onPress:()=>!s&&e.length>0&&v(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[Ut.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):w?jsxRuntime.jsxs(reactNative.View,{style:Ut.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(w,"png"))},style:Ut.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:w.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Ut.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsxRuntime.jsx(cr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.label,{color:R.labelColor,fontFamily:d.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ut.selectButton,u,(!w||I.length===0)&&Ut.disabled],onPress:()=>!s&&w&&I.length>0&&k(true),activeOpacity:.7,disabled:s||!w||I.length===0,children:[m?jsxRuntime.jsxs(reactNative.View,{style:Ut.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(m,"png"))},style:Ut.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:m.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Ut.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsxRuntime.jsx(cr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Mt,{visible:b,onClose:()=>v(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Ut.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ut.pickerHeaderClose,onPress:()=>v(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_t,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ua,{data:e,keyExtractor:S=>S.symbol,contentContainerStyle:Ut.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ut.pickerItem,{backgroundColor:S.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(S.symbol),v(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(S,"png"))},style:Ut.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.pickerItemSub,{color:T.foregroundMuted,fontFamily:d.regular}],children:S.name}),S.symbol===t&&jsxRuntime.jsx(pt,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Mt,{visible:x,onClose:()=>k(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Ut.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ut.pickerHeaderClose,onPress:()=>k(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_t,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ua,{data:I,keyExtractor:S=>Uf(S.chain_id,S.chain_type),contentContainerStyle:Ut.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>{let y=Uf(S.chain_id,S.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ut.pickerItem,{backgroundColor:y===r?T.cardHover:"transparent"}],onPress:()=>{n(y),k(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ae(S,"png"))},style:Ut.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.chain_name}),y===r&&jsxRuntime.jsx(pt,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Ut=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 Nf(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 _i({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>Gu({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 $T(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function qT(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 QT(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Tu({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:h,minimumWithdrawAmountUsd:T,estimatedProcessingTime:d,maxSlippagePercent:f,priceImpactPercent:b,canWithdraw:v,onDepositWalletCreation:x,onWithdraw:k,onWithdrawError:R,onWithdrawSubmitted:w,onViewTracker:I}){let m="https://unifold.io/terms",u="https://unifold.io/support",{colors:S,fonts:y,components:D}=L(),[B,V]=ws.useState(a||""),[F,W]=ws.useState(""),[U,Z]=ws.useState(false),[le,ne]=ws.useState(null),[ze,K]=ws.useState(false),[de,X]=ws.useState(""),G=ws.useRef(null);ws.useEffect(()=>{V(a||""),W(""),ne(null);},[a]);let q=B.trim();ws.useEffect(()=>{let ye=setTimeout(()=>X(q),500);return ()=>clearTimeout(ye)},[q]);let{data:te,isLoading:xe,error:rt}=Nf({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:de,publishableKey:e,enabled:de.length>5&&!!c}),Ue=q!==de,se=ws.useMemo(()=>!q||q.length<=5||Ue||xe?null:rt?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[q,Ue,xe,rt,te,c,l]),Fe=!Ue&&!!te?.valid&&!se,Ne=ws.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),ot=ws.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),lt=n||p?.symbol||"TOKEN",qe=p?.decimals??6,Ee=ws.useMemo(()=>{let ye=parseFloat(F);return !ye||ye<=0?0:ye},[F]),De=ws.useMemo(()=>{let ye=parseFloat(F);return !ye||ye<=0?0:ye*Ne},[F,Ne]),_e=ws.useCallback(async()=>{try{let Be=await Jy("expo-clipboard").getStringAsync();Be&&(V(Be.trim()),ne(null));}catch{}},[]),Se=ws.useCallback(()=>{ot<=0||W(p?.balanceHuman??"0");},[ot,p]),Ge=T!==null&&De>0&&De<T,Qe=Ee>0&&ot>0&&Ee>ot,dt=q.length>0&&F.trim().length>0&&Ee>0&&Fe&&!Ge&&!Qe&&!!p,er=ws.useCallback(async()=>{if(!(!l||!c||!dt||!v)){Z(true),ne(null);try{let ye=await x({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:q}),Be=qT(Ee,qe),Nt=QT(Ee,qe),he={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:lt,sourceTokenIconUrl:i,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ie(Ae(l,"png")):void 0,amount:Nt,amountBaseUnit:Be,submittedAt:new Date,withdrawIntentAddress:ye.address,recipientAddress:q};await k(he),w(he);}catch(ye){let Be=ye instanceof Error?ye.message:"Withdrawal failed. Please try again.",Nt=Be.length>120?"Withdrawal failed. Please try again.":Be;ne(Nt),R?.({message:Be,error:ye,code:"WITHDRAW_FAILED"});}finally{Z(false);}}},[l,c,dt,v,q,t,r,o,lt,i,F,ot,p,Ee,qe,De,x,k,R,w]),He=D.input,ve=D.card,nt=D.button,ut=se?S.error:He.borderColor,Ve=ws.useMemo(()=>U?"Processing...":Qe?"Insufficient balance":Ge?`Minimum $${T?.toFixed(2)}`:le?"Withdrawal failed \u2014 try again":"Withdraw",[U,Qe,Ge,T,le]);return jsxRuntime.jsxs(reactNative.View,{style:Et.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Et.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.label,{color:ve.labelColor,fontFamily:y.medium}],children:"Recipient address"}),(Ue||xe)&&q.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:_e,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(em,{size:16,color:S.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Et.inputRow,{backgroundColor:He.backgroundColor,borderRadius:He.borderRadius,borderWidth:He.borderWidth,borderColor:ut}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Et.textInput,{color:He.textColor,fontFamily:y.regular}],placeholder:"Enter wallet address",placeholderTextColor:He.placeholderColor,value:B,onChangeText:ye=>{V(ye),ne(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>G.current?.focus()})}),se?jsxRuntime.jsx(reactNative.Text,{style:[Et.errorText,{color:S.error,fontFamily:y.regular}],children:se}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Et.label,{color:ve.labelColor,fontFamily:y.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:S.warning,fontFamily:y.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Et.amountRow,{backgroundColor:He.backgroundColor,borderRadius:He.borderRadius,borderWidth:He.borderWidth,borderColor:He.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:[Et.amountInput,{color:He.textColor,fontFamily:y.regular}],placeholder:"0.00",placeholderTextColor:He.placeholderColor,value:F,onChangeText:ye=>{(ye===""||/^\d*\.?\d*$/.test(ye))&&(W(ye),ne(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Et.unitLabel,{color:S.foregroundMuted,fontFamily:y.medium}],children:lt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Et.maxButton,{backgroundColor:`${S.primary}20`}],onPress:Se,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Et.maxText,{color:S.primary,fontFamily:y.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Et.detailsCard,{marginTop:24,backgroundColor:ve.backgroundColor,borderRadius:ve.borderRadius,borderWidth:ve.borderWidth||1,borderColor:ve.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Et.detailsToggle,onPress:()=>K(!ze),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Et.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Et.detailIcon,{backgroundColor:ve.iconBackgroundColor,borderRadius:ve.iconContainerBorderRadius}],children:jsxRuntime.jsx(ho,{size:12,color:ve.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Et.detailsLabel,{color:ve.titleColor,fontFamily:y.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:y.medium},children:$T(d)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ze?"180deg":"0deg"}]},children:jsxRuntime.jsx(cr,{size:16,color:ve.actionColor,strokeWidth:2})})]})}),ze&&jsxRuntime.jsxs(reactNative.View,{style:Et.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Et.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Et.detailIcon,{backgroundColor:ve.iconBackgroundColor,borderRadius:ve.iconContainerBorderRadius}],children:jsxRuntime.jsx(To,{size:12,color:ve.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Et.detailsLabel,{color:ve.titleColor,fontFamily:y.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:y.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Et.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Et.detailIcon,{backgroundColor:ve.iconBackgroundColor,borderRadius:ve.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:ve.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Et.detailsLabel,{color:ve.titleColor,fontFamily:y.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:y.medium},children:[(b??0).toFixed(2),"%"]})]})]})]})]}),le&&jsxRuntime.jsx(reactNative.Text,{style:[Et.errorText,{color:S.error,fontFamily:y.regular,textAlign:"center"}],children:le}),jsxRuntime.jsxs(reactNative.View,{style:Et.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Et.withdrawButton,{backgroundColor:nt.primaryBackground,borderRadius:nt.borderRadius,borderWidth:nt.borderWidth,borderColor:nt.borderColor,opacity:!dt||!v||U?.5:1}],onPress:er,disabled:!dt||!v||U,activeOpacity:.8,children:[U&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:nt.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Et.withdrawButtonText,{color:nt.primaryText,fontFamily:y.medium}],children:Ve})]}),jsxRuntime.jsxs(reactNative.View,{style:Et.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Et.historyLink,onPress:I,activeOpacity:.7,children:[jsxRuntime.jsx(ho,{size:14,color:S.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Et.historyText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Et.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(m),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Et.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Et.legalSeparator,{color:S.foregroundMuted,fontFamily:y.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Et.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Help"})})]})]})]})]})}var Et=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 YT(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 JT(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function vu({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=L(),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,c=ie(Ae(e.destination_token_metadata,"png")||or("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=YT(e.created_at||new Date().toISOString()),T=JT(e.source_amount_usd);return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Fi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Fi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Fi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Fi.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Ai,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Fi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fi.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Fi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:Fi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Fi=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 $f(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 c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${c} ${l}`}catch{return e}}function Ny(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 XT(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 Hy(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function jy(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Ic({label:e,value:t,isLast:r}){let{fonts:o,components:n}=L(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:It.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[It.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[It.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[It.divider,{backgroundColor:s.borderColor}]})]})}function Qf({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=L(),[c,p]=ws.useState([]),[h,T]=ws.useState(!!n),d=l.card,f=l.button,b=l.header,v=l.container;ws.useEffect(()=>{Ku().then(Z=>p(Z.data)).catch(()=>{});},[]),ws.useEffect(()=>{T(!!n);},[e?.id]);let x=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,k=e?e.status==="failed"||e.status==="refunded":false,R=k?i.error:x?i.warning:i.success,w=k?"Failed":x?"Processing":"Completed",I=e?.destination_token_metadata?ie(Ae(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ie(t.destinationTokenIconUrl):ie(or("/icons/tokens/png/usdc.png")),m=e?.created_at?$f(e.created_at):t.submittedAt?$f(t.submittedAt.toISOString()):$f(new Date().toISOString()),u=e?`${Ny(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Hy(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,S=e?`${Ny(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Hy(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,y=e?XT(e.source_amount_usd,e.source_amount_base_unit):"$0.00",D=e?qc(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,B=e?qc(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,F=e?.explorer_url,W=e?.destination_transaction_hashes?.[0],U=e?.destination_explorer_url;return jsxRuntime.jsxs(Bt,{style:It.scroll,contentContainerStyle:It.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:It.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(aa,{size:22,color:b.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:It.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[It.headerTitle,{color:b.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:It.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_t,{size:20,color:b.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:It.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:I},style:It.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[It.statusBadge,{backgroundColor:R}],children:k?jsxRuntime.jsx(Ai,{size:10,color:"#FFFFFF",strokeWidth:3}):x?jsxRuntime.jsx(reactNative.View,{style:It.spinnerDot}):jsxRuntime.jsx(pt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:It.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[It.statusDot,{backgroundColor:R}]}),jsxRuntime.jsx(reactNative.Text,{style:[It.statusText,{color:R,fontFamily:a.medium}],children:w})]}),jsxRuntime.jsx(reactNative.Text,{style:[It.dateText,{color:v.subtitleColor,fontFamily:a.regular}],children:m}),jsxRuntime.jsxs(reactNative.View,{style:[It.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsxRuntime.jsx(Ic,{label:"Amount Sent",value:u}),jsxRuntime.jsx(Ic,{label:"Amount Received",value:S}),jsxRuntime.jsx(Ic,{label:"USD Value",value:y}),jsxRuntime.jsx(Ic,{label:"Source Network",value:D}),jsxRuntime.jsx(Ic,{label:"Destination Network",value:B,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:It.moreDetailsRow,onPress:()=>T(Z=>!Z),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[It.moreDetailsText,{color:v.actionTitle,fontFamily:a.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(_n,{size:16,color:v.actionColor,strokeWidth:2}):jsxRuntime.jsx(cr,{size:16,color:v.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[It.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:V&&F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:It.txRow,onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[It.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[It.txHash,{color:d.titleColor,fontFamily:a.regular}],children:jy(V)}),jsxRuntime.jsx(Zo,{size:14,color:d.actionColor,strokeWidth:2})]}),!x&&W&&U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[It.divider,{backgroundColor:d.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:It.txRow,onPress:()=>reactNative.Linking.openURL(U),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[It.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[It.txHash,{color:d.titleColor,fontFamily:a.regular}],children:jy(W)}),jsxRuntime.jsx(Zo,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:It.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[It.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:It.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[It.button,It.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[It.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[It.button,It.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[It.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var It=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 $y(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ru({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=L(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:hr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hr.closeButton,onPress:r,children:jsxRuntime.jsx(_t,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[hr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(pt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[hr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[hr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",$y(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:hr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[hr.button,hr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[hr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[hr.button,hr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[hr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:hr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hr.closeButton,onPress:r,children:jsxRuntime.jsx(_t,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[hr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(_t,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[hr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[hr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[hr.button,hr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[hr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:hr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hr.closeButton,onPress:r,children:jsxRuntime.jsx(_t,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(vt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(e.sourceTokenIconUrl)},style:hr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[hr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[hr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[hr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",$y(e.recipientAddress)]})]})}var hr=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 ik(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:ie(Ae(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:ie(Ae(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 qy=(e,t)=>`${t}:${e}`;function sk(){let{colors:e}=L(),t=ws.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ws.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 Pu({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:h,onWithdrawError:T,heightPercent:d=.94,sheetBorderRadius:f,sourceChainType:b,sourceChainId:v,sourceTokenAddress:x,sourceTokenSymbol:k,sourceChainName:R,sourceTokenIconUrl:w}){let{colors:I,fonts:m}=L(),[u,S]=ws.useState("form"),[y,D]=ws.useState(b),[B,V]=ws.useState(v),[F,W]=ws.useState(x),[U,Z]=ws.useState(k),[le,ne]=ws.useState(R),[ze,K]=ws.useState(w),[de,X]=ws.useState(null),[G,q]=ws.useState(null),[te,xe]=ws.useState(null),[rt,Ue]=ws.useState(),[se,Fe]=ws.useState([]),[Ne,ot]=ws.useState(null),[lt,qe]=ws.useState("form"),Ee=ws.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,De=ws.useRef(null),_e=!!y&&!!B&&!!F,{data:Se,isLoading:Ge}=wu(r,e&&u==="form"),Qe=Se?.data??[],{data:dt,isLoading:er}=Ef({sourceChainType:y,sourceChainId:B,sourceTokenAddress:F,sourceTokenSymbol:U,publishableKey:r,enabled:e&&_e&&u==="form"}),He=Pl.includes(y)?y:void 0,{data:ve,isLoading:nt}=Mf({address:n,chainType:He,chainId:B,tokenAddress:F,publishableKey:r,enabled:e&&_e}),{executions:ut}=zf({userId:o,publishableKey:r,depositWalletId:rt,enabled:!!rt&&e,onWithdrawSuccess:h,onWithdrawError:T});ws.useEffect(()=>{if(!e||u!=="tracker")return;let H=false;return hn(o,r,"withdraw").then(j=>{H||Fe(j.data);}).catch(console.error),()=>{H=true;}},[e,u,o,r]),ws.useEffect(()=>{e&&(De.current&&(clearTimeout(De.current),De.current=null),S("form"),D(b),V(v),W(x),Z(k),ne(R),K(w),X(null),q(null),xe(null),Ue(void 0),Fe([]),ot(null),qe("form"),Ee.setValue(reactNative.Dimensions.get("window").width));},[e]),ws.useEffect(()=>()=>{De.current&&clearTimeout(De.current);},[]),ws.useEffect(()=>{ze||dt?.iconUrl&&K(dt.iconUrl);},[dt?.iconUrl,ze]),ws.useEffect(()=>{le||dt?.chainName&&ne(dt.chainName);},[dt?.chainName,le]),ws.useEffect(()=>{if(!Qe.length||de)return;let H,j;if(i&&a)if(l)for(let pe of Qe){let $e=pe.chains.find(A=>A.chain_type===i&&A.chain_id===a&&A.token_address.toLowerCase()===l.toLowerCase());if($e){H=pe,j=$e;break}}else for(let pe of Qe){let $e=pe.chains.find(A=>A.chain_type===i&&A.chain_id===a);if($e){H=pe,j=$e;break}}H||(H=Qe[0]),H&&(X(H),q(j??H.chains[0]??null));},[Qe,de,i,a,l]),ws.useEffect(()=>{u==="confirming"&&ut.length>0&&S("details");},[u,ut]);let Ve=ws.useCallback(()=>{t(),De.current=setTimeout(()=>{S("form"),D(b),V(v),W(x),Z(k),ne(R),K(w),X(null),q(null),xe(null),Ue(void 0),Fe([]),ot(null),qe("form"),De.current=null;},300);},[t,b,v,x,k,R,w]),ye=ws.useCallback(H=>{let j=Qe.find(pe=>pe.symbol===H);j&&(X(j),j.chains.length>0&&q(j.chains[0]));},[Qe]),Be=ws.useCallback(H=>{if(!de)return;let j=de.chains.find(pe=>qy(pe.chain_id,pe.chain_type)===H);j&&q(j);},[de]),Nt=ws.useCallback(async H=>{let j=await zo({external_user_id:o,destination_chain_type:H.destinationChainType,destination_chain_id:H.destinationChainId,destination_token_address:H.destinationTokenAddress,recipient_address:H.recipientAddress,action_type:"withdraw"},r);if(!y)throw new Error("sourceChainType is required for withdrawal");let pe=Io(j.data,y);if(!pe)throw new Error(`No deposit wallet found for chain type: ${y}`);return Ue(pe.id),{id:pe.id,address:pe.address}},[o,r,y]),he=ws.useCallback(H=>{xe(H),S("confirming");},[]),st=ws.useCallback(H=>{ot(H),Ee.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ee,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ee]),ht=ws.useCallback(()=>{reactNative.Animated.timing(Ee,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>ot(null));},[Ee]),tr=Ge||er,je=dt?.isSupported??null,kt=u==="confirming"?"Withdrawal Status":c,Xe=f?.globalBorderTopLeftRadius,Re=f?.globalBorderTopRightRadius,Ye=f?.main?.borderTopLeftRadius??Xe,$=f?.main?.borderTopRightRadius??Re,Te=f?.tokenSelector?.borderTopLeftRadius??Xe,_=f?.tokenSelector?.borderTopRightRadius??Re,C=f?.chainSelector?.borderTopLeftRadius??Xe,O=f?.chainSelector?.borderTopRightRadius??Re,N=(()=>{if(u!=="form"||!_e||nt||!ve)return;let H=U||ve.symbol,j=ve.balanceUsd;if(j!=null){let A=`$${parseFloat(j).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return H?`Balance: ${A} ${H}`:`Balance: ${A}`}let pe=ve.balanceHuman;if(!(!pe||pe==="0"))return H?`Balance: ${pe} ${H}`:`Balance: ${pe}`})();return jsxRuntime.jsx(Mt,{visible:e,onClose:Ve,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:Ye,borderTopRightRadius:$,children:u==="confirming"&&te?jsxRuntime.jsx(Ru,{txInfo:te,executions:ut,onClose:Ve,onViewTracker:()=>{qe("confirming"),S("tracker");}}):u==="details"&&te?jsxRuntime.jsx(Qf,{execution:ut.length>0?ut[ut.length-1]:null,txInfo:te,onClose:Ve,onViewHistory:()=>{qe("details"),S("tracker");},onHeaderClose:()=>S("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:ei.trackerContainer,children:[jsxRuntime.jsx(Gr,{title:"Withdrawal History",onClose:()=>S(lt)}),se.length===0?jsxRuntime.jsx(reactNative.View,{style:ei.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ei.emptyText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(ua,{data:se,keyExtractor:H=>H.id,contentContainerStyle:ei.listContent,showsVerticalScrollIndicator:false,renderItem:({item:H})=>jsxRuntime.jsx(vu,{execution:H,onPress:()=>st(H)})}),Ne&&jsxRuntime.jsx(reactNative.Animated.View,{style:[ei.historyDetailOverlay,{backgroundColor:I.background,transform:[{translateX:Ee}]}],children:jsxRuntime.jsx(Qf,{execution:Ne,txInfo:ik(Ne),onClose:Ve,onBack:ht,onViewHistory:ht})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{title:kt,subtitle:N,onClose:Ve}),tr?jsxRuntime.jsx(sk,{}):je===false?jsxRuntime.jsxs(reactNative.View,{style:ei.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ei.unsupportedTitle,{color:I.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[ei.unsupportedMessage,{color:I.foregroundMuted,fontFamily:m.regular}],children:dt?.errorMessage})]}):jsxRuntime.jsx(ak,{publishableKey:r,sourceChainType:y??"",sourceChainId:B??"",sourceTokenAddress:F??"",sourceTokenSymbol:U,sourceChainName:le,sourceTokenIconUrl:ze,recipientAddressProp:s,destinationTokens:Qe,selectedToken:de,selectedChain:G,selectedChainKey:G?qy(G.chain_id,G.chain_type):null,onTokenChange:ye,onChainChange:Be,tokensLoading:Ge,balanceData:ve??null,isLoadingBalance:nt,sourceValidation:dt??null,onDepositWalletCreation:Nt,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:he,onViewTracker:()=>{qe("form"),S("tracker");},tokenSelectorLeft:Te,tokenSelectorRight:_,chainSelectorLeft:C,chainSelectorRight:O})]})})}function ak({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:h,onTokenChange:T,onChainChange:d,tokensLoading:f,balanceData:b,isLoadingBalance:v,sourceValidation:x,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:I,onViewTracker:m,tokenSelectorLeft:u,tokenSelectorRight:S,chainSelectorLeft:y,chainSelectorRight:D}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Bt,{style:{flex:1,paddingTop:16},contentContainerStyle:ei.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:ei.doubleInputWrapper,children:jsxRuntime.jsx(Rc,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:h,onTokenChange:T,onChainChange:d,isLoading:f,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:S,chainPickerBorderTopLeftRadius:y,chainPickerBorderTopRightRadius:D})}),jsxRuntime.jsx(Tu,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:b,isLoadingBalance:v,minimumWithdrawAmountUsd:x?.minimumAmountUsd??null,estimatedProcessingTime:x?.estimatedProcessingTime??null,maxSlippagePercent:x?.maxSlippagePercent??null,priceImpactPercent:x?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:I,onViewTracker:m})]})})}var ei=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 Gy=ws.createContext(null);function yk({children:e,publishableKey:t,config:r}){let[o]=ws.useState(()=>new Wp({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=ws.useState(false),[i,a]=ws.useState(null),[l,c]=ws.useState(false),[p,h]=ws.useState(null),T=reactNative.useColorScheme(),d=ws.useRef(false);d.current||(Nc({publishableKey:t}),d.current=true);let f=ws.useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?T==="dark"?"dark":"light":F},[r?.appearance,T]);ws.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.'),Nc({publishableKey:t});},[t]),ws.useEffect(()=>()=>{v.current&&clearTimeout(v.current),m.current&&clearTimeout(m.current);},[]);let b=ws.useRef(null),v=ws.useRef(null),x=ws.useCallback(F=>{v.current&&(clearTimeout(v.current),v.current=null),b.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),b.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),b.current=null);let W=new Promise((U,Z)=>{b.current={resolve:U,reject:Z};});return a(F),s(true),W},[]),k=ws.useCallback(()=>{b.current&&(b.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),b.current=null),s(false),v.current=setTimeout(()=>{a(null),v.current=null;},200);},[]),R=ws.useCallback(F=>{i?.onSuccess&&i.onSuccess(F),b.current&&(b.current.resolve(F),b.current=null);},[i]),w=ws.useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),i?.onError&&i.onError(F),b.current&&(b.current.reject(F),b.current=null);},[i]),I=ws.useRef(null),m=ws.useRef(null),u=ws.useRef(void 0),S=ws.useCallback(F=>{m.current&&(clearTimeout(m.current),m.current=null),I.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),I.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),I.current=null);let W=new Promise((U,Z)=>{I.current={resolve:U,reject:Z};});return u.current=F.onClose,h(F),c(true),W},[]),y=ws.useCallback(()=>{I.current&&(I.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),I.current=null),u.current?.(),u.current=void 0,c(false),m.current=setTimeout(()=>{h(null),m.current=null;},200);},[]),D=ws.useCallback(F=>{p?.onSuccess&&p.onSuccess(F),I.current&&(I.current.resolve(F),I.current=null);},[p]),B=ws.useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),p?.onError&&p.onError(F),I.current&&(I.current.reject(F),I.current=null);},[p]),V=ws.useMemo(()=>({publishableKey:t,beginDeposit:x,closeDeposit:k,beginWithdraw:S,closeWithdraw:y}),[t,x,k,S,y]);return jsxRuntime.jsx(Ep,{client:o,children:jsxRuntime.jsx(Gy.Provider,{value:V,children:jsxRuntime.jsxs(da,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(hu,{visible:n,onClose:k,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:f,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,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLinkPay:r?.enableStripeLinkPay,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableFiatOnramp:r?.enableFiatOnramp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?mh():void 0,onDepositSuccess:R,onDepositError:w,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(Pu,{visible:l,onClose:y,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:D,onWithdrawError:B,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function bk(){let e=ws.useContext(Gy);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
+ exports.AmountScreen=ld;exports.BottomSheet=Mt;exports.KYCWizardScreen=cd;exports.OnrampScreen=Cd;exports.StripeOnramp=wd;exports.StripeOnrampPreconfigure=ph;exports.UnifoldProvider=yk;exports.getPreferredIcon=Ae;exports.getStripePublishableKey=od;exports.getSupportedDestinationTokens=Qc;exports.normalizeIconUrl=ie;exports.registerStripeOnramp=Sd;exports.setDevApiUrl=dm;exports.setStripeOnrampApiUrl=rd;exports.setStripeOnrampPublishableKey=td;exports.useAllowedCountry=mc;exports.useStripeOnramp=dd;exports.useTheme=L;exports.useUnifold=bk;