@unifold/connect-react-native 0.1.35-beta-007 → 0.1.36

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.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import*as Dn from'react';import Dn__default,{createContext,useContext,useState,useRef,useCallback,useEffect,useMemo,useId,Fragment as Fragment$1}from'react';import {StyleSheet,ScrollView,useWindowDimensions,Platform,PanResponder,Modal,Pressable,View,TouchableOpacity,Text,ActivityIndicator,KeyboardAvoidingView,TextInput,Keyboard,useColorScheme,Animated,Easing,Dimensions,Image,Linking,FlatList,Clipboard}from'react-native';import Bt,{G,Path,Defs,ClipPath,Rect,LinearGradient,Stop,Circle,Polyline,Line,SvgXml,SvgUri}from'react-native-svg';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Zd,{useSharedValue,withSpring,withTiming,runOnJS,useAnimatedStyle,interpolate,Extrapolation}from'react-native-reanimated';import {GestureHandlerRootView,TouchableOpacity as TouchableOpacity$1}from'react-native-gesture-handler';import {Onramp,useOnramp,isPlatformPaySupported,PlatformPay,initStripe}from'@stripe/stripe-react-native';import Rc from'@react-native-async-storage/async-storage';import Lh from'expo-constants';import hg from'react-native-qrcode-svg';import {WebView}from'react-native-webview';var jd=e=>{throw TypeError(e)};var $m=(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 jl=(e,t,r)=>t.has(e)||jd("Cannot "+r);var p=(e,t,r)=>(jl(e,t,"read from private field"),r?r.call(e):t.get(e)),Y=(e,t,r)=>t.has(e)?jd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),B=(e,t,r,o)=>(jl(e,t,"write to private field"),t.set(e,r),r),Le=(e,t,r)=>(jl(e,t,"access private method"),r);var Cs=(e,t,r,o)=>({set _(n){B(e,t,n);},get _(){return p(e,t,o)}});var $l={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)"}},ql=$l;function fa(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ws(e,t,r){let o=r?t?.[r]:void 0,n=(u,h,C)=>{let g=o?.[u]?.[h];if(g!==void 0)return g;let b=t?.[u]?.[h];return b!==void 0?b:C},a={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,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,m=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,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:fa(a,i)},transferCrypto:{depositAddress:{card:fa(a,s)}},depositCard:{quoteProvider:{card:fa(a,l)}},depositTracker:{executionRow:{card:fa(a,m)}}}}function Ql(e,t,r){let n={...$l[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Kl=createContext(null);function D(){let e=useContext(Kl);if(!e){let t=ql.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ws(t,void 0,"dark"),isDark:true}}return e}function ht({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=D(),l=a??s.warning,m=i??"#FBBF24",u=useRef(new Animated.Value(0)).current,h=useId(),C=useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),g=(e-t)/2,b=2*Math.PI*g,w=e/2,c=o??Math.max(0,Math.round(e-t*2-8)),S=(e-c)/2;useEffect(()=>{let f=Animated.loop(Animated.timing(u,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return f.start(),()=>f.stop()},[u]);let y=u.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:[{width:e,height:e},n],children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:y}]},children:jsxs(Bt,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:C,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:l}),jsx(Stop,{offset:"100%",stopColor:m})]})}),jsx(Circle,{cx:w,cy:w,r:g,stroke:`url(#${C})`,strokeWidth:t,fill:"none",strokeDasharray:`${b*.75} ${b*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsx(View,{style:{position:"absolute",top:S+1.5,left:S,width:c,height:c},children:r}):null]})}function Jl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ri({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ss({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ii({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Nn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 Qe({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ks({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 vi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function hn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ba({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(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 Ts({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(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"}),jsx(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"}),jsx(Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(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"}),jsx(Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Pi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=useColorScheme(),l=useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),m=useMemo(()=>{let g=o?.[l];return Ql(l,g,r)},[l,o,r]),u=useMemo(()=>ws(m,i,l),[m,i,l]),h=useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),C=useMemo(()=>({mode:l,colors:m,fonts:h,components:u,isDark:l==="dark"}),[l,m,h,u]);return jsx(Kl.Provider,{value:C,children:e})}var Rs={damping:28,stiffness:300,mass:.8},kf=80,Tf=500;function ct({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:m=false,borderTopLeftRadius:u=24,borderTopRightRadius:h=24}){let{colors:C}=D(),{height:g}=useWindowDimensions(),[b,w]=useState(false),c=useRef(e);c.current=e;let S=useRef(0),y=i!=null&&i>=1,f=y||m?0:Platform.OS==="ios"?34:24,d=s!=null&&i!=null&&s>i,x=i!=null?(d?s:i)*g:void 0,_=d?(s-i)*g:0,T=l?0:_,k=useSharedValue(g),I=useCallback(()=>{c.current||w(false);},[]);useEffect(()=>{e?(w(true),k.value=withSpring(T,Rs)):b&&(k.value=withTiming(g,{duration:250},H=>{H&&runOnJS(I)();}));},[e]),useEffect(()=>{b&&e&&(k.value=withSpring(T,Rs));},[T]);let A=useCallback(()=>{o&&t();},[o,t]),V=useMemo(()=>{if(!(!n&&!d))return PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{S.current=k.value;},onPanResponderMove:(H,M)=>{if(Math.abs(M.dy)<4)return;let se=S.current+M.dy;k.value=Math.max(0,se);},onPanResponderRelease:(H,M)=>{if(!(Math.abs(M.dy)<4)){if(n&&(M.dy>kf||M.vy>Tf)){t();return}if(d){let se=_/2,He=k.value<se?0:_;k.value=withSpring(He,Rs);}else k.value=withSpring(T,Rs);}},onPanResponderTerminate:()=>{k.value=withSpring(T,Rs);}}).panHandlers},[n,d,_,T,k,t]),F=useAnimatedStyle(()=>({transform:[{translateY:k.value}]})),P=useAnimatedStyle(()=>({opacity:interpolate(k.value,[0,g*.5,g],[.5,.25,0],Extrapolation.CLAMP)}));return b?jsx(Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxs(GestureHandlerRootView,{style:Oi.root,children:[jsx(Zd.View,{style:[Oi.backdrop,P],pointerEvents:"auto",children:jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:A})}),jsxs(Zd.View,{style:[Oi.sheet,F,{height:x,backgroundColor:C.background,borderTopLeftRadius:y?0:u,borderTopRightRadius:y?0:h}],children:[a&&jsx(View,{style:Oi.handleContainer,pointerEvents:"none",children:jsx(View,{style:[Oi.handle,{backgroundColor:C.foreground+"33"}]})}),r,f>0&&jsx(View,{style:{height:f}}),V&&jsx(View,{...V,style:Oi.dragOverlay})]})]})}):null}var Oi=StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},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}}),gt=Dn__default.forwardRef((e,t)=>jsx(ScrollView,{ref:t,...e}));gt.displayName="BottomSheetScrollView";function Fi(e){return jsx(FlatList,{...e})}var xf="https://api.unifold.io",ec="__UnifoldDevApiBaseUrl__",Cr="pk_test_123",wa={};function _f(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[ec];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function qt(){return _f()??xf}function Sa(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.'),Cr=e.publishableKey;}e.defaultConfig&&(wa=e.defaultConfig);}function tu(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[ec]=t:delete globalThis[ec];}function Is(){return qt()}function ka(){return Cr}function Lr(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 Ht(e){let t=e.startsWith("/")?e:`/${e}`;return `${qt()}/api/public${t}`}function J(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,qt()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${qt()}${e}`:`${qt()}/api/public${e}`:""}async function Ho(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||wa.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||wa.destinationChainId||"8453",destination_token_address:e?.destination_token_address||wa.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Cr;Lr(n);let a=await fetch(`${qt()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function No(e,t){return e.find(r=>r.chain_type===t)}async function jo(e,t,r){let o=t||Cr;Lr(o);let n=await fetch(`${qt()}/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 Ta(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 ge(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 jn(e,t){let r=e||Cr;Lr(r);let o=`${qt()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=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}?${a.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 tc(e,t){let r=t||Cr;Lr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${qt()}/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 xa(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function rc(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 oc(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 nc(e,t){let r=t||Cr;Lr(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(`${qt()}/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 ic(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 Di(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 vs(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 sc(){let e=await fetch(`${qt()}/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 _a(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Ps(){let e=await fetch(`${qt()}/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 Ra(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 ac(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 lc(e,t){return Ta(e.deposit_wallet_id,t)}async function Ia(e,t,r,o,n){let a=n||Cr;Lr(a);let i=await fetch(`${qt()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}function ou({size:e=28}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxs(G,{fillRule:"evenodd",children:[jsx(Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsx(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 iu({size:e=28}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#eth_clip)",children:[jsx(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"}),jsx(Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsx(Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsx(Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsx(Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsx(Defs,{children:jsx(ClipPath,{id:"eth_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function lu({size:e=28}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#btc_clip)",children:[jsx(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"}),jsx(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"})]}),jsx(Defs,{children:jsx(ClipPath,{id:"btc_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function cu({size:e=28}){return jsxs(Bt,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxs(Defs,{children:[jsxs(LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsx(Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxs(G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsx(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"}),jsx(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"}),jsx(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 du({size:e=28}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxs(G,{children:[jsx(Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsx(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 va=[{label:"Base",value:Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:ou},{label:"Ethereum",value:Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:iu},{label:"Bitcoin",value:Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:lu},{label:"Solana",value:Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:cu},{label:"Polygon",value:Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:du}];function uu(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Pa(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 Oa(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=va.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=va.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Jt({onPress:e,title:t,variant:r="close"}){let{components:o,fonts:n}=D(),a=r==="back",i=a?jsx(Ii,{size:22,color:o.header.buttonColor,strokeWidth:2.5}):jsx(tt,{size:20,color:o.header.buttonColor,strokeWidth:2}),s=jsx(TouchableOpacity,{style:gn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:a?"Back":"Close",children:i});return t?jsxs(View,{style:gn.headerWithTitle,children:[a?s:jsx(View,{style:gn.headerSide}),jsx(Text,{style:[gn.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),a?jsx(View,{style:gn.headerSide}):s]}):jsxs(View,{style:a?gn.headerWithTitle:gn.header,children:[a?s:jsx(View,{style:gn.headerSpacer}),!a&&s]})}var Fa={paddingTop:8,paddingBottom:8},gn=StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Fa},headerWithTitle:{flexDirection:"row",alignItems:"center",...Fa},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function wr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=D();return e?jsx(Text,{style:[pu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsx(Text,{style:[pu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var pu=StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function co({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsx(Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}function fc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=useState(false),{colors:s,components:l}=D(),m=()=>{Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},u=uu(r);return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsxs(View,{style:e.rowRight,children:[jsx(Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:u}),jsx(TouchableOpacity,{onPress:m,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsx(Qe,{size:14,color:s.success,strokeWidth:2.5}):jsx(Nn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}var Da={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function hu({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=D(),a=e.toLowerCase(),i=Da[a]??n.primary,s=Math.round(o*.42);return jsxs(View,{style:{width:o,height:o,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsx(View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsx(Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsx(Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function Va({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=D(),m=Ht(`/icons/currencies/png/${e.toLowerCase()}.png`),u=Oa(r);return jsxs(View,{style:[Gr.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxs(View,{style:Gr.step,children:[jsx(Image,{source:{uri:m},style:Gr.iconImage}),jsx(Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsx(Text,{style:[Gr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsx(Vr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxs(View,{style:Gr.step,children:[jsxs(View,{style:Gr.iconWithBadge,children:[o?jsx(Image,{source:{uri:o},style:Gr.tokenIcon}):jsx(View,{style:[Gr.tokenIcon,{backgroundColor:Da[t.toLowerCase()]??i.primary}]}),n?jsx(Image,{source:{uri:n},style:[Gr.networkBadge,{borderColor:i.background}]}):null]}),jsx(Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxs(Text,{style:[Gr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",u]})]})]})}var Gr=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 Bi(){let{colors:e,fonts:t,components:r}=D(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return useMemo(()=>{let l=i.borderRadius,m={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.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:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...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:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.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"}},u={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}:{}},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:20,paddingBottom:32,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}:{}}},C=Math.max(16,Math.min(l,22)),g={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:C,borderTopRightRadius:C,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:C,borderBottomRightRadius:C,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}:{}}},b={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:s.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:m,quote:h,pm:g,wallet:b,flow:w,amount:u}},[e,t,o,n,a,i,s])}function Zf({size:e=24}){let t=e,r=e*(471/750);return jsxs(Bt,{width:t,height:r,viewBox:"0 0 750 471",children:[jsx(Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsx(Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsx(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"}),jsx(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"}),jsx(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 Xf({size:e=24}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 24 24",children:jsxs(G,{fill:"none",fillRule:"evenodd",children:[jsx(Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsx(Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function eh({size:e=24}){return jsx(Bt,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxs(G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsx(Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsx(G,{transform:"translate(312.9867,136.7145)",children:jsx(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"})}),jsx(G,{transform:"translate(349.7917,170.655)",children:jsx(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"})}),jsx(G,{transform:"translate(780.0408,412.227)",children:jsx(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"})}),jsx(G,{transform:"translate(738.7857,721.0845)",children:jsx(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"})}),jsx(G,{transform:"translate(373.0462,548.583)",children:jsx(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"})}),jsx(G,{transform:"translate(554.5071,446.121)",children:jsx(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 gc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsx(Ri,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsx(Zf,{size:t}):o.includes("mastercard")?jsx(Xf,{size:t}):o.includes("amex")||o.includes("american express")?jsx(eh,{size:t}):jsx(Ri,{size:t*.75,color:r,strokeWidth:1.75})}var th=[50,100,500],rh=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function wu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oh(e){return e.card?`${wu(e.card.brand)} ${wu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function La({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:m,paymentTokens:u=[],onAddPaymentMethod:h,onConfirm:C,onCancel:g,sheetBorderTopLeftRadius:b,sheetBorderTopRightRadius:w}){let c=Bi(),{colors:S,components:y}=D(),f=b??y.card.borderRadius,d=w??y.card.borderRadius,[x,_]=useState(e),[T,k]=useState(r?"apple_pay":u.length>0?u[0].id:null),I=useRef(false),A=z=>{I.current=true,k(z);};useEffect(()=>{I.current||r||u.length>0&&k(u[0].id);},[u,r]);let[V,F]=useState(false),[P,H]=useState("select"),[M,se]=useState(null),He=useRef(false);useEffect(()=>{s&&l&&/saving/i.test(l)&&H("card");},[s,l]);let Fe=T==="apple_pay",G=1e3,Se=Fe?G:n,he=Se!=null&&Se>0,Ie=useMemo(()=>{if(o)return [];let z=th.map(W=>({label:`$${W}`,amount:String(W),disabled:false}));return Fe?z.push({label:`$${G}`,amount:String(G),disabled:false}):z.push({label:"MAX",amount:he?String(Se):"0",disabled:!he}),z},[o,he,Se,Fe]),Ge=z=>{if(z==="\u232B"){_(W=>W.slice(0,-1));return}if(z==="."){if(x.includes("."))return;_(W=>W===""?"0.":W+".");return}_(W=>{let ae=W.indexOf(".");return ae!==-1&&W.length-ae>2?W:W==="0"&&z!=="."?z:W+z});},ke=x===""?"0":x,te=parseFloat(x),Te=x!==""&&!isNaN(te)&&te>0,st=r||u.length>0,Ae=a==="header",Ye=useMemo(()=>{let z=[];r&&z.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let W of u)z.push({id:W.id,label:oh(W),hint:W.card?`Expires ${W.card.exp_month}/${W.card.exp_year}`:W.type,brand:W.card?.brand,isApplePay:false});return z},[r,u]),We=Ye.find(z=>z.id===T),Me=T!=null&&T!=="apple_pay",me=We?We.label:Me&&M?M:Me?"Card":"Pay With",X=We?!We.isApplePay:Me,be=We?.brand??M??void 0,pt=st?jsx(TouchableOpacity,{style:[Ae?c.amount.paymentRowHeader:c.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(H("select"),F(true));},activeOpacity:.7,disabled:s,children:jsxs(View,{style:c.amount.paymentLeft,children:[We?.isApplePay?jsx(Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):X?jsx(gc,{sublabel:be,size:20}):null,jsx(Text,{style:c.amount.paymentLabel,children:me}),jsx(Pt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxs(View,{style:c.form.screen,children:[jsx(Jt,{onPress:g,title:"Enter amount"}),Ae&&pt,jsxs(View,{style:c.form.content,children:[jsxs(View,{style:c.amount.amountContainer,children:[jsxs(Text,{style:[c.amount.amountText,ke==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",ke]}),jsx(Text,{style:c.amount.currencyLabel,children:t.toUpperCase()})]}),!Ae&&pt,Ie.length>0&&jsx(View,{style:c.amount.quickRow,children:Ie.map(z=>{let W=!z.disabled&&x===z.amount&&x!=="";return jsx(TouchableOpacity,{style:[c.amount.quickPill,W&&{backgroundColor:S.primary},z.disabled&&{opacity:.4}],activeOpacity:.7,disabled:z.disabled||s,onPress:()=>_(z.amount),children:jsx(Text,{style:[c.amount.quickPillText,W&&{color:S.primaryForeground}],children:z.label})},z.label)})}),jsx(View,{style:c.amount.numpad,children:rh.map((z,W)=>jsx(View,{style:c.amount.numpadRow,children:z.map(ae=>jsx(TouchableOpacity,{style:[c.amount.numpadKey,s&&{opacity:.3}],onPress:()=>Ge(ae),activeOpacity:.6,disabled:s,children:jsx(Text,{style:ae==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:ae})},ae))},W))}),jsx(TouchableOpacity,{style:[c.form.continueBtn,(!Te||s)&&c.form.continueBtnDisabled],onPress:()=>Te&&!s&&C(x,T),disabled:!Te||s,children:s?jsx(ActivityIndicator,{size:"small",color:S.primaryForeground}):jsx(Text,{style:[c.form.continueBtnText,!Te&&c.form.continueBtnTextDisabled],children:"Continue"})}),!V&&m?jsx(Text,{style:c.amount.inlineError,children:m}):!V&&s&&l&&__DEV__?jsx(Text,{style:c.amount.inlineStatus,children:l}):null]}),jsx(ct,{visible:V,onClose:()=>{s||(F(false),H("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:f,borderTopRightRadius:d,children:jsx(View,{style:c.amount.sheetContent,children:P==="select"?jsxs(Fragment,{children:[jsxs(View,{style:c.amount.sheetTitleRow,children:[jsx(Text,{style:c.amount.sheetTitle,children:"Pay With"}),jsx(TouchableOpacity,{onPress:()=>F(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsx(tt,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxs(gt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[Ye.map(z=>{let W=T===z.id;return jsxs(TouchableOpacity,{style:[c.amount.sheetOption,W&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{A(z.id),se(z.isApplePay?null:z.label),F(false);},children:[jsxs(View,{style:c.amount.sheetOptionLeft,children:[jsx(View,{style:c.amount.sheetOptionIcon,children:z.isApplePay?jsx(Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsx(gc,{sublabel:z.brand,size:24})}),jsxs(View,{style:{flex:1},children:[jsx(Text,{style:c.amount.sheetOptionLabel,children:z.label}),jsx(Text,{style:c.amount.sheetOptionHint,children:z.hint})]})]}),W&&jsx(Qe,{size:18,color:S.primary,strokeWidth:2.5})]},z.id)}),jsx(TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!He.current){He.current=true;try{let z=await h?.();z&&(A(z.token),se(z.sublabel),F(!1));}finally{He.current=false;}}},children:jsx(Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:c.amount.sheetHeader,children:[jsx(TouchableOpacity,{onPress:()=>{s||H("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsx(Ii,{size:20,color:S.foreground,strokeWidth:2})}),jsx(Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),s?jsxs(View,{style:c.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:c.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):m?jsxs(Fragment,{children:[jsx(View,{style:c.amount.sheetError,children:jsx(Text,{style:c.amount.sheetErrorText,children:m})}),jsx(TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{i&&Te&&i(false,x);},children:jsx(Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxs(View,{style:c.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})})]})}var Ls=4;function Ba({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Bi(),{colors:a,fonts:i,components:s}=D(),l=s.input.placeholderColor,[m,u]=useState(1),[h,C]=useState(e.firstName??""),[g,b]=useState(e.lastName??""),[w,c]=useState(e.dobMonth??""),[S,y]=useState(e.dobDay??""),[f,d]=useState(e.dobYear??""),[x,_]=useState(e.addressLine1??""),[T,k]=useState(e.addressLine2??""),[I,A]=useState(e.city??""),[V,F]=useState(e.state??""),[P,H]=useState(e.postalCode??""),[M,se]=useState(e.country??"US"),[He,Fe]=useState(e.idNumber??""),G=useRef(null),Se=useRef(null),he=useRef(null),Ie=useRef(null),Ge=useRef(null),ke=useRef(null),te=useRef(null),Te=useRef(null),st=()=>{switch(m){case 1:return h.trim().length>0&&g.trim().length>0;case 2:return w.length===2&&S.length===2&&f.length===4;case 3:return x.trim().length>0&&I.trim().length>0&&V.trim().length>0&&P.trim().length>0;case 4:return He.trim().length>0;default:return false}},Ae=()=>{st()&&(m<Ls?u(me=>me+1):r({firstName:h,lastName:g,idNumber:He,dobMonth:w,dobDay:S,dobYear:f,addressLine1:x,addressLine2:T,city:I,state:V,postalCode:P,country:M}));},Ye=()=>{m>1?u(me=>me-1):o();},We=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Ee=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],Me=[At.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsx(KeyboardAvoidingView,{style:n.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:n.form.screen,children:[jsxs(View,{style:At.header,children:[jsx(View,{style:At.headerSide,children:jsx(TouchableOpacity,{style:At.iconButton,onPress:Ye,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:m>1?"Back":"Cancel",children:jsx(Ss,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsx(View,{style:At.headerCenter,children:jsxs(Text,{style:Me,children:[m," of ",Ls]})}),jsx(View,{style:At.headerSide,children:jsx(TouchableOpacity,{style:At.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsx(View,{style:At.progressTrack,children:Array.from({length:Ls}).map((me,X)=>jsx(View,{style:[At.progressSegment,{backgroundColor:X<m||X+1===m?a.primary:a.border}]},X))}),jsxs(gt,{style:n.form.flex,contentContainerStyle:At.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsx(Text,{style:n.form.title,children:We[m-1]}),jsx(Text,{style:n.form.subtitle,children:Ee[m-1]}),m===1&&jsxs(Fragment,{children:[jsx(qo,{form:n.form,label:"First name",children:jsx(TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:h,onChangeText:C,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>G.current?.focus()})}),jsx(qo,{form:n.form,label:"Last name",children:jsx(TextInput,{ref:G,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:g,onChangeText:b,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ae})})]}),m===2&&jsxs(View,{style:At.dobRow,children:[jsxs(View,{style:At.dobCol,children:[jsx(Text,{style:[n.form.fieldLabel,At.dobLabel],children:"Month"}),jsx(TextInput,{style:[n.form.input,At.dobInput],placeholder:"MM",placeholderTextColor:l,value:w,onChangeText:me=>{let X=me.replace(/\D/g,"").slice(0,2);c(X),X.length===2&&Se.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:At.dobCol,children:[jsx(Text,{style:[n.form.fieldLabel,At.dobLabel],children:"Day"}),jsx(TextInput,{ref:Se,style:[n.form.input,At.dobInput],placeholder:"DD",placeholderTextColor:l,value:S,onChangeText:me=>{let X=me.replace(/\D/g,"").slice(0,2);y(X),X.length===2&&he.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:At.dobColWide,children:[jsx(Text,{style:[n.form.fieldLabel,At.dobLabel],children:"Year"}),jsx(TextInput,{ref:he,style:[n.form.input,At.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:f,onChangeText:me=>{let X=me.replace(/\D/g,"").slice(0,4);d(X);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ae})]})]}),m===3&&jsxs(Fragment,{children:[jsx(qo,{form:n.form,label:"Street address",children:jsx(TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:x,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Ie.current?.focus()})}),jsx(qo,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsx(TextInput,{ref:Ie,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:T,onChangeText:k,returnKeyType:"next",onSubmitEditing:()=>Ge.current?.focus()})}),jsx(qo,{form:n.form,label:"City",children:jsx(TextInput,{ref:Ge,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:I,onChangeText:A,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ke.current?.focus()})}),jsxs(View,{style:At.row,children:[jsx(View,{style:[n.form.flex,{marginRight:8}],children:jsx(qo,{form:n.form,label:"State",children:jsx(TextInput,{ref:ke,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:V,onChangeText:me=>F(me.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})}),jsx(View,{style:n.form.flex,children:jsx(qo,{form:n.form,label:"ZIP code",children:jsx(TextInput,{ref:te,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:P,onChangeText:H,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})})})]}),jsx(qo,{form:n.form,label:"Country",children:jsx(TextInput,{ref:Te,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:M,onChangeText:me=>se(me.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ae})})]}),m===4&&jsxs(qo,{form:n.form,label:"Social Security Number",children:[jsx(TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:He,onChangeText:Fe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ae}),jsx(Text,{style:[n.form.hint,At.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsx(View,{style:n.form.footer,children:t&&m===Ls?jsx(View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsx(ht,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[n.form.continueBtn,!st()&&n.form.continueBtnDisabled],onPress:Ae,disabled:!st(),children:jsx(Text,{style:[n.form.continueBtnText,!st()&&n.form.continueBtnTextDisabled],children:m===Ls?"Submit":"Continue"})})})]})})}function qo({form:e,label:t,children:r}){return jsxs(View,{style:e.fieldWrap,children:[jsx(Text,{style:e.fieldLabel,children:t}),r]})}var At=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,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:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},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 ku="",Tu;function Aa(e){ku=e;}function Wa(e){Tu=e;}function Er(){let e=ku||ka();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Mr(){return Tu??Is()}async function Ea(){let e=`${Mr()}/v1/public/onramps/headless/stripe/config`,t=Er(),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 Sc(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Er(),"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 xu(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Er(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!t.ok)throw new Error(`Failed to exchange auth intent for tokens: ${t.status}`);return t.json()}async function kc(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Er(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})}),r=await t.json().catch(()=>({}));if(!t.ok)throw new Error(r?.message??`Failed to refresh OAuth token: ${t.status}`);return r}async function _u(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(`${Mr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Er(),"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 Ru(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Er(),"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 Ma(e,t){let r=`${Mr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Er(),"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 Iu(e,t){let r=`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Er(),"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 Tc(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Er(),"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 vu(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(`${Mr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Er(),"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 xc(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Er(),"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 Pu(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(`${Mr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Er(),"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 _c(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 Ou(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Er()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}var Ic="@unifold/stripe_oauth";async function Fu(){try{let e=await Rc.getItem(Ic);return e?JSON.parse(e):null}catch{return null}}async function vc(e){try{await Rc.setItem(Ic,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Cn(){try{await Rc.removeItem(Ic);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var uh=5,Sn=null,Du={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function za(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:m,registerWalletAddress:u,collectPaymentMethod:h,createCryptoPaymentToken:C}=useOnramp(),[g,b]=useState(r),[w,c]=useState(!!e?.externalUserId),[S,y]=useState(false),[f,d]=useState(""),[x,_]=useState(null),[T,k]=useState(e?.email??""),[I,A]=useState(e?.phone??""),[V,F]=useState(""),[P,H]=useState("US"),[M,se]=useState(""),[He,Fe]=useState(""),G=useRef(""),Se=useRef(""),he=useRef(""),[Ie,Ge]=useState(false),[ke,te]=useState(false),Te=useRef(0),st=useRef(false),Ae=useRef(false),Ye=useRef(false),We=useRef(""),Ee=useRef(e?.defaultNetwork??Onramp.CryptoNetwork.base),Me=useRef(null),[me,X]=useState(Du),[be,pt]=useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[z,W]=useState(""),[ae,oe]=useState(e?.defaultNetwork??Onramp.CryptoNetwork.base),[ve,xt]=useState(e?.defaultSourceAmount??"100"),[de,le]=useState(e?.defaultSourceCurrency??"usd"),[ze,Yt]=useState(e?.defaultDestinationCurrency??"usdc"),[mt,ue]=useState(null),[et,xr]=useState(),[_t,io]=useState(),[Or,ir]=useState(false),$t=useRef(null),xe=useRef(false),at=useRef(0),$=useRef(e?.onComplete),re=useRef(e?.onError),_e=useRef(e?.onStepChange),pe=useRef(r);useEffect(()=>{$.current=e?.onComplete;},[e?.onComplete]),useEffect(()=>{re.current=e?.onError;},[e?.onError]),useEffect(()=>{_e.current=e?.onStepChange;},[e?.onStepChange]);let ne=useRef(r);useEffect(()=>{g!==ne.current&&(_e.current?.(g,ne.current),ne.current=g),pe.current=g;},[g]),useEffect(()=>{w&&g!==r&&c(false);},[w,g,r]);let O=useCallback((R,v,N)=>{let Z={code:R,message:v,step:pe.current,stripeErrorCode:N};_(Z),d(""),re.current?.(Z);},[]),ft=useCallback(R=>{let v={sessionId:R.id,status:R.status,sourceAmount:R.transaction_details.source_amount,sourceCurrency:R.transaction_details.source_currency,destinationAmount:R.transaction_details.destination_amount,destinationCurrency:R.transaction_details.destination_currency,destinationNetwork:R.transaction_details.destination_network,walletAddress:R.transaction_details.wallet_address,fees:{networkFee:R.transaction_details.fees.network_fee_amount,transactionFee:R.transaction_details.fees.transaction_fee_amount}};return $.current?.(v),v},[]),De=useCallback(()=>_(null),[]),pn=R=>R.refresh_token??R.refresh?.refresh_token??"",ki=useCallback((R,v,N,Z,fe)=>{Se.current=v,G.current=N,e?.externalUserId&&vc({accessToken:v,refreshToken:N,customerId:R,externalUserId:e.externalUserId,email:fe||T,expiresAt:Date.now()+Z*1e3});},[e?.externalUserId,T]),Ti=useCallback(async()=>{let R=G.current;if(!R)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let v=await kc(R),N=v.access_token,Z=pn(v)||R;return Fe(N),ki(he.current,N,Z,v.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),N}catch(v){return console.error("[tryRefreshAccessToken] refresh failed:",v?.message),await Cn(),Sn=null,Se.current="",G.current="",he.current="",Fe(""),se(""),null}},[ki]),yo=useCallback(async R=>{try{return await R(Se.current)}catch(v){let N=v?.message??"";if(N.includes("stripe_onramp_forbidden")||N.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let Z=await Ti();if(!Z)throw O("authorization_error","Session expired. Please sign in again."),b("email"),v;return await R(Z)}throw v}},[Ti,O]);useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){ir(false);return}let v=false;return isPlatformPaySupported().then(N=>{v||ir(N);}),()=>{v=true;}},[e?.merchantIdentifier]),useEffect(()=>(xe.current=false,()=>{xe.current=true,$t.current&&clearTimeout($t.current);}),[]);let xi=useRef(false);useEffect(()=>{if(xi.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),Cn(),Sn=null,c(false);return}let R=false;return (async()=>{try{let v=await Fu();if(R||!v){R||c(!1);return}if(v.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",v.externalUserId,"current:",e.externalUserId),await Cn(),Sn=null,R||c(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",v.customerId);let N=Date.now()>=v.expiresAt,Z=v.accessToken,fe=v.refreshToken;if(N){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let Ne=await kc(v.refreshToken);if(R)return;Z=Ne.access_token,fe=Ne.refresh_token??Ne.refresh?.refresh_token??v.refreshToken,await vc({accessToken:Z,refreshToken:fe,customerId:v.customerId,externalUserId:e.externalUserId,email:v.email,expiresAt:Date.now()+(Ne.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(Ne){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Ne?.message),await Cn(),Sn=null,R||c(!1);return}}if(R)return;if(xi.current=!0,se(v.customerId),he.current=v.customerId,Fe(Z),Se.current=Z,G.current=fe,v.email&&k(v.email),Sn===v.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",v.customerId,"\u2014 skipping configure()"),Me.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",v.customerId);let Ne=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:v.customerId});Ne.error?console.error("[useStripeOnramp] restore configureSDK error:",Ne.error.message):Sn=v.customerId,Me.current=Promise.resolve(Ne);}if(R)return;let lt=()=>new Promise(Ne=>{let ur=()=>{Ye.current&&We.current?Ne():setTimeout(ur,200);};ur();});try{if(await Promise.race([lt(),new Promise((ur,Vt)=>setTimeout(()=>Vt(new Error("timeout")),1e4))]),R)return;let Ne=We.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",Ne,"network:",Ee.current),await u(Ne,Ee.current);}catch(Ne){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Ne?.message);}if(R)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),b("session_params");}finally{R||c(false);}})(),()=>{R=true;}},[]),useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Ie||ke)return;let R=false;te(true);async function v(){try{let[N,Z]=await Promise.all([Pu({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?Ou({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Lt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Lt?.message),null)):Promise.resolve(null)]);if(R)return;let fe=e?.destinationChainType??"ethereum",lt=N.data.find(Lt=>Lt.chain_type===fe);if(lt?.address){let Lt=lt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Lt,"recipient:",lt.recipient_address),pt(Lt),We.current=Lt,lt.recipient_address&&W(lt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",fe,"in",N.data?.length,"wallets");let Ne={base:Onramp.CryptoNetwork.base,ethereum:Onramp.CryptoNetwork.ethereum,solana:Onramp.CryptoNetwork.solana,bitcoin:Onramp.CryptoNetwork.bitcoin,polygon:Onramp.CryptoNetwork.polygon},ur={8453:"base",1:"ethereum",137:"polygon"},Vt=Z?.destination_network,sr="none";if(Vt&&Ne[Vt])oe(Ne[Vt]),Ee.current=Ne[Vt],sr=Vt+" (from default_token API)";else if(e?.destinationChainId&&ur[e.destinationChainId]){let Lt=ur[e.destinationChainId];Ne[Lt]&&(oe(Ne[Lt]),Ee.current=Ne[Lt]),sr=Lt+" (from chain_id "+e.destinationChainId+")";}else Ne[fe]&&(oe(Ne[fe]),Ee.current=Ne[fe],sr=fe+" (from chain_type fallback)");Z?.destination_currency&&Yt(Z.destination_currency.toLowerCase());let er=Z?.destination_token_metadata,qr=_c(er?.icon_urls,er?.icon_url),Qr=_c(er?.chain?.icon_urls,er?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",qr,"network:",Qr),qr&&xr(qr),Qr&&io(Qr),Ge(!0),Ye.current=!0;}catch(N){console.error("[useStripeOnramp] Failed to resolve wallet:",N?.message),Ge(true),Ye.current=true;}finally{R||te(false);}}return v(),()=>{R=true;}},[e?.publishableKey,e?.externalUserId]);let so=useCallback(async()=>{if(Me.current)return Me.current;let R=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(v=>(v.error&&(console.error("[useStripeOnramp] configureSDK error:",v.error.message,v.error.code),Me.current=null),v)).catch(v=>{throw console.error("[useStripeOnramp] configureSDK threw:",v?.message??v),Me.current=null,v});return Me.current=R,R},[o,e?.merchantDisplayName]);useEffect(()=>{e?.externalUserId||so();},[]);let Mo=useCallback(async R=>{if(!st.current){st.current=true,y(true),De(),d("Creating auth intent...");try{let v=await Sc(R);d("Waiting for authorization...");let N=await i(v);if(N?.error){console.log("[proceedToAuthorize] authorize error:",N.error.message),O("authorization_error","Something went wrong during authorization. Please try again."),b("email");return}if(N?.status==="Denied"){O("authorization_error","Authorization denied by user."),b("email");return}if(N?.status!=="Consented"||!N.customerId){O("authorization_error","Authorization was canceled."),b("email");return}d("Exchanging tokens...");let Z=await xu(v),fe=N.customerId,lt=Z.access_token,Ne=pn(Z);console.log("[useStripeOnramp] customerId:",fe),console.log("[useStripeOnramp] accessToken acquired, length:",lt.length),se(fe),he.current=fe,Sn=fe,Fe(lt),ki(fe,lt,Ne,Z.expires_in??3600),d("Checking verification status...");try{let ur=await Ma(fe,lt),Vt=ur.verifications.find(mn=>mn.name==="kyc_verified"),sr=ur.verifications.find(mn=>mn.name==="id_document_verified"),er=Vt?.status==="verified",qr=Vt?.status==="rejected",Qr=sr?.status==="verified",Lt=ur.provided_fields.includes("first_name");if(d(""),qr&&!Lt)O("kyc_error","KYC was previously rejected. Please submit with correct info."),b("kyc");else if(qr&&Lt)b(Qr?"wallet":"identity");else if(!er&&!Lt)b("kyc");else if(!Qr)b("identity");else if(Ye.current&&We.current)try{let mn=We.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",mn,"network:",ae);let ma=await u(mn,ae);ma?.error?(console.warn("[proceedToAuthorize] wallet registration error:",ma.error.message),O("wallet_error",ma.error.message,ma.error.code),b("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),b("session_params"));}catch(mn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",mn?.message),b("wallet");}else b("wallet");}catch(ur){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",ur?.message),d(""),b("kyc");}}catch(v){O("authorization_error",v?.message??String(v)),b("email");}finally{st.current=false,y(false);}}},[i,De,O,ki,u,ae]),q=useCallback(async()=>{if(Keyboard.dismiss(),!T){O("validation_error","Please enter an email address.");return}y(true),De(),d("");try{d("Configuring...");let R=await so();if(R.error){O("configuration_error",R.error.message,R.error.code);return}d("Checking Link account...");let v=await n(T);if(v.error){O("authorization_error",v.error.message,v.error.code);return}v.hasLinkAccount?await Mo(T):(d(""),b("register"));}catch(R){O("unknown_error",R?.message??String(R));}finally{y(false);}},[De,so,T,O,n,Mo]),ie=useCallback(async()=>{if(!I){O("validation_error","Please enter your phone number.");return}y(true),De(),d("");try{d("Creating Link account...");let R=await a({email:T,phone:I,fullName:V||T,country:P||"US"});if(R.error){O("registration_error",R.error.message,R.error.code);return}await Mo(T);}catch(R){O("registration_error",R?.message??String(R));}finally{y(false);}},[De,P,T,O,V,I,a,Mo]);useEffect(()=>{if(g!=="email"||!e?.email||w)return;let R=++Te.current,v=false,N=()=>v||Te.current!==R;return e?.phone?(async()=>{y(true),De();try{d("Configuring...");let Z=await so();if(N())return;if(Z.error){O("configuration_error",Z.error.message,Z.error.code);return}d("Checking Link account...");let fe=await n(e.email);if(N())return;if(fe.error){O("authorization_error",fe.error.message,fe.error.code);return}if(fe.hasLinkAccount){if(N())return;await Mo(e.email);}else {d("Creating Link account...");let lt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(N())return;if(lt.error){O("registration_error",lt.error.message,lt.error.code);return}if(N())return;await Mo(e.email);}}catch(Z){N()||O("unknown_error",Z?.message??String(Z));}finally{y(false);}})():(async()=>{y(true),De();try{d("Configuring...");let Z=await so();if(N())return;if(Z.error){O("configuration_error",Z.error.message,Z.error.code);return}d("Checking Link account...");let fe=await n(e.email);if(N())return;if(fe.error){O("authorization_error",fe.error.message,fe.error.code);return}if(fe.hasLinkAccount){if(N())return;await Mo(e.email);}else {if(N())return;d(""),b("register");}}catch(Z){N()||O("unknown_error",Z?.message??String(Z));}finally{y(false);}})(),()=>{v=true;}},[g,e?.email,e?.phone,w]);let wt=useCallback(async R=>{y(true),De(),d(""),X(R);try{let v={firstName:R.firstName,lastName:R.lastName,idNumber:R.idNumber||void 0,dateOfBirth:{day:parseInt(R.dobDay,10),month:parseInt(R.dobMonth,10),year:parseInt(R.dobYear,10)},address:{line1:R.addressLine1,line2:R.addressLine2||void 0,city:R.city,state:R.state,postalCode:R.postalCode,country:R.country}},N=await s(v);if(N?.error){if(N.error.stripeErrorCode==="consumer_person_already_verified"){d(""),b("identity");return}O("kyc_error",N.error.message,N.error.stripeErrorCode??N.error.code),b("kyc");return}d("Please review your KYC information...");let Z=await l(null);if(Z?.error){O("kyc_error",Z.error.message,Z.error.stripeErrorCode??Z.error.code),b("kyc");return}if(Z?.status==="UpdateAddress"){O("kyc_error","Please update your address and resubmit."),b("kyc");return}d(""),b("identity");}catch(v){O("kyc_error",v?.message??String(v)),b("kyc");}finally{y(false);}},[s,De,O,l]),Fr=useCallback(async()=>{if(!Ae.current){Ae.current=true,y(true),De(),d("Launching identity verification...");try{let R=await m();if(R?.error){O("identity_error",R.error.message,R.error.code);return}d(""),b("wallet");}catch(R){O("identity_error",R?.message??String(R));}finally{Ae.current=false,y(false);}}},[De,O,m]);useEffect(()=>{g==="identity"&&!S&&Fr();},[g]);let bs=useCallback(async()=>{if(!be){O("validation_error","Please enter a wallet address.");return}y(true),De(),d("");try{let R=be.toLowerCase();console.log("[registerWallet] registering wallet:",R,"network:",ae);let v=await u(R,ae);if(v?.error){console.warn("[registerWallet] error:",v.error.message),O("wallet_error",v.error.message,v.error.code);return}console.log("[registerWallet] wallet registered successfully"),d(""),b("session_params");}catch(R){O("wallet_error",R?.message??String(R));}finally{y(false);}},[De,O,be,ae,u]);useEffect(()=>{g==="wallet"&&Ie&&be&&bs();},[g,Ie,be]);let ao=useCallback(R=>{xe.current=false,at.current=0;let v=0,N=async()=>{v+=1;let Z=Se.current;try{let fe=await Iu(R,Z);if(console.log(`[pollSessionStatus] poll #${v} session=${R} status="${fe.status}"`),xe.current)return;at.current=0,fe.status==="fulfillment_complete"?(ue(fe),b("success")):$t.current=setTimeout(N,3e3);}catch(fe){if(xe.current)return;let lt=fe?.message??"";if((lt.includes("stripe_onramp_forbidden")||lt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Ti()&&!xe.current)){$t.current=setTimeout(N,1e3);return}if(at.current+=1,console.error(`[pollSessionStatus] poll #${v} error:`,lt),at.current>=uh){O("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}$t.current=setTimeout(N,5e3);}};$t.current=setTimeout(N,3e3);},[O,Ti]),lo=useCallback(()=>{if(pe.current==="processing"&&mt?.id){if(!Se.current){O("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}De(),at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),ao(mt.id);}},[De,O,ao,mt?.id]),Dr=useCallback(async R=>{y(true),De(),d("");try{d("Confirming purchase...");let v=await yo(N=>Ru(R,N));console.log("[finalizeOnrampSession] confirmed session:",v.id,"status:",v.status),ue(v),b("processing"),d(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",v.id),ao(v.id);}finally{y(false);}},[De,ao,yo]),zo=useRef(false),zm=useCallback(async()=>{if(!(!mt||zo.current)){zo.current=true;try{y(!0),De(),d("Refreshing quote...");let R=await yo(v=>Tc(mt.id,v));ue(R),await Dr(R.id);}catch(R){console.log("[confirmCheckout] error:",R?.message),O("session_error","Something went wrong. Please try again."),b("quote");}finally{y(false),zo.current=false;}}},[De,O,Dr,mt,yo]),Nd=useCallback(async()=>{let R=T;if(!R)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",R),d("Verifying identity...");let v=await Sc(R),N=await i(v);return N?.status==="Consented"&&N.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",N.customerId),he.current=N.customerId,se(N.customerId),Sn=N.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",N?.status),!1)}catch(v){return console.warn("[reauthorizeLink] failed:",v?.message),false}},[i,T]),Um=useCallback(async(R=false,v,N)=>{let Z=v??ve;if(console.log("[collectPaymentMethod] called:",{useApplePay:R,amt:Z,amountOverride:v,sourceAmount:ve,hasSavedToken:!!N}),!Z||isNaN(Number(Z))||Number(Z)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),O("validation_error","Please enter a valid amount.");return}v&&xt(v),y(true),De(),d("");try{let fe=await so();if(fe.error){O("configuration_error",fe.error.message,fe.error.code);return}let lt;if(N)console.log("[collectPaymentMethod] using saved payment token"),lt=N;else if(R){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),O("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),b("session_params");return}d("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Vt={applePay:{merchantCountryCode:"US",currencyCode:de.toUpperCase(),cartItems:[{paymentType:PlatformPay.PaymentType.Immediate,label:`${ze.toUpperCase()} purchase + fees`,amount:Z}]}},sr=await h("PlatformPay",Vt);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!sr?.error),sr?.error){let qr=sr.error.message??"",Qr=sr.error.code??"",Lt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",sr.error,"isCancellation:",Lt),Lt||(O("payment_error",qr,Qr),b("session_params"));return}if(!sr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}d("Creating payment token...");let er=await C();if(console.log("[collectPaymentMethod] tokenResult ok:",!er?.error),er?.error){O("payment_error",er.error.message,er.error.code),b("session_params");return}lt=er.cryptoPaymentToken;}else {d("Select a payment method...");let Vt=await h("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Vt?.error),Vt?.error){let qr=Vt.error.message??"",Qr=Vt.error.code??"",Lt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",Vt.error,"isCancellation:",Lt),Lt||(O("payment_error",qr,Qr),b("session_params"));return}if(!Vt?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let sr=Vt.displayData;console.log("[collectPaymentMethod] displayData:",{type:sr.type,label:sr.label,sublabel:sr.sublabel,hasIcon:!!sr.icon}),d("Creating payment token...");let er=await C();if(console.log("[collectPaymentMethod] tokenResult ok:",!er?.error),er?.error){O("payment_error",er.error.message,er.error.code),b("session_params");return}lt=er.cryptoPaymentToken;}d("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",be,"walletAddressRef:",We.current);let Ne=We.current||be.toLowerCase(),ur=await yo(Vt=>_u({cryptoCustomerId:he.current,paymentToken:lt,sourceAmount:Number(Z),sourceCurrency:de,destinationCurrency:ze,walletAddress:Ne,destinationNetwork:ae},Vt));console.log("[collectPaymentMethod] session created:",ur?.id,"useApplePay:",R),ue(ur),d(""),R?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await Dr(ur.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):b("quote");}catch(fe){console.log("[collectPaymentMethod] error caught:",fe?.message),O("session_error","Something went wrong. Please try again."),b("session_params");}finally{y(false),d("");}},[De,so,h,C,ze,O,Dr,xt,ve,de,be,ae,yo,e?.merchantIdentifier]),Hm=useCallback(async()=>{y(true),De(),d("Select a payment method...");try{let R=await so();if(R.error)return O("configuration_error",R.error.message,R.error.code),null;let v=await h("Card");if(console.log("[addPaymentMethod] Card result ok:",!v?.error),v?.error?.message&&/no active link consumer/i.test(v.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await Nd())return O("authorization_error","Please verify your identity to add a payment method."),null;v=await h("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!v?.error);}if(v?.error){let fe=v.error.message??"",lt=v.error.code??"",Ne=/cancel/i.test(fe)||/cancel/i.test(lt);return console.log("[addPaymentMethod] pmResult error:",v.error,"isCancellation:",Ne),Ne||O("payment_error",fe,lt),null}if(!v?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let N=v.displayData;console.log("[addPaymentMethod] displayData:",{type:N.type,label:N.label,sublabel:N.sublabel,hasIcon:!!N.icon}),d("Saving payment method...");let Z=await C();return console.log("[addPaymentMethod] tokenResult ok:",!Z?.error),Z?.error?(O("payment_error",Z.error.message,Z.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:Z.cryptoPaymentToken,sublabel:N.sublabel??""})}catch(R){return console.log("[addPaymentMethod] error:",R?.message),O("session_error",R?.message??String(R)),null}finally{y(false),d("");}},[De,so,h,C,O,Nd]),Nm=useCallback(async()=>{if(mt){y(true),De(),d("");try{let R=await yo(v=>Tc(mt.id,v));ue(R);}catch(R){console.log("[refreshQuote] error:",R?.message),O("session_error","Something went wrong. Please try again.");}finally{y(false);}}},[De,O,mt,yo]),jm=useCallback(()=>{xe.current=true,at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),b(r),y(false),d(""),_(null),k(e?.email??""),A(e?.phone??""),F(""),H("US"),se(""),he.current="",Fe(""),Se.current="",G.current="",Ge(false),te(false),X(Du),pt(e?.recipientAddress??""),We.current="",Ye.current=false,oe(Onramp.CryptoNetwork.ethereum),xt(e?.defaultSourceAmount??"100"),le(e?.defaultSourceCurrency??"usd"),Yt(e?.defaultDestinationCurrency??"usdc"),W(""),xr(void 0),io(void 0),ue(null),Te.current+=1,st.current=false,Ae.current=false;},[e,r]);return {step:g,restoring:w,loading:S,status:f,error:x,email:T,phone:I,fullName:V,country:P,customerId:M,accessToken:He,session:mt,kycData:me,walletAddress:be,resolvedRecipientAddress:z,walletNetwork:ae,sourceAmount:ve,sourceCurrency:de,destinationCurrency:ze,tokenIconUrl:et,networkIconUrl:_t,applePaySupported:Or,walletReady:Ie,walletLoading:ke,setStep:b,setStatus:d,setEmail:k,setPhone:A,setFullName:F,setCountry:H,setWalletAddress:pt,setWalletNetwork:oe,setSourceAmount:xt,setSourceCurrency:le,setDestinationCurrency:Yt,checkEmail:q,register:ie,attachKyc:wt,verifyIdentity:Fr,registerWallet:bs,collectPaymentMethod:Um,addPaymentMethod:Hm,refreshQuote:Nm,confirmCheckout:zm,reset:jm,clearError:De,emitComplete:ft,resumeFulfillmentPolling:lo,amountFirst:t}}function Vu({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:m}){return r?jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:m}),jsxs(View,{style:e.flow.centered,children:[jsx(ht,{size:56,strokeWidth:3}),jsx(wr,{error:n,progress:a,loading:o})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:m}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your email"}),jsx(Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Email address"}),jsx(TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ht,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsx(Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(wr,{error:n,progress:a,loading:o})]})]})})}function Bu({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:a}),jsxs(View,{style:e.flow.centered,children:[t?jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(ht,{size:48,strokeWidth:3})}),jsx(Text,{style:e.flow.heading,children:"Verifying identity"}),jsx(Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsx(Text,{style:e.flow.heading,children:"Identity verification"}),jsx(Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsx(wr,{error:o,progress:r,loading:false})]}),!t&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsx(Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function Wu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:m,onRetryStatusCheck:u}){let{colors:h}=D(),C=!!t;return jsxs(View,{style:e.form.screen,children:[C?jsx(Jt,{onPress:m}):jsx(View,{style:Fa}),jsx(View,{style:e.flow.centered,children:t?jsxs(Fragment,{children:[jsx(Text,{style:e.flow.heading,children:"Could not confirm status"}),jsx(Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(ht,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsx(Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxs(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&&a&&i&&jsx(Va,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxs(View,{style:e.form.footer,children:[jsx(wr,{error:t,progress:r,loading:o}),t?jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:u,children:jsx(Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Eu({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:m}){let{colors:u}=D(),h=t.transaction_details,C=Pa(h.destination_amount,h.destination_currency);return jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:m??l,title:"Review your purchase",variant:m?"back":"close"}),jsxs(View,{style:e.form.content,children:[jsx(View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsx(hu,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxs(View,{style:e.quote.card,children:[jsx(co,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsx(co,{quote:e.quote,label:"You receive",value:`${C} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(co,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsx(co,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ht,{size:28,strokeWidth:2,gradientFrom:u.primaryForeground,gradientTo:u.primaryForeground})}):jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsx(Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsx(wr,{error:o,progress:n,loading:r})]})]})}function Mu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:m}){let u=D();return t?jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:m}),jsxs(View,{style:e.flow.centered,children:[jsx(ht,{size:56,strokeWidth:3}),jsx(wr,{error:o,progress:n,loading:r})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:m}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your phone"}),jsx(Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Phone number"}),jsx(TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:u.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:h=>s(h.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsx(Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxs(View,{style:e.form.emailRow,children:[jsx(Text,{style:e.form.emailLabel,children:"Signing up as"}),jsx(Text,{style:e.form.emailValue,children:a})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ht,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsx(Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(wr,{error:o,progress:n,loading:r})]})]})})}function Ih({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=D(),n=e.toLowerCase(),a=Da[n]??o.primary,i=Math.round(r*.36);return jsxs(View,{style:{width:r,height:r,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsx(View,{style:[xo.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsx(Text,{style:[xo.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsx(View,{style:[xo.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsx(Qe,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function zu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:m}=D(),u=t.transaction_details,h=Pa(u.destination_amount,u.destination_currency),C=r||o||"";Oa(u.destination_network);return jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:i,title:"Purchase complete"}),jsx(View,{style:e.form.content,children:jsxs(gt,{style:e.form.flex,contentContainerStyle:xo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:xo.iconSection,children:[jsx(Ih,{currency:u.destination_currency,tokenIconUrl:n,size:72}),jsxs(View,{style:xo.statusRow,children:[jsx(View,{style:[xo.statusDot,{backgroundColor:s.success}]}),jsx(Text,{style:[xo.statusText,{color:s.foreground,fontFamily:m.semibold}],children:"Completed"})]}),jsx(Text,{style:[xo.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsx(Va,{sourceCurrency:u.source_currency,destinationCurrency:u.destination_currency,destinationNetwork:u.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxs(View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},xo.detailCard],children:[jsx(co,{quote:e.quote,label:"You Paid",value:`${u.source_amount} ${u.source_currency.toUpperCase()}`,hideDivider:true}),jsx(co,{quote:e.quote,label:"You Received",value:`${h} ${u.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(co,{quote:e.quote,label:"Network Fee",value:`$${u.fees.network_fee_amount}`,hideDivider:true}),jsx(co,{quote:e.quote,label:"Transaction Fee",value:`$${u.fees.transaction_fee_amount}`,hideDivider:true}),jsx(fc,{quote:e.quote,label:"Intent Address",address:u.wallet_address,hideDivider:true}),C?jsx(fc,{quote:e.quote,label:"Recipient Address",address:C,last:true}):jsx(co,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsx(Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var xo=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 Uu({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:m,registerWallet:u,onClose:h}){let{components:C}=D();if(t){let g=!r&&!!o;return jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:h}),jsxs(View,{style:e.flow.centered,children:[!g&&jsx(ht,{size:56,strokeWidth:3}),jsx(wr,{error:o,progress:n,loading:r})]}),g&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:u,children:jsx(Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(Jt,{onPress:h}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Your crypto wallet"}),jsx(Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsx(TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:C.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Network"}),jsx(View,{style:e.wallet.list,children:va.map(g=>{let b=i===g.value;return jsxs(TouchableOpacity,{style:[e.wallet.row,b&&e.wallet.rowSelected],onPress:()=>{l(g.value),m(g.defaultCrypto);},children:[jsx(View,{style:e.wallet.iconWrap,children:jsx(g.Icon,{size:24})}),jsx(Text,{style:[e.wallet.rowText,b&&e.wallet.rowTextSelected],children:g.label}),b&&jsx(View,{style:e.wallet.checkCircle,children:jsx(Qe,{size:14,color:C.container.buttonTitleColor,strokeWidth:2.5})})]},g.value)})})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ht,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:u,disabled:!a,children:jsx(Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(wr,{error:o,progress:n,loading:r})]})]})})}function $a({config:e,onClose:t}){let r=D(),o=Bi(),{step:n,restoring:a,loading:i,status:s,error:l,email:m,phone:u,session:h,kycData:C,walletAddress:g,resolvedRecipientAddress:b,walletNetwork:w,sourceAmount:c,sourceCurrency:S,destinationCurrency:y,tokenIconUrl:f,networkIconUrl:d,applePaySupported:x,setStep:_,setEmail:T,setPhone:k,setWalletAddress:I,setWalletNetwork:A,setSourceAmount:V,setDestinationCurrency:F,checkEmail:P,register:H,attachKyc:M,verifyIdentity:se,registerWallet:He,collectPaymentMethod:Fe,addPaymentMethod:G,confirmCheckout:Se,reset:he,emitComplete:Ie,resumeFulfillmentPolling:Ge,amountFirst:ke,customerId:te,accessToken:Te}=za(e),st=!!e?.email,Ae=!!e?.phone,Ye=!!e?.publishableKey&&!!e?.externalUserId,[We,Ee]=useState(void 0),[Me,me]=useState([]);useEffect(()=>{if(n!=="session_params"||!te||!Te)return;console.log("[OnrampScreen] customerId:",te);let W=oe=>{let ve=oe?.message??"";return ve.includes("stripe_onramp_forbidden")||ve.includes("403")},ae=oe=>{W(oe)&&(Cn(),he());};Ma(te,Te).then(oe=>{console.log("[OnrampScreen] customer fetched, id:",oe?.id);}).catch(oe=>{console.warn("[OnrampScreen] customer fetch error:",oe?.message),ae(oe);}),xc(te,Te).then(oe=>{console.log("[OnrampScreen] payment_tokens fetched, count:",oe.data?.length??0),me(oe.data??[]);}).catch(oe=>{console.warn("[OnrampScreen] payment_tokens error:",oe?.message),ae(oe);}),console.log("[OnrampScreen] walletAddress:",g,"walletNetwork:",w),g&&(console.log("[OnrampScreen] calling getTransactionLimits..."),vu({destinationNetwork:w||"ethereum",walletAddress:g,accessToken:Te,cryptoCustomerId:te}).then(oe=>{console.log("[OnrampScreen] transaction_limits fetched");let ve=oe.limits?.usd;if(ve?.card?.length){let xt=Math.max(...ve.card.map(de=>de.limit));Ee(xt),console.log("[OnrampScreen] card max amount:",xt);}}).catch(oe=>{console.warn("[OnrampScreen] transaction_limits error:",oe?.message),ae(oe);}));},[n,te,Te,g,w,he]);let X=async()=>{if(!(!te||!Te))try{let W=await xc(te,Te);console.log("[OnrampScreen] payment_tokens refreshed, count:",W.data?.length??0),me(W.data??[]);}catch(W){console.warn("[OnrampScreen] payment_tokens refresh error:",W?.message);let ae=W?.message??"";(ae.includes("stripe_onramp_forbidden")||ae.includes("403"))&&(Cn(),he());}},be=async()=>{let W=await G();return W&&await X(),W},pt=e?.skipSuccessConfirmation===true;useEffect(()=>{n==="success"&&pt&&h&&(Ie(h),he(),t?.());},[n,pt,h,Ie,he,t]);let z=()=>{he(),t?.();};return a?jsx(View,{style:[Vh.container,{backgroundColor:r.colors.background}],children:jsx(ht,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsx(Vu,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:st,loading:i,error:l,status:s,email:m,setEmail:T,checkEmail:P,onClose:z}):n==="register"?jsx(Mu,{styles:o,hasPrefilledPhone:Ae,loading:i,error:l,status:s,email:m,phone:u,setPhone:k,register:H,onClose:z}):n==="kyc"?jsx(Ba,{initialData:C,loading:i,onComplete:M,onCancel:()=>_("email")}):n==="identity"?jsx(Bu,{styles:o,loading:i,status:s,error:l,verifyIdentity:se,onClose:z}):n==="wallet"?jsx(Uu,{styles:o,hasAutoWallet:Ye,loading:i,error:l,status:s,walletAddress:g,walletNetwork:w,setWalletAddress:I,setWalletNetwork:A,setDestinationCurrency:F,registerWallet:He,onClose:z}):n==="session_params"?jsx(La,{initialAmount:c,currency:S,applePaySupported:x,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:We,paymentTokens:Me,onAddPaymentMethod:be,onCollectPayment:(W,ae)=>{Fe(W,ae);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(W,ae)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:W,selectedMethod:ae,amountFirst:ke}),ke&&!te)V(W),_("email");else {let oe=ae==="apple_pay",ve=!oe&&ae?ae:void 0;console.log("[OnrampScreen] isApplePay:",oe,"hasSavedToken:",!!ve),Fe(oe,W,ve);}},onCancel:z}):n==="quote"&&h?jsx(Eu,{styles:o,session:h,loading:i,error:l,status:s,confirmCheckout:Se,tokenIconUrl:f,networkIconUrl:d,onClose:z,onBack:()=>_("session_params")}):n==="processing"?jsx(Wu,{styles:o,error:l,status:s,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??y,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:f,networkIconUrl:d,onClose:z,onRetryStatusCheck:Ge}):n==="success"&&h&&!pt?jsx(zu,{styles:o,session:h,resolvedRecipientAddress:b,recipientFromConfig:e?.recipientAddress,tokenIconUrl:f,networkIconUrl:d,onDone:()=>{Ie(h),he(),t?.();}}):null}var Vh=StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function ju(){try{let e=Lh.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 a=n.trim();if(a.length>0)return a}}}catch{}}function qa({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:m,onError:u,onStepChange:h,onClose:C,merchantIdentifier:g="",urlScheme:b="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:c=false}){let{colors:S,fonts:y,components:f}=D(),d=e||ka(),x=useMemo(()=>{let V=g.trim();return V.length>0?V:ju()??""},[g]),[_,T]=useState("loading"),[k,I]=useState(null);useEffect(()=>{let V=false;async function F(){try{d&&(Aa(d),Wa(Is()));let P=await Ea();if(V)return;let H=x.trim();if(await initStripe({publishableKey:P,urlScheme:b,...H?{merchantIdentifier:H}:{}}),V)return;T("ready");}catch(P){if(V)return;console.error("[StripeOnramp] Init failed:",P),I(P?.message??"Failed to load Stripe configuration"),T("error");}}return F(),()=>{V=true;}},[d,x,b]);let A=useMemo(()=>{let V={publishableKey:d,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:m,onError:u,onStepChange:h};return s&&(V.destinationTokenAddress=s),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),w&&(V.paymentSelectorPosition=w),V.skipSuccessConfirmation=c,V.merchantIdentifier=x,V},[d,o,a,i,s,l,t,r,n,w,c,x,m,u,h]);return _==="error"?jsxs(View,{style:[zi.centered,{backgroundColor:S.background}],children:[jsx(Text,{style:[zi.errorText,{color:S.error,fontFamily:y.medium}],children:"Unable to initialize"}),jsx(Text,{style:[zi.errorDetail,{color:S.foregroundMuted,fontFamily:y.regular}],children:k}),C&&jsx(TouchableOpacity,{style:[zi.retryBtn,{backgroundColor:f.button.primaryBackground,borderRadius:f.button.borderRadius}],onPress:C,children:jsx(Text,{style:[zi.retryBtnText,{color:f.button.primaryText,fontFamily:y.medium}],children:"Go Back"})})]}):_==="loading"?jsx(View,{style:[zi.centered,{backgroundColor:S.background}],children:jsx(ht,{size:56,strokeWidth:3,gradientFrom:S.primary,gradientTo:S.primary})}):jsx($a,{config:A,onClose:C})}var zi=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 Ku(){let{configure:e}=useOnramp(),t=useRef(false);return 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 Gu="__unifold_stripe_onramp__";function Qa(e){globalThis[Gu]=e;}function Yu(){return globalThis[Gu]}Qa(qa);var _o=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 Jn,xn,Ui,Ju,Nh=(Ju=class extends _o{constructor(){super();Y(this,Jn);Y(this,xn);Y(this,Ui);B(this,Ui,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){p(this,xn)||this.setEventListener(p(this,Ui));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,xn))==null||t.call(this),B(this,xn,void 0));}setEventListener(t){var r;B(this,Ui,t),(r=p(this,xn))==null||r.call(this),B(this,xn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){p(this,Jn)!==t&&(B(this,Jn,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof p(this,Jn)=="boolean"?p(this,Jn):globalThis.document?.visibilityState!=="hidden"}},Jn=new WeakMap,xn=new WeakMap,Ui=new WeakMap,Ju),Hi=new Nh;var jh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ro,Zn,Zu,$h=(Zu=class{constructor(){Y(this,Ro,jh);Y(this,Zn,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&p(this,Zn)&&e!==p(this,Ro)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:p(this,Ro),provider:e}),B(this,Ro,e),process.env.NODE_ENV!=="production"&&B(this,Zn,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&B(this,Zn,true),p(this,Ro).setTimeout(e,t)}clearTimeout(e){p(this,Ro).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&B(this,Zn,true),p(this,Ro).setInterval(e,t)}clearInterval(e){p(this,Ro).clearInterval(e);}},Ro=new WeakMap,Zn=new WeakMap,Zu),Io=new $h;function Xu(e){setTimeout(e,0);}var Dc=typeof window>"u"||"Deno"in globalThis;function Kt(){}function rp(e,t){return typeof e=="function"?e(t):e}function Ms(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ga(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mo(e,t){return typeof e=="function"?e(t):e}function Rr(e,t){return typeof e=="function"?e(t):e}function Ya(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==zs(i,t.options))return false}else if(!ti(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function Ja(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(Xn(t.options.mutationKey)!==Xn(a))return false}else if(!ti(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function zs(e,t){return (t?.queryKeyHashFn||Xn)(e)}function Xn(e){return JSON.stringify(e,(t,r)=>Fc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ti(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ti(e[r],t[r])):false}var qh=Object.prototype.hasOwnProperty;function Ka(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=ep(e)&&ep(t);if(!o&&!(Fc(e)&&Fc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},m=0;for(let u=0;u<s;u++){let h=o?u:i[u],C=e[h],g=t[h];if(C===g){l[h]=C,(o?u<a:qh.call(e,h))&&m++;continue}if(C===null||g===null||typeof C!="object"||typeof g!="object"){l[h]=g;continue}let b=Ka(C,g,r+1);l[h]=b,b===C&&m++;}return a===s&&m===a?e:l}function Za(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 ep(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fc(e){if(!tp(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!tp(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function tp(e){return Object.prototype.toString.call(e)==="[object Object]"}function op(e){return new Promise(t=>{Io.setTimeout(t,e);})}function Us(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 Ka(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 Ka(e,t)}return t}function np(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function ip(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ei=Symbol();function Xa(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ei&&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===ei?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function el(e,t){return typeof e=="function"?e(...t):!!e}function sp(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 vo=(()=>{let e=()=>Dc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Hs(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});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 ap=Xu;function Qh(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=ap,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var St=Qh();var Ni,_n,ji,lp,Kh=(lp=class extends _o{constructor(){super();Y(this,Ni,true);Y(this,_n);Y(this,ji);B(this,ji,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(){p(this,_n)||this.setEventListener(p(this,ji));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,_n))==null||t.call(this),B(this,_n,void 0));}setEventListener(t){var r;B(this,ji,t),(r=p(this,_n))==null||r.call(this),B(this,_n,t(this.setOnline.bind(this)));}setOnline(t){p(this,Ni)!==t&&(B(this,Ni,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return p(this,Ni)}},Ni=new WeakMap,_n=new WeakMap,ji=new WeakMap,lp),$i=new Kh;function Gh(e){return Math.min(1e3*2**e,3e4)}function Vc(e){return (e??"online")==="online"?$i.isOnline():true}var tl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function rl(e){let t=false,r=0,o,n=Hs(),a=()=>n.status!=="pending",i=w=>{if(!a()){let c=new tl(w);C(c),e.onCancel?.(c);}},s=()=>{t=true;},l=()=>{t=false;},m=()=>Hi.isFocused()&&(e.networkMode==="always"||$i.isOnline())&&e.canRun(),u=()=>Vc(e.networkMode)&&e.canRun(),h=w=>{a()||(o?.(),n.resolve(w));},C=w=>{a()||(o?.(),n.reject(w));},g=()=>new Promise(w=>{o=c=>{(a()||m())&&w(c);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),b=()=>{if(a())return;let w,c=r===0?e.initialPromise:void 0;try{w=c??e.fn();}catch(S){w=Promise.reject(S);}Promise.resolve(w).then(h).catch(S=>{if(a())return;let y=e.retry??(vo.isServer()?0:3),f=e.retryDelay??Gh,d=typeof f=="function"?f(r,S):f,x=y===true||typeof y=="number"&&r<y||typeof y=="function"&&y(r,S);if(t||!x){C(S);return}r++,e.onFail?.(r,S),op(d).then(()=>m()?void 0:g()).then(()=>{t?C(S):b();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:u,start:()=>(u()?b():g().then(b),n)}}var ri,cp,ol=(cp=class{constructor(){Y(this,ri);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ms(this.gcTime)&&B(this,ri,Io.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vo.isServer()?1/0:300*1e3));}clearGcTimeout(){p(this,ri)!==void 0&&(Io.clearTimeout(p(this,ri)),B(this,ri,void 0));}},ri=new WeakMap,cp);var oi,qi,to,ni,rr,Ns,ii,Hr,fp,Ko,pp,mp=(pp=class extends ol{constructor(t){super();Y(this,Hr);Y(this,oi);Y(this,qi);Y(this,to);Y(this,ni);Y(this,rr);Y(this,Ns);Y(this,ii);B(this,ii,false),B(this,Ns,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,ni,t.client),B(this,to,p(this,ni).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,oi,up(this.options)),this.state=t.state??p(this,oi),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return p(this,rr)?.promise}setOptions(t){if(this.options={...p(this,Ns),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=up(this.options);r.data!==void 0&&(this.setState(dp(r.data,r.dataUpdatedAt)),B(this,oi,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&p(this,to).remove(this);}setData(t,r){let o=Us(this.state.data,t,this.options);return Le(this,Hr,Ko).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Le(this,Hr,Ko).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=p(this,rr)?.promise;return p(this,rr)?.cancel(t),r?r.then(Kt).catch(Kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return p(this,oi)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Rr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ei||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>mo(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:!Ga(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),p(this,rr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),p(this,rr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),p(this,to).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(p(this,rr)&&(p(this,ii)||Le(this,Hr,fp).call(this)?p(this,rr).cancel({revert:true}):p(this,rr).cancelRetry()),this.scheduleGc()),p(this,to).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,Hr,Ko).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&p(this,rr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(p(this,rr))return p(this,rr).continueRetry(),p(this,rr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(m=>m.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(B(this,ii,true),o.signal)});},a=()=>{let l=Xa(this.options,r),u=(()=>{let h={client:p(this,ni),queryKey:this.queryKey,meta:this.meta};return n(h),h})();return B(this,ii,false),this.options.persister?this.options.persister(l,u,this):l(u)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:p(this,ni),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),B(this,qi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Le(this,Hr,Ko).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),B(this,rr,rl({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof tl&&l.revert&&this.setState({...p(this,qi),fetchStatus:"idle"}),o.abort();},onFail:(l,m)=>{Le(this,Hr,Ko).call(this,{type:"failed",failureCount:l,error:m});},onPause:()=>{Le(this,Hr,Ko).call(this,{type:"pause"});},onContinue:()=>{Le(this,Hr,Ko).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await p(this,rr).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),p(this,to).config.onSuccess?.(l,this),p(this,to).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof tl){if(l.silent)return p(this,rr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Le(this,Hr,Ko).call(this,{type:"error",error:l}),p(this,to).config.onError?.(l,this),p(this,to).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},oi=new WeakMap,qi=new WeakMap,to=new WeakMap,ni=new WeakMap,rr=new WeakMap,Ns=new WeakMap,ii=new WeakMap,Hr=new WeakSet,fp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Ko=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,...Lc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...dp(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,qi,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),St.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),p(this,to).notify({query:this,type:"updated",action:t});});},pp);function Lc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function dp(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function up(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 Ir,je,$s,Sr,si,Qi,Go,Rn,qs,Ki,Gi,ai,li,In,Yi,ot,js,Bc,Ac,Wc,Ec,Mc,zc,Uc,bp,yp,Nc=(yp=class extends _o{constructor(t,r){super();Y(this,ot);Y(this,Ir);Y(this,je);Y(this,$s);Y(this,Sr);Y(this,si);Y(this,Qi);Y(this,Go);Y(this,Rn);Y(this,qs);Y(this,Ki);Y(this,Gi);Y(this,ai);Y(this,li);Y(this,In);Y(this,Yi,new Set);this.options=r,B(this,Ir,t),B(this,Rn,null),B(this,Go,Hs()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(p(this,je).addObserver(this),hp(p(this,je),this.options)?Le(this,ot,js).call(this):this.updateResult(),Le(this,ot,Ec).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Hc(p(this,je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hc(p(this,je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,ot,Mc).call(this),Le(this,ot,zc).call(this),p(this,je).removeObserver(this);}setOptions(t){let r=this.options,o=p(this,je);if(this.options=p(this,Ir).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rr(this.options.enabled,p(this,je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,ot,Uc).call(this),p(this,je).setOptions(this.options),r._defaulted&&!Za(this.options,r)&&p(this,Ir).getQueryCache().notify({type:"observerOptionsUpdated",query:p(this,je),observer:this});let n=this.hasListeners();n&&gp(p(this,je),o,this.options,r)&&Le(this,ot,js).call(this),this.updateResult(),n&&(p(this,je)!==o||Rr(this.options.enabled,p(this,je))!==Rr(r.enabled,p(this,je))||mo(this.options.staleTime,p(this,je))!==mo(r.staleTime,p(this,je)))&&Le(this,ot,Bc).call(this);let a=Le(this,ot,Ac).call(this);n&&(p(this,je)!==o||Rr(this.options.enabled,p(this,je))!==Rr(r.enabled,p(this,je))||a!==p(this,In))&&Le(this,ot,Wc).call(this,a);}getOptimisticResult(t){let r=p(this,Ir).getQueryCache().build(p(this,Ir),t),o=this.createResult(r,t);return Jh(this,o)&&(B(this,Sr,o),B(this,Qi,this.options),B(this,si,p(this,je).state)),o}getCurrentResult(){return p(this,Sr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&p(this,Go).status==="pending"&&p(this,Go).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){p(this,Yi).add(t);}getCurrentQuery(){return p(this,je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=p(this,Ir).defaultQueryOptions(t),o=p(this,Ir).getQueryCache().build(p(this,Ir),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Le(this,ot,js).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),p(this,Sr)))}createResult(t,r){let o=p(this,je),n=this.options,a=p(this,Sr),i=p(this,si),s=p(this,Qi),m=t!==o?t.state:p(this,$s),{state:u}=t,h={...u},C=false,g;if(r._optimisticResults){let I=this.hasListeners(),A=!I&&hp(t,r),V=I&&gp(t,o,r,n);(A||V)&&(h={...h,...Lc(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:b,errorUpdatedAt:w,status:c}=h;g=h.data;let S=false;if(r.placeholderData!==void 0&&g===void 0&&c==="pending"){let I;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(I=a.data,S=true):I=typeof r.placeholderData=="function"?r.placeholderData(p(this,Gi)?.state.data,p(this,Gi)):r.placeholderData,I!==void 0&&(c="success",g=Us(a?.data,I,r),C=true);}if(r.select&&g!==void 0&&!S)if(a&&g===i?.data&&r.select===p(this,qs))g=p(this,Ki);else try{B(this,qs,r.select),g=r.select(g),g=Us(a?.data,g,r),B(this,Ki,g),B(this,Rn,null);}catch(I){B(this,Rn,I);}p(this,Rn)&&(b=p(this,Rn),g=p(this,Ki),w=Date.now(),c="error");let y=h.fetchStatus==="fetching",f=c==="pending",d=c==="error",x=f&&y,_=g!==void 0,k={status:c,fetchStatus:h.fetchStatus,isPending:f,isSuccess:c==="success",isError:d,isInitialLoading:x,isLoading:x,data:g,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>m.dataUpdateCount||h.errorUpdateCount>m.errorUpdateCount,isFetching:y,isRefetching:y&&!f,isLoadingError:d&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:C,isRefetchError:d&&_,isStale:jc(t,r),refetch:this.refetch,promise:p(this,Go),isEnabled:Rr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let I=k.data!==void 0,A=k.status==="error"&&!I,V=H=>{A?H.reject(k.error):I&&H.resolve(k.data);},F=()=>{let H=B(this,Go,k.promise=Hs());V(H);},P=p(this,Go);switch(P.status){case "pending":t.queryHash===o.queryHash&&V(P);break;case "fulfilled":(A||k.data!==P.value)&&F();break;case "rejected":(!A||k.error!==P.reason)&&F();break}}return k}updateResult(){let t=p(this,Sr),r=this.createResult(p(this,je),this.options);if(B(this,si,p(this,je).state),B(this,Qi,this.options),p(this,si).data!==void 0&&B(this,Gi,p(this,je)),Za(r,t))return;B(this,Sr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!p(this,Yi).size)return true;let i=new Set(a??p(this,Yi));return this.options.throwOnError&&i.add("error"),Object.keys(p(this,Sr)).some(s=>{let l=s;return p(this,Sr)[l]!==t[l]&&i.has(l)})};Le(this,ot,bp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,ot,Ec).call(this);}},Ir=new WeakMap,je=new WeakMap,$s=new WeakMap,Sr=new WeakMap,si=new WeakMap,Qi=new WeakMap,Go=new WeakMap,Rn=new WeakMap,qs=new WeakMap,Ki=new WeakMap,Gi=new WeakMap,ai=new WeakMap,li=new WeakMap,In=new WeakMap,Yi=new WeakMap,ot=new WeakSet,js=function(t){Le(this,ot,Uc).call(this);let r=p(this,je).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Kt)),r},Bc=function(){Le(this,ot,Mc).call(this);let t=mo(this.options.staleTime,p(this,je));if(vo.isServer()||p(this,Sr).isStale||!Ms(t))return;let o=Ga(p(this,Sr).dataUpdatedAt,t)+1;B(this,ai,Io.setTimeout(()=>{p(this,Sr).isStale||this.updateResult();},o));},Ac=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,je)):this.options.refetchInterval)??false},Wc=function(t){Le(this,ot,zc).call(this),B(this,In,t),!(vo.isServer()||Rr(this.options.enabled,p(this,je))===false||!Ms(p(this,In))||p(this,In)===0)&&B(this,li,Io.setInterval(()=>{(this.options.refetchIntervalInBackground||Hi.isFocused())&&Le(this,ot,js).call(this);},p(this,In)));},Ec=function(){Le(this,ot,Bc).call(this),Le(this,ot,Wc).call(this,Le(this,ot,Ac).call(this));},Mc=function(){p(this,ai)!==void 0&&(Io.clearTimeout(p(this,ai)),B(this,ai,void 0));},zc=function(){p(this,li)!==void 0&&(Io.clearInterval(p(this,li)),B(this,li,void 0));},Uc=function(){let t=p(this,Ir).getQueryCache().build(p(this,Ir),this.options);if(t===p(this,je))return;let r=p(this,je);B(this,je,t),B(this,$s,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},bp=function(t){St.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(p(this,Sr));}),p(this,Ir).getQueryCache().notify({query:p(this,je),type:"observerResultsUpdated"});});},yp);function Yh(e,t){return Rr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function hp(e,t){return Yh(e,t)||e.state.data!==void 0&&Hc(e,t,t.refetchOnMount)}function Hc(e,t,r){if(Rr(t.enabled,e)!==false&&mo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&jc(e,t)}return false}function gp(e,t,r,o){return (e!==t||Rr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&jc(e,r)}function jc(e,t){return Rr(t.enabled,e)!==false&&e.isStaleByTime(mo(t.staleTime,e))}function Jh(e,t){return !Za(e.getCurrentResult(),t)}function $c(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,m=async()=>{let u=false,h=b=>{sp(b,()=>t.signal,()=>u=true);},C=Xa(t.options,t.fetchOptions),g=async(b,w,c)=>{if(u)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);let y=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:c?"backward":"forward",meta:t.options.meta};return h(_),_})(),f=await C(y),{maxPages:d}=t.options,x=c?ip:np;return {pages:x(b.pages,f,d),pageParams:x(b.pageParams,w,d)}};if(n&&a.length){let b=n==="backward",w=b?Zh:Cp,c={pages:a,pageParams:i},S=w(o,c);s=await g(c,S,b);}else {let b=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:Cp(o,s);if(l>0&&w==null)break;s=await g(s,w),l++;}while(l<b)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=m;}}}function Cp(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 Zh(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Qs,Po,hr,ci,Oo,vn,wp,Sp=(wp=class extends ol{constructor(t){super();Y(this,Oo);Y(this,Qs);Y(this,Po);Y(this,hr);Y(this,ci);B(this,Qs,t.client),this.mutationId=t.mutationId,B(this,hr,t.mutationCache),B(this,Po,[]),this.state=t.state||Xh(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){p(this,Po).includes(t)||(p(this,Po).push(t),this.clearGcTimeout(),p(this,hr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){B(this,Po,p(this,Po).filter(r=>r!==t)),this.scheduleGc(),p(this,hr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){p(this,Po).length||(this.state.status==="pending"?this.scheduleGc():p(this,hr).remove(this));}continue(){return p(this,ci)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Le(this,Oo,vn).call(this,{type:"continue"});},o={client:p(this,Qs),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,ci,rl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Le(this,Oo,vn).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Le(this,Oo,vn).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(this,hr).canRun(this)}));let n=this.state.status==="pending",a=!p(this,ci).canStart();try{if(n)r();else {Le(this,Oo,vn).call(this,{type:"pending",variables:t,isPaused:a}),p(this,hr).config.onMutate&&await p(this,hr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Le(this,Oo,vn).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await p(this,ci).start();return await p(this,hr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await p(this,hr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Le(this,Oo,vn).call(this,{type:"success",data:i}),i}catch(i){try{await p(this,hr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await p(this,hr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Le(this,Oo,vn).call(this,{type:"error",error:i}),i}finally{p(this,hr).runNext(this);}}},Qs=new WeakMap,Po=new WeakMap,hr=new WeakMap,ci=new WeakMap,Oo=new WeakSet,vn=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),St.batch(()=>{p(this,Po).forEach(o=>{o.onMutationUpdate(t);}),p(this,hr).notify({mutation:this,type:"updated",action:t});});},wp);function Xh(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Yo,fo,Ks,kp,Tp=(kp=class extends _o{constructor(t={}){super();Y(this,Yo);Y(this,fo);Y(this,Ks);this.config=t,B(this,Yo,new Set),B(this,fo,new Map),B(this,Ks,0);}build(t,r,o){let n=new Sp({client:t,mutationCache:this,mutationId:++Cs(this,Ks)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){p(this,Yo).add(t);let r=nl(t);if(typeof r=="string"){let o=p(this,fo).get(r);o?o.push(t):p(this,fo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(p(this,Yo).delete(t)){let r=nl(t);if(typeof r=="string"){let o=p(this,fo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&p(this,fo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=nl(t);if(typeof r=="string"){let n=p(this,fo).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=nl(t);return typeof r=="string"?p(this,fo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){St.batch(()=>{p(this,Yo).forEach(t=>{this.notify({type:"removed",mutation:t});}),p(this,Yo).clear(),p(this,fo).clear();});}getAll(){return Array.from(p(this,Yo))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ja(r,o))}findAll(t={}){return this.getAll().filter(r=>Ja(t,r))}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return St.batch(()=>Promise.all(t.map(r=>r.continue().catch(Kt))))}},Yo=new WeakMap,fo=new WeakMap,Ks=new WeakMap,kp);function nl(e){return e.options.scope?.id}var Fo,xp,_p=(xp=class extends _o{constructor(t={}){super();Y(this,Fo);this.config=t,B(this,Fo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??zs(n,r),i=this.get(a);return i||(i=new mp({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){p(this,Fo).has(t.queryHash)||(p(this,Fo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=p(this,Fo).get(t.queryHash);r&&(t.destroy(),r===t&&p(this,Fo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){St.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return p(this,Fo).get(t)}getAll(){return [...p(this,Fo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ya(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Ya(t,o)):r}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){St.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){St.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Fo=new WeakMap,xp);var Mt,Pn,On,Ji,Zi,Fn,Xi,es,Rp,qc=(Rp=class{constructor(e={}){Y(this,Mt);Y(this,Pn);Y(this,On);Y(this,Ji);Y(this,Zi);Y(this,Fn);Y(this,Xi);Y(this,es);B(this,Mt,e.queryCache||new _p),B(this,Pn,e.mutationCache||new Tp),B(this,On,e.defaultOptions||{}),B(this,Ji,new Map),B(this,Zi,new Map),B(this,Fn,0);}mount(){Cs(this,Fn)._++,p(this,Fn)===1&&(B(this,Xi,Hi.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onFocus());})),B(this,es,$i.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onOnline());})));}unmount(){var e,t;Cs(this,Fn)._--,p(this,Fn)===0&&((e=p(this,Xi))==null||e.call(this),B(this,Xi,void 0),(t=p(this,es))==null||t.call(this),B(this,es,void 0));}isFetching(e){return p(this,Mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return p(this,Pn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,Mt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=p(this,Mt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(mo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return p(this,Mt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=p(this,Mt).get(o.queryHash)?.state.data,i=rp(t,a);if(i!==void 0)return p(this,Mt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return St.batch(()=>p(this,Mt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,Mt).get(t.queryHash)?.state}removeQueries(e){let t=p(this,Mt);St.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=p(this,Mt);return St.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=St.batch(()=>p(this,Mt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Kt).catch(Kt)}invalidateQueries(e,t={}){return St.batch(()=>(p(this,Mt).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=St.batch(()=>p(this,Mt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(Kt)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(Kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=p(this,Mt).build(this,t);return r.isStaleByTime(mo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kt).catch(Kt)}fetchInfiniteQuery(e){return e.behavior=$c(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kt).catch(Kt)}ensureInfiniteQueryData(e){return e.behavior=$c(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return $i.isOnline()?p(this,Pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(this,Mt)}getMutationCache(){return p(this,Pn)}getDefaultOptions(){return p(this,On)}setDefaultOptions(e){B(this,On,e);}setQueryDefaults(e,t){p(this,Ji).set(Xn(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...p(this,Ji).values()],r={};return t.forEach(o=>{ti(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){p(this,Zi).set(Xn(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...p(this,Zi).values()],r={};return t.forEach(o=>{ti(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...p(this,On).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=zs(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===ei&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...p(this,On).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){p(this,Mt).clear(),p(this,Pn).clear();}},Mt=new WeakMap,Pn=new WeakMap,On=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,Fn=new WeakMap,Xi=new WeakMap,es=new WeakMap,Rp);var Qc=Dn.createContext(void 0),Kc=e=>{let t=Dn.useContext(Qc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gc=({client:e,children:t})=>(Dn.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsx(Qc.Provider,{value:e,children:t}));var Ip=Dn.createContext(false),vp=()=>Dn.useContext(Ip);Ip.Provider;function tg(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var rg=Dn.createContext(tg()),Pp=()=>Dn.useContext(rg);var Fp=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?el(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Dp=e=>{Dn.useEffect(()=>{e.clearReset();},[e]);},Vp=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||el(r,[e.error,o]));var Lp=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));}},Bp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ap=(e,t)=>e?.suspense&&t.isPending,Yc=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Wp(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=vp(),n=Pp(),a=Kc(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",Lp(i),Fp(i,n,s),Dp(n);let l=!a.getQueryCache().get(i.queryHash),[m]=Dn.useState(()=>new t(a,i)),u=m.getOptimisticResult(i),h=!o&&e.subscribed!==false;if(Dn.useSyncExternalStore(Dn.useCallback(C=>{let g=h?m.subscribe(St.batchCalls(C)):Kt;return m.updateResult(),g},[m,h]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),Dn.useEffect(()=>{m.setOptions(i);},[i,m]),Ap(i,u))throw Yc(i,m,n);if(Vp({result:u,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,u),i.experimental_prefetchInRender&&!vo.isServer()&&Bp(u,o)&&(l?Yc(i,m,n):s?.promise)?.catch(Kt).finally(()=>{m.updateResult();}),i.notifyOnChangeProps?u:m.trackResult(u)}function Jo(e,t){return Wp(e,Nc)}var os=new Map;function Ep({width:e,height:t,borderRadius:r,color:o}){let n=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let a=Animated.loop(Animated.sequence([Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return a.start(),()=>a.stop()},[n]),jsx(Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function Ln({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=D(),[m,u]=useState(false),[h,C]=useState(false),[g,b]=useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=os.get(e);return x?{uri:e,xml:x}:null}),w=e?.toLowerCase().endsWith(".svg"),c=w&&e&&g?.uri===e?g.xml:null;useEffect(()=>{u(false),C(false);},[e]),useEffect(()=>{if(!w||!e)return;if(os.has(e)){b({uri:e,xml:os.get(e)});return}let x=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{x||(os.set(e,_),b({uri:e,xml:_}));}).catch(()=>{x||u(true);}),()=>{x=true;}},[e,w]);let S=l.card;if(!e)return jsx(View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:S},s]});let y={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},f=t-n*2,d=r-n*2;return m?jsx(View,{style:[y,{backgroundColor:i||S}]}):w?jsxs(View,{style:y,children:[!!!c&&jsx(Ep,{width:f,height:d,borderRadius:o,color:S}),c?jsx(SvgXml,{xml:c,width:f,height:d,onError:()=>u(true)}):jsx(SvgUri,{uri:e,width:f,height:d,onError:()=>u(true)})]}):jsxs(View,{style:y,children:[!h&&jsx(Ep,{width:f,height:d,borderRadius:o,color:S}),jsx(Image,{source:{uri:e,cache:"force-cache"},style:{width:f,height:d},resizeMode:"contain",onLoad:()=>C(true),onError:()=>u(true)})]})}function Xc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(os.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{os.set(r,o);}).catch(()=>{}));}else t.push(Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function kr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:m,balanceChainId:u,balanceTokenAddress:h,publishableKey:C,projectName:g,leftIcon:b,onLeftAction:w}){let{colors:c,fonts:S,components:y}=D(),[f,d]=useState(null),[x,_]=useState(false),T=useState(()=>new Animated.Value(0))[0];useEffect(()=>{if(!x)return;let I=Animated.loop(Animated.sequence([Animated.timing(T,{toValue:1,duration:700,useNativeDriver:true}),Animated.timing(T,{toValue:0,duration:700,useNativeDriver:true})]));return I.start(),()=>I.stop()},[x,T]),useEffect(()=>{if(!s||!l||!m||!u||!h||!C){d(null),_(false);return}let I=false;return _(true),Ia(l,m,u,h,C).then(A=>{if(I)return;let V=A.balance,F=null;V&&(V.amount_usd!=null&&V.amount_usd!==""?F=`$${V.amount_usd}`:F="$0.00"),d(F);}).catch(()=>{I||d(null);}).finally(()=>{I||_(false);}),()=>{I=true;}},[s,l,m,u,h,C]);let k=T.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxs(View,{style:gr.header,children:[jsx(View,{style:gr.leftContainer,children:r&&n?jsx(TouchableOpacity,{onPress:n,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ss,{size:20,color:y.header.buttonColor,strokeWidth:2})}):b&&w?jsx(TouchableOpacity,{onPress:w,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:b}):jsx(View,{style:gr.spacer})}),jsxs(View,{style:gr.titleContainer,children:[jsxs(View,{style:gr.titleRow,children:[jsx(Text,{style:[gr.title,{color:y.header.titleColor,fontFamily:S.medium}],children:e}),i&&i.count>0&&jsx(View,{style:[gr.titleBadge,{backgroundColor:c.card}],children:jsx(Text,{style:[gr.titleBadgeText,{color:c.foregroundMuted,fontFamily:S.regular}],children:i.count})})]}),t?jsx(Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:S.regular}],children:t}):null,s&&(x?jsx(Animated.View,{style:[gr.balanceSkeleton,{backgroundColor:c.cardHover,opacity:k}]}):f!=null?jsxs(Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:S.regular}],children:[g?`${g} `:"","Balance: ",f]}):null)]}),jsx(View,{style:gr.rightContainer,children:o?jsx(TouchableOpacity,{onPress:a,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(tt,{size:20,color:y.header.buttonColor,strokeWidth:2})}):jsx(View,{style:gr.spacer})})]})}var gr=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 Gt({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=D(),s=a??i.card,l=s.backShadowColor!=="transparent",m={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},u=[Hp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],h=[m,r];return jsxs(View,{style:u,children:[l&&jsx(View,{style:[Hp.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsx(TouchableOpacity$1,{onPress:o,activeOpacity:n,style:h,children:e}):jsx(View,{style:h,children:e})]})}var Hp=StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ys({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card,s=o?[...o].sort((l,m)=>l.position-m.position):[];return jsxs(Gt,{cardTokens:i,onPress:e,style:Do.wrapper,contentStyle:Do.container,children:[jsxs(View,{style:Do.leftContent,children:[jsx(View,{style:[Do.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(Jl,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:Do.textContainer,children:[jsx(Text,{style:[Do.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[Do.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:Do.rightContent,children:jsx(View,{style:Do.networkIcons,children:s.map((l,m)=>{let u=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsx(View,{style:[Do.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:s.length-m}],children:jsx(Ln,{uri:J(u),width:20,height:20})},l.name)})})})]})}var Do=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 Zs({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsxs(Gt,{cardTokens:i,onPress:e,style:Zo.wrapper,contentStyle:Zo.container,children:[jsxs(View,{style:Zo.leftContent,children:[jsx(View,{style:[Zo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(Ri,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:Zo.textContainer,children:[jsx(Text,{style:[Zo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[Zo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:Zo.rightContent,children:jsx(View,{style:Zo.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(m=>m.format==="png")?.url||s.icon_urls.find(m=>m.format==="svg")?.url;return jsx(Ln,{uri:J(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var Zo=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 Xs({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsx(Gt,{cardTokens:i,onPress:e,style:Xo.wrapper,contentStyle:Xo.container,children:jsxs(View,{style:Xo.leftContent,children:[jsxs(View,{style:[Xo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsx(bo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsx(View,{style:[Xo.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsx(Text,{style:[Xo.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxs(View,{style:Xo.textContainer,children:[jsx(Text,{style:[Xo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[Xo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Xo=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 ta({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=D(),a=n.depositMenu.card;return jsxs(Gt,{cardTokens:a,onPress:e,style:Vo.wrapper,contentStyle:Vo.container,children:[jsxs(View,{style:Vo.leftContent,children:[jsx(View,{style:[Vo.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsx(ba,{size:20,color:a.iconColor,strokeWidth:2})}),jsxs(View,{style:Vo.textContainer,children:[jsx(Text,{style:[Vo.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsx(Text,{style:[Vo.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsx(View,{style:Vo.rightContent,children:jsx(View,{style:Vo.badge,children:jsx(Text,{style:[Vo.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Vo=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 qp=1e4,Qp=2500,Kp=3e3,Gp=6e4;function ra(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:m,setDepositExecutions:u,setTrackedExecutions:h,setLatestExecution:C,setShowStatusSheet:g,onDepositSuccess:b,onExecutionsChange:w,onDepositError:c}=e,[S,y]=useState(false),[f,d]=useState(false);return useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;y(false),t==="auto_ui"&&d(false);let _=setTimeout(()=>{y(true),t==="auto_ui"&&d(true);},qp);return ()=>clearTimeout(_)},[t,r,o]),useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-Gp),T=setInterval(async()=>{try{let A=[...(await jo(n,a)).data??[]].sort((F,P)=>{let H=F.created_at?new Date(F.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-H}),V=null;for(let F of A){let P=F.created_at?new Date(F.created_at):null;if(!P||P<=_)continue;let H=m.get(F.id);if(!H){V=F;break}if(["pending","waiting","delayed"].includes(H)&&F.status==="succeeded"){V=F;break}}if(V){let F=V;u(P=>{let H=P.findIndex(M=>M.id===F.id);if(H>=0){let M=[...P];return M[H]=F,M}return [...P,F]}),h(P=>{let H=new Map(P);return H.set(F.id,F.status),H}),C(F),g(!0),F.status==="succeeded"&&b?.({message:"Deposit completed successfully",executionId:F.id}),w?.([...l,F]);}}catch(k){c?.({message:"Failed to check deposit status",error:k});}},Qp);return ()=>clearInterval(T)},[n,a,i,m,l,w,b,c]),useEffect(()=>{if(!S||!s)return;let _=async()=>{try{await Ta(s,a);}catch{}};_();let T=setInterval(_,Kp);return ()=>clearInterval(T)},[S,s,a]),{pollingEnabled:S,showWaitingUi:f,handleIveDeposited:()=>{y(true),d(true);}}}function as({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=D(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",m=n||s;return jsxs(View,{style:[Jp.container,{width:t,height:t}],children:[jsx(hg,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsx(View,{style:[Jp.logoContainer,{width:o+12,height:o+12,backgroundColor:m,borderRadius:(o+12)/2}],children:jsx(Ln,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var Jp=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function em(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Cg(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function ls({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:m}){let{colors:u,fonts:h,components:C}=D(),[g,b]=useState(false),w=t==="pending"||t==="waiting"||t==="delayed",c=t==="succeeded",S=()=>{o&&Linking.openURL(o);},y=()=>{n&&Linking.openURL(n);};return jsx(ct,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:m,children:jsxs(View,{style:Ot.container,children:[jsx(TouchableOpacity,{style:Ot.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(tt,{size:20,color:C.header.buttonColor,strokeWidth:2})}),jsx(View,{style:Ot.iconContainer,children:w?jsx(ht,{size:80,strokeWidth:4,iconSize:68,children:r?jsx(Image,{source:{uri:J(r)},style:Ot.tokenIconFill}):jsx(View,{style:[Ot.tokenIconFill,{backgroundColor:u.cardHover}]})}):jsxs(Fragment,{children:[r?jsx(Image,{source:{uri:J(r)},style:Ot.tokenIconLarge}):jsx(View,{style:[Ot.tokenIconLarge,{backgroundColor:u.cardHover}]}),jsx(View,{style:[Ot.statusBadge,{backgroundColor:C.container.iconBackgroundColor}],children:jsx(Qe,{size:16,color:C.container.iconColor,strokeWidth:3})})]})}),jsx(Text,{style:[Ot.title,{color:C.container.titleColor,fontFamily:h.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxs(Text,{style:[Ot.amount,{color:C.container.titleColor,fontFamily:h.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsx(Text,{style:[Ot.date,{color:C.container.subtitleColor,fontFamily:h.regular}],children:Cg(a)}),jsx(Text,{style:[Ot.subtitle,{color:C.container.subtitleColor,fontFamily:h.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),c&&(o||n)&&jsxs(View,{style:Ot.detailsSection,children:[jsx(View,{style:[Ot.divider,{backgroundColor:u.border}]}),jsxs(TouchableOpacity,{style:Ot.detailsToggle,onPress:()=>b(!g),children:[jsx(Text,{style:[Ot.detailsToggleText,{color:C.container.actionTitle,fontFamily:h.medium}],children:g?"See less":"See more details"}),g?jsx(wo,{size:18,color:C.container.actionColor,strokeWidth:2}):jsx(Pt,{size:18,color:C.container.actionColor,strokeWidth:2})]}),g&&jsxs(View,{style:Ot.txButtonsContainer,children:[o&&jsxs(TouchableOpacity,{style:[Ot.txButton,{backgroundColor:C.card.backgroundColor,borderColor:u.border}],onPress:S,children:[jsx(Text,{style:[Ot.txLabel,{color:C.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsx(Text,{style:[Ot.txHash,{color:C.card.subtitleColor,fontFamily:h.regular}],children:em(o)}),jsx(Co,{size:16,color:C.card.actionColor,strokeWidth:2})]}),n&&jsxs(TouchableOpacity,{style:[Ot.txButton,{backgroundColor:C.card.backgroundColor,borderColor:u.border}],onPress:y,children:[jsx(Text,{style:[Ot.txLabel,{color:C.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsx(Text,{style:[Ot.txHash,{color:C.card.subtitleColor,fontFamily:h.regular}],children:em(n)}),jsx(Co,{size:16,color:C.card.actionColor,strokeWidth:2})]})]})]})]})})}var Ot=StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function ul({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=D();return jsxs(Fragment,{children:[e==="manual"&&t&&!r&&jsx(TouchableOpacity,{onPress:n,activeOpacity:.8,style:[pi.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsx(Text,{style:[pi.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxs(View,{style:[pi.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsx(View,{style:[pi.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsx(Zl,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxs(View,{style:pi.processingCardText,children:[jsx(Text,{style:[pi.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsx(Text,{style:[pi.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var pi=StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var oa=(e,t)=>`${t}:${e}`,vg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function ml({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:C,onDepositError:g,borderTopLeftRadius:b,borderTopRightRadius:w,sheetBorderRadius:c}){let{colors:S,fonts:y,components:f}=D(),d=s&&l?`${s}:${l}`:"solana:mainnet",[x,_]=useState("USDC"),[T,k]=useState(d),[I,A]=useState([]),[V,F]=useState(true),[P,H]=useState([]),[M,se]=useState(true),[He,Fe]=useState(false),[G,Se]=useState(false),[he,Ie]=useState(false),[Ge,ke]=useState(false),[te,Te]=useState([]),[st,Ae]=useState(new Map),[Ye]=useState(()=>new Date),[We,Ee]=useState(null),[Me,me]=useState(false),[X,be]=useState(null),[pt,z]=useState(false),W=new Map;P.forEach($=>{$.chains.forEach(re=>{let _e=`${re.chain_type}:${re.chain_id}`;W.has(_e)||W.set(_e,re);});});let ae=Array.from(W.values()),oe=vg(T),xt=ae.find($=>$.chain_type===oe.chainType&&$.chain_id===oe.chainId)?.chain_type||"ethereum",de=No(I,xt),le=de?.address||"",ze=useRef(false);useEffect(()=>{async function $(){try{se(!0),Ee(null);let _e=await jn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(H(_e.data),_e.data.length>0&&!ze.current){ze.current=!0;let pe,ne;if(s&&l)if(m)for(let O of _e.data){let ft=O.chains.find(De=>De.chain_type===s&&De.chain_id===l&&De.token_address.toLowerCase()===m.toLowerCase());if(ft){pe=O,ne=ft;break}}else for(let O of _e.data){let ft=O.chains.find(De=>De.chain_type===s&&De.chain_id===l);if(ft){pe=O,ne=ft;break}}if(!pe&&a)for(let O of _e.data){let ft=O.chains.find(De=>De.token_address.toLowerCase()===a.toLowerCase());if(ft){pe=O,ne=ft;break}}pe||(pe=_e.data.find(O=>O.symbol==="USDC"),pe&&pe.chains.length>0&&(ne=pe.chains[0])),pe||(pe=_e.data.find(O=>O.symbol==="USDT"),pe&&pe.chains.length>0&&(ne=pe.chains[0])),pe||(pe=_e.data[0],pe.chains.length>0&&(ne=pe.chains[0])),pe&&_(pe.symbol),ne&&k(oa(ne.chain_id,ne.chain_type));}}catch(re){console.error("Error fetching supported tokens:",re),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:re});}finally{se(false);}}$();},[t,g,s,l,m,a,n,o]),useEffect(()=>{async function $(){try{F(!0),Ee(null);let re=await Ho({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);A(re.data);}catch(re){console.error("Error fetching wallets:",re),Ee("Failed to load wallets"),g?.({message:"Failed to load wallets",error:re});}finally{F(false);}}$();},[e,r,o,n,a,t,g]);let Yt=de?.id??"",{showWaitingUi:mt,handleIveDeposited:ue}=ra({depositConfirmationMode:u,depositAddress:le,chain:T,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:te,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:Ae,setLatestExecution:be,setShowStatusSheet:me,onDepositSuccess:C,onExecutionsChange:h,onDepositError:g});useEffect(()=>{if(!P.length)return;let $=P.find(_e=>_e.symbol===x);if(!$||$.chains.length===0)return;if(!$.chains.some(_e=>oa(_e.chain_id,_e.chain_type)===T)){let _e=$.chains[0];k(oa(_e.chain_id,_e.chain_type));}},[x,P,T]);let et=P.find($=>$.symbol===x),xr=et?.chains||[],_t=xr.find($=>oa($.chain_id,$.chain_type)===T),io=async()=>{if(le)try{Clipboard.setString(le),Fe(!0),setTimeout(()=>Fe(!1),2e3);}catch($){console.error("Failed to copy:",$);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;if(M)return jsxs(View,{style:L.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:S.primary}),jsx(Text,{style:[L.loadingText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Loading currencies..."})]});if(We&&P.length===0)return jsxs(View,{style:L.errorContainer,children:[jsx(Text,{style:[L.errorText,{color:S.error,fontFamily:y.regular}],children:We}),jsx(Text,{style:[L.errorHint,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Please check your network connection and try again."})]});let xe=()=>jsxs(ct,{visible:he,onClose:()=>Ie(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.tokenSelector?.borderTopLeftRadius??b,borderTopRightRadius:c?.tokenSelector?.borderTopRightRadius??w,children:[jsxs(View,{style:[L.sheetHeader,{borderBottomColor:S.border}],children:[jsx(View,{style:L.sheetHeaderSpacer}),jsx(Text,{style:[L.sheetTitle,{color:f.header.titleColor,fontFamily:y.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>Ie(false),style:L.sheetCloseButton,children:jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsx(gt,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:P.map($=>jsxs(TouchableOpacity$1,{onPress:()=>{_($.symbol),Ie(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:x===$.symbol?f.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:J(ge($,"png"))},style:L.sheetItemIcon}),jsxs(View,{style:L.sheetItemText,children:[jsx(Text,{style:[L.sheetItemTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:$.symbol}),jsxs(Text,{style:[L.sheetItemSubtitle,{color:f.card.subtitleColor,fontFamily:y.regular}],children:[$.chains.length," network",$.chains.length!==1?"s":""," available"]})]}),x===$.symbol&&jsx(Qe,{size:20,color:S.primary,strokeWidth:2})]},$.symbol))})]}),at=()=>jsxs(ct,{visible:Ge,onClose:()=>ke(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.chainSelector?.borderTopLeftRadius??b,borderTopRightRadius:c?.chainSelector?.borderTopRightRadius??w,children:[jsxs(View,{style:[L.sheetHeader,{borderBottomColor:S.border}],children:[jsx(View,{style:L.sheetHeaderSpacer}),jsx(Text,{style:[L.sheetTitle,{color:f.header.titleColor,fontFamily:y.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>ke(false),style:L.sheetCloseButton,children:jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsx(gt,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:xr.map($=>{let re=oa($.chain_id,$.chain_type),_e=T===re;return jsxs(TouchableOpacity$1,{onPress:()=>{k(re),ke(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:_e?f.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:J(ge($,"png"))},style:L.sheetItemIcon}),jsxs(View,{style:L.sheetItemText,children:[jsx(Text,{style:[L.sheetItemTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:$.chain_name}),jsxs(Text,{style:[L.sheetItemSubtitle,{color:f.card.subtitleColor,fontFamily:y.regular}],children:["Min deposit: $",$.minimum_deposit_amount_usd]})]}),_e&&jsx(Qe,{size:20,color:S.primary,strokeWidth:2})]},re)})})]});return jsxs(View,{style:L.container,children:[jsxs(View,{style:L.selectorSection,children:[jsx(Text,{style:[L.selectorLabel,{color:f.card.labelColor,fontFamily:y.regular}],children:"Token"}),jsxs(TouchableOpacity$1,{onPress:()=>Ie(true),style:[L.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[et&&jsx(Image,{source:{uri:J(ge(et,"png"))},style:L.selectorIcon}),jsx(Text,{style:[L.selectorText,{color:f.card.titleColor,fontFamily:y.medium}],children:x}),jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:L.selectorSection,children:[jsxs(Text,{style:[L.selectorLabel,{color:f.card.labelColor,fontFamily:y.regular}],children:["Network"," ",jsxs(Text,{style:[L.minDeposit,{fontFamily:y.regular}],children:["($",$t," min)"]})]}),jsxs(TouchableOpacity$1,{onPress:()=>ke(true),style:[L.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[_t&&jsx(Image,{source:{uri:J(ge(_t,"png"))},style:L.selectorIcon}),jsx(Text,{style:[L.selectorText,{color:f.card.titleColor,fontFamily:y.medium}],numberOfLines:1,children:_t?.chain_name||"Select network"}),jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsx(View,{style:L.qrContainer,children:jsx(View,{style:[L.qrWrapper,{backgroundColor:S.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:V?jsxs(View,{style:L.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),jsx(Text,{style:[L.loadingText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Loading..."})]}):le?jsx(as,{value:le,size:160,logoUri:J(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:L.qrLoading,children:jsx(Text,{style:[L.errorText,{color:S.error,fontFamily:y.regular}],children:"No address available"})})})}),jsxs(View,{style:L.addressSection,children:[jsxs(View,{style:L.addressHeader,children:[jsx(Text,{style:[L.addressLabel,{color:f.card.labelColor,fontFamily:y.medium}],children:"Deposit Address"}),He&&jsxs(View,{style:L.copiedIndicator,children:[jsx(Qe,{size:14,color:S.success,strokeWidth:2}),jsx(Text,{style:[L.copiedText,{color:S.success,fontFamily:y.regular}],children:"Copied"})]})]}),jsxs(Gt,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!V&&le?io:void 0,contentStyle:L.addressBox,children:[jsx(Text,{style:[L.addressText,{color:f.card.titleColor,fontFamily:y.regular}],numberOfLines:2,children:V?"Loading...":le||"No address available"}),jsx(View,{style:L.addressCopyIcon,children:jsx(Nn,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[L.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>Se(!G),style:L.detailsHeader,children:[jsxs(View,{style:L.detailsRow,children:[jsx(View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(bo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:L.chevronContainer,children:G?jsx(wo,{size:16,color:f.card.actionColor,strokeWidth:2}):jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),G&&jsxs(View,{style:L.detailsContent,children:[jsxs(View,{style:L.detailsRow,children:[jsx(View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:["Price impact: ",Or.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:L.detailsRow,children:[jsx(View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(hn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:["Slippage: Auto \u2022 ",ir.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:L.detailsRow,children:[jsx(View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(ga,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(ul,{depositConfirmationMode:u,depositAddress:le,showWaitingUi:mt,latestExecution:X,onIveDeposited:ue}),jsx(TouchableOpacity$1,{style:L.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[L.termsText,{color:S.primary,fontFamily:y.regular}],children:"Terms apply"})}),xe(),at(),jsxs(ct,{visible:pt,onClose:()=>z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:c?.infoSheet?.borderTopLeftRadius??b,borderTopRightRadius:c?.infoSheet?.borderTopRightRadius??w,children:[jsxs(View,{style:[L.sheetHeader,{borderBottomColor:S.border}],children:[jsx(View,{style:L.sheetHeaderSpacer}),jsx(Text,{style:[L.sheetTitle,{color:f.header.titleColor,fontFamily:y.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>z(false),style:L.sheetCloseButton,children:jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:L.infoSheetContent,children:[jsxs(View,{style:[L.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(View,{style:L.infoCardHeader,children:[jsx(View,{style:[L.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(fn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[L.infoCardTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:"Price Impact"}),jsxs(Text,{style:[L.infoCardValue,{color:f.card.titleColor,fontFamily:y.medium}],children:[Or.toFixed(2),"%"]})]}),jsx(Text,{style:[L.infoCardDescription,{color:f.card.descriptionColor,fontFamily:y.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."})]}),jsxs(View,{style:[L.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(View,{style:L.infoCardHeader,children:[jsx(View,{style:[L.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(hn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[L.infoCardTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:"Max Slippage"}),jsxs(Text,{style:[L.infoCardValue,{color:f.card.titleColor,fontFamily:y.medium}],children:[ir.toFixed(2),"%"]})]}),jsx(Text,{style:[L.infoCardDescription,{color:f.card.descriptionColor,fontFamily:y.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."})]})]})]}),X&&jsx(ls,{visible:Me,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find($=>$.format==="png")?.url||X.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>me(false),borderTopLeftRadius:c?.depositStatus?.borderTopLeftRadius??b,borderTopRightRadius:c?.depositStatus?.borderTopRightRadius??w})]})}var L=StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function fl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=D();return jsxs(TouchableOpacity$1,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[mi.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxs(View,{style:mi.leftContent,children:[jsx(View,{style:[mi.iconContainer,{backgroundColor:o.background}],children:jsx(Image,{source:{uri:J(ge(e,"png"))},style:mi.icon})}),jsxs(View,{style:mi.textContainer,children:[jsx(Text,{style:[mi.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsx(Text,{style:[mi.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(Qe,{size:16,color:o.primary,strokeWidth:2})]})}var mi=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 ia({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=D();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:nm.headerContainer,children:jsx(Text,{style:[nm.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsx(fl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var nm=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function gl({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:u}=D(),[h,C]=useState(""),g=o.map(d=>r.find(x=>x.currency_code.toLowerCase()===d.toLowerCase())).filter(d=>d!==void 0),b=r.filter(d=>!o.includes(d.currency_code.toLowerCase())),w=d=>{if(!h)return d;let x=h.toLowerCase();return d.filter(_=>_.name.toLowerCase().includes(x)||_.currency_code.toLowerCase().includes(x))},c=w(g),S=w(b),y=d=>{a(d),t(false),C("");},f=()=>{t(false),C("");};return jsxs(ct,{visible:e,onClose:f,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsx(kr,{title:"Currency",showBack:false,onClose:f}),jsx(View,{style:fi.searchContainer,children:jsx(TextInput,{style:[fi.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:m.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],value:h,onChangeText:C,placeholder:"Search",placeholderTextColor:u.search.placeholderColor})}),jsx(gt,{style:fi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxs(View,{style:fi.listContent,children:[jsx(ia,{title:"Popular currencies",currencies:c,selectedCurrency:n,onSelect:y}),c.length>0&&S.length>0&&jsx(View,{style:fi.sectionSpacer}),jsx(ia,{title:"All currencies",currencies:S,selectedCurrency:n,onSelect:y}),c.length===0&&S.length===0&&jsx(View,{style:fi.noResultsContainer,children:jsx(Text,{style:[fi.noResultsText,{color:u.container.subtitleColor,fontFamily:m.regular}],children:"No currencies found"})})]})})]})}var fi=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 wd(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 Cl({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:m,onDepositError:u,borderTopLeftRadius:h,borderTopRightRadius:C,sheetBorderRadius:g}){let{colors:b,fonts:w,components:c}=D(),[S,y]=useState(""),[f,d]=useState("usd"),[x,_]=useState(false),[T,k]=useState(false),[I,A]=useState([]),[V,F]=useState(false),[P,H]=useState(null),[M,se]=useState(null),[He,Fe]=useState("amount"),[G,Se]=useState(null),[he,Ie]=useState(true),[Ge,ke]=useState(null),[te,Te]=useState(false),st=useRef(null),Ae=useRef(false);useEffect(()=>{st.current=G;},[G]),useEffect(()=>{Ae.current=te;},[te]);let[Ye,We]=useState([]),[Ee,Me]=useState(true),[me,X]=useState(60),[be,pt]=useState([]),[z,W]=useState([]),[ae,oe]=useState(null),[ve,xt]=useState(null),[de,le]=useState(true),[ze,Yt]=useState(null),[mt,ue]=useState(false),[et,xr]=useState(null),[_t,io]=useState(false),[Or,ir]=useState(false),[$t,xe]=useState(false),[at,$]=useState(null),re=r??He,_e=useRef(null),pe=be.find(q=>q.currency_code.toLowerCase()===f.toLowerCase()),ne=useCallback(q=>{Fe(q),q==="quotes"?o?.(q,I.length):o?.(q);},[I.length,o]);useEffect(()=>{async function q(){try{let ie=await Ps();xt(ie);}catch(ie){console.error("Error fetching user IP:",ie);}finally{le(false);}}q();},[]),useEffect(()=>{async function q(){try{let ie=await Ho({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);We(ie.data);}catch(ie){console.error("Error fetching wallets:",ie),H("Failed to load wallet addresses");}finally{Me(false);}}q();},[e,a,i,s,l,t]);let O=n||ae?.symbol.toUpperCase()||"USDC",ft=Di(ae?.icon_urls,"png")||ae?.icon_url,De=Di(ae?.chain_icon_urls,"png")||ae?.chain_icon_url;useEffect(()=>{async function q(){try{let ie=await ic(t);pt(ie.data),W(ie.preferred||[]);}catch(ie){console.error("Error fetching fiat currencies:",ie);}}q();},[t]),useEffect(()=>{if(x||be.length===0||!ve?.alpha2)return;let q=ve.alpha2.toUpperCase(),ie=be.find(wt=>wt.country_codes.includes(q));if(ie)d(ie.currency_code.toLowerCase()),!S&&!T&&y(String(ie.default_amount??100));else if(!S&&!T){let wt=be.find(Fr=>Fr.currency_code.toLowerCase()==="usd");wt&&y(String(wt.default_amount??100));}},[be,ve,x,S,T]),useEffect(()=>{if(be.length!==0){if(_e.current!==null&&_e.current!==f){let q=be.find(ie=>ie.currency_code.toLowerCase()===f.toLowerCase());q&&y(String(q.default_amount??100));}_e.current=f;}},[f,be]),useEffect(()=>{async function q(){try{let ie=await tc({chain_type:i||"",chain_id:s||"",token_address:l||""},t);oe(ie);}catch(ie){console.error("Error fetching supported tokens:",ie);}}q();},[i,s,l,t]),useEffect(()=>{async function q(){if(!(!l||!s||!i)&&!de){ue(true);try{let ie=await nc({country_code:ve?.alpha2?.toUpperCase()||"US",subdivision_code:ve?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);Yt(ie);}catch(ie){console.error("Error fetching default onramp token:",ie);}finally{ue(false);}}}q();},[l,s,i,ve,de,t]),useEffect(()=>{let q=parseFloat(S);if(isNaN(q)||q<=0){A([]),se(null);return}if(!ze||mt){A([]),Se(null);return}let ie=be.find(Fr=>Fr.currency_code.toLowerCase()===f.toLowerCase());if(ie){if(q<ie.minimum_amount){A([]),Se(null),se(`Minimum amount is ${wd(f)}${ie.minimum_amount.toLocaleString()}`);return}if(q>ie.maximum_amount){A([]),Se(null),se(`Maximum amount is ${wd(f)}${ie.maximum_amount.toLocaleString()}`);return}}se(null);let wt=setTimeout(()=>{pn(q);},500);return ()=>clearTimeout(wt)},[S,f,t,ze,mt,be]);let pn=async q=>{if(!ze){H("Loading token information...");return}F(true),H(null);try{let ie={country_code:ve?.alpha2?.toUpperCase()||"US",source_amount:q.toString(),source_currency:f.toLowerCase(),destination_currency:ze.destination_currency,destination_network:ze.destination_network,subdivision_code:ve?.state||void 0},wt=await rc(ie,t);A(wt.data);let Fr=Ae.current,bs=st.current;if(Fr&&bs){let ao=wt.data.find(lo=>lo.service_provider===bs.service_provider);if(ao){if(Se(ao),wt.data.length>0){let lo=wt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Ge||ke(lo.service_provider),Ie(ao.service_provider===Ge);}}else if(wt.data.length>0){let lo=wt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Se(lo),ke(lo.service_provider),Ie(!0),Te(!1);}}else if(wt.data.length>0){let ao=wt.data.reduce((lo,Dr)=>Dr.destination_amount>lo.destination_amount?Dr:lo);Se(ao),ke(ao.service_provider),Ie(!0);}X(60);}catch(ie){console.error("Failed to fetch quotes:",ie),H("Failed to fetch quotes. Please try again."),A([]);}finally{F(false);}};useEffect(()=>{if(I.length===0)return;let q=setInterval(()=>{X(ie=>{if(ie<=1){let wt=parseFloat(S);return !isNaN(wt)&&wt>0&&pn(wt),60}return ie-1});},1e3);return ()=>clearInterval(q)},[I.length,S]);let ki=q=>{(/^\d*\.?\d{0,2}$/.test(q)||q==="")&&(y(q),k(true));},Ti=q=>{y(q.toString()),k(true);},yo=async()=>{if(G&&ze)try{let q=ze.destination_token_metadata.chain_type,ie=No(Ye,q);if(!ie?.address){H("Wallet address not available");return}let wt={service_provider:G.service_provider,country_code:G.country_code?.toUpperCase()||ve?.alpha2?.toUpperCase()||"US",source_currency:G.source_currency,source_amount:S,destination_currency:G.destination_currency,destination_network:G.destination_network,wallet_address:ie.address,subdivision_code:ve?.state||void 0},Fr=await oc(wt,t);xr({provider:G,sourceCurrency:f,sourceAmount:S,sessionUrl:Fr.url}),$(Fr.url),xe(!0);}catch(q){console.error("Failed to create session:",q),H("Failed to start payment flow"),u?.({message:"Failed to start payment flow",error:q});}},xi=wd(f),so=()=>{xe(false),ne("onramp"),m?.({message:"Payment flow completed"});},Mo=()=>jsx(Hg,{visible:$t,onClose:so,url:at,providerName:G?.service_provider_display_name||"Complete Payment",colors:b,fonts:w,borderTopLeftRadius:g?.webView?.borderTopLeftRadius??h,borderTopRightRadius:g?.webView?.borderTopRightRadius??C});return re==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:j.amountViewContainer,children:[jsxs(gt,{style:j.scrollContainer,contentContainerStyle:j.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:j.currencySelector,children:jsxs(TouchableOpacity$1,{onPress:()=>io(true),style:[j.currencyButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],children:[pe&&jsx(Image,{source:{uri:J(ge(pe,"png"))},style:j.currencyIcon}),jsx(Text,{style:[j.currencyText,{color:c.card.titleColor,fontFamily:w.medium}],children:f.toUpperCase()}),jsx(Pt,{size:16,color:c.card.actionColor,strokeWidth:2})]})}),jsx(gl,{open:_t,onOpenChange:io,currencies:be,preferredCurrencyCodes:z,selectedCurrency:f,onSelectCurrency:q=>{d(q.toLowerCase()),_(true);},borderTopLeftRadius:g?.currencyModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.currencyModal?.borderTopRightRadius??C}),jsx(View,{style:j.amountContainer,children:jsxs(View,{style:j.amountInputRow,children:[jsx(Text,{style:[j.currencySymbol,{color:c.container.titleColor,fontFamily:w.medium}],children:xi}),jsx(TextInput,{style:[j.amountInput,{color:c.container.titleColor,fontFamily:w.medium}],value:S,onChangeText:ki,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:b.foregroundMuted})]})}),pe?.suggested_amounts&&pe.suggested_amounts.length>0&&jsx(View,{style:j.quickAmounts,children:pe.suggested_amounts.map(q=>jsx(TouchableOpacity$1,{onPress:()=>Ti(q),style:[j.quickAmountButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.button.borderRadius,borderWidth:parseFloat(S)===q?2:c.button.borderWidth,borderColor:parseFloat(S)===q?b.primary:c.button.borderColor}],children:jsxs(Text,{style:[j.quickAmountText,{color:c.card.titleColor,fontFamily:w.medium}],children:[xi,q.toLocaleString()]})},q))}),M&&jsx(Text,{style:[j.validationError,{color:b.error,fontFamily:w.regular}],children:M}),jsxs(View,{style:j.providerSection,children:[jsxs(View,{style:j.providerHeader,children:[jsx(Text,{style:[j.providerLabel,{color:c.card.labelColor,fontFamily:w.medium}],children:"Provider"}),I.length>0&&!V&&jsxs(Text,{style:[j.refreshText,{color:c.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",me,"s"]})]}),jsx(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:V||I.length===0?void 0:()=>ir(true),contentStyle:StyleSheet.flatten([j.providerButton,(V||I.length===0)&&j.disabled]),children:V?jsxs(View,{style:j.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:c.container.subtitleColor}),jsx(Text,{style:[j.loadingText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):G?jsxs(View,{style:j.providerContent,children:[jsxs(View,{style:j.providerInfo,children:[he&&jsx(Text,{style:[j.autoPickedText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxs(View,{style:j.providerRow,children:[jsx(Image,{source:{uri:J(xa(G.icon_urls,"png",G.icon_url))},style:j.providerIconImage},`provider-${G.service_provider}`),jsxs(View,{children:[jsx(Text,{style:[j.providerName,{color:c.card.titleColor,fontFamily:w.medium}],children:G.service_provider_display_name}),jsxs(Text,{style:[j.bestPriceText,{color:b.success,fontFamily:w.regular}],children:["Best price \u2022 ",G.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(Vr,{size:20,color:c.card.actionColor,strokeWidth:2})]}):jsx(Text,{style:[j.noProviderText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),P&&jsx(Text,{style:[j.errorText,{color:b.error,fontFamily:w.regular}],children:P})]}),jsxs(ct,{visible:Or,onClose:()=>ir(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:g?.providerModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.providerModal?.borderTopRightRadius??C,children:[jsx(kr,{title:"Select Provider",showBack:false,onClose:()=>ir(false)}),jsx(gt,{style:j.providerModalList,contentContainerStyle:j.providerModalListContent,showsVerticalScrollIndicator:false,children:jsx(View,{style:j.quotesList,children:[...I].sort((q,ie)=>ie.destination_amount-q.destination_amount).map((q,ie)=>{let wt=G?.service_provider===q.service_provider,Fr=ie===0;return jsxs(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:()=>{Se(q),Te(true),Ie(q.service_provider===Ge),ir(false);},contentStyle:StyleSheet.flatten([j.quoteItem,wt&&{borderWidth:2,borderColor:b.primary}]),children:[jsxs(View,{style:j.quoteLeft,children:[jsx(Image,{source:{uri:J(xa(q.icon_urls,"png",q.icon_url))},style:j.providerIconImage}),jsxs(View,{children:[jsx(Text,{style:[j.quoteName,{color:c.card.titleColor,fontFamily:w.medium}],children:q.service_provider_display_name}),Fr&&jsx(Text,{style:[j.bestPriceLabel,{color:b.success,fontFamily:w.regular}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:j.quoteRight,children:[jsxs(Text,{style:[j.quoteAmount,{color:c.card.textRightColor,fontFamily:w.medium}],children:[q.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[j.quoteSource,{color:c.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",xi,q.total_fee.toFixed(2)]})]})]},q.service_provider)})})})]})]}),jsx(View,{style:[j.continueButtonContainer,{backgroundColor:b.background}],children:jsx(View,{style:{opacity:V||Ee||!G||parseFloat(S)<=0?.5:1},children:jsx(TouchableOpacity$1,{onPress:yo,disabled:V||Ee||!G||parseFloat(S)<=0,style:[j.continueButton,{backgroundColor:c.container.buttonColor,borderRadius:c.button.borderRadius,borderWidth:c.button.borderWidth,borderColor:c.button.borderColor}],children:jsx(Text,{style:[j.continueButtonText,{color:c.container.buttonTitleColor,fontFamily:w.medium}],children:Ee?"Loading...":"Continue"})})})})]}),Mo()]}):re==="onramp"&&et?jsxs(View,{style:j.onrampContainer,children:[jsx(Image,{source:{uri:J(xa(et.provider.icon_urls,"png",et.provider.icon_url))},style:j.onrampProviderIcon}),jsxs(Text,{style:[j.onrampTitle,{color:c.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",et.provider.service_provider_display_name]}),jsx(Text,{style:[j.onrampSubtitle,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxs(View,{style:[j.flowDiagram,{backgroundColor:c.card.backgroundColor}],children:[jsxs(View,{style:j.flowStep,children:[jsx(Image,{source:{uri:Ht(`/icons/currencies/png/${et.sourceCurrency.toLowerCase()}.png`)},style:j.flowIconImage}),jsx(Text,{style:[j.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsx(Text,{style:[j.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:et.sourceCurrency.toUpperCase()})]}),jsx(Vr,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxs(View,{style:j.flowStep,children:[jsxs(View,{style:j.flowIconWithBadge,children:[jsx(Image,{source:{uri:Di(ze?.destination_token_metadata?.icon_urls,"png")||ze?.destination_token_metadata?.icon_url||Ht("/icons/tokens/png/usdc.png")},style:j.flowIconImageNoBadge}),jsx(Image,{source:{uri:Di(ze?.destination_token_metadata?.chain?.icon_urls,"png")||ze?.destination_token_metadata?.chain?.icon_url||Ht("/icons/networks/png/polygon.png")},style:[j.flowNetworkBadge,{borderColor:b.background,borderRadius:c.badge.borderRadius}]})]}),jsx(Text,{style:[j.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsx(Text,{style:[j.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsx(Vr,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxs(View,{style:j.flowStep,children:[jsxs(View,{style:j.flowIconWithBadge,children:[jsx(Image,{source:{uri:ft||Ht("/icons/tokens/png/usdc.png")},style:j.flowIconImageNoBadge}),jsx(Image,{source:{uri:De||Ht("/icons/networks/png/polygon.png")},style:[j.flowNetworkBadge,{borderColor:b.background,borderRadius:c.badge.borderRadius}]})]}),jsx(Text,{style:[j.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsx(Text,{style:[j.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:O})]})]}),jsx(View,{style:[j.onrampInfoBox,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:jsx(Text,{style:[j.onrampInfoText,{color:c.card.descriptionColor,fontFamily:w.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 Hg({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxs(View,{style:hi.header,children:[jsx(TouchableOpacity$1,{onPress:t,style:hi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Qe,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[hi.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsx(View,{style:hi.headerSpacer})]}),r&&jsx(View,{style:hi.container,children:jsx(WebView,{source:{uri:r},style:hi.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:hi.loading,children:jsx(ActivityIndicator,{size:"large",color:n.primary})})})})]})}var hi=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"}}),j=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"},bestPriceLabel:{fontSize:11,marginTop:2},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 qg(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 Qg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function kl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=J(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),m=i?"Deposit Processing":"Deposit Completed",u=qg(e.created_at||new Date().toISOString()),h=Qg(e.source_amount_usd);return jsxs(Gt,{cardTokens:a,onPress:t,contentStyle:on.container,children:[jsxs(View,{style:on.iconContainer,children:[jsx(Image,{source:{uri:l},style:on.tokenIcon}),jsx(View,{style:[on.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsx(ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(Qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:on.textContainer,children:[jsx(Text,{style:[on.title,{color:a.titleColor,fontFamily:o.medium}],children:m}),jsx(Text,{style:[on.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:u})]}),jsxs(View,{style:on.rightContainer,children:[jsx(Text,{style:[on.amount,{color:a.textRightColor,fontFamily:o.medium}],children:h}),jsx(Vr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var on=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 lm(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 cm(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 Gg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var dm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function um(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Yg(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 Jg({count:e=4}){let{colors:t,components:r}=D(),o=useRef(new Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsx(View,{style:gi.list,children:Array.from({length:e}).map((i,s)=>jsxs(View,{style:[gi.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsx(Animated.View,{style:[gi.icon,{backgroundColor:a,opacity:o}]}),jsxs(View,{style:gi.textBlock,children:[jsx(Animated.View,{style:[gi.titleBar,{backgroundColor:a,opacity:o}]}),jsx(Animated.View,{style:[gi.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsx(Animated.View,{style:[gi.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var gi=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 Td({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=D(),[l,m]=useState(r),[u,h]=useState(false),[C,g]=useState(null),[b,w]=useState(false),c=useRef(null);useEffect(()=>{if(!e||!o)return;let T=async()=>{h(true);try{let A=[...(await jo(o,n)).data].sort((V,F)=>{let P=V.created_at?new Date(V.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-P});m(A);}catch(I){console.error("Failed to fetch executions:",I),m(r);}finally{h(false);}};T();let k=setInterval(T,1e4);return ()=>clearInterval(k)},[e,o,n,r]),useEffect(()=>{r.length>0&&m(T=>{let k=new Set(T.map(A=>A.id)),I=r.filter(A=>!k.has(A.id));return I.length>0?[...I,...T]:T});},[r]),useEffect(()=>{e||g(null);},[e]);let S=T=>{g(T);},y=()=>{g(null),w(false);},f=()=>{g(null),t();},d=()=>{if(!C)return null;let T=C,k=T.status==="pending"||T.status==="waiting"||T.status==="delayed",I=T.status==="succeeded",A=J(ge(T.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),V=T.provider_metadata?.details,F=V?.currencyIn,P=V?.currencyOut;F?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let se=cm(T.source_amount_base_unit,T.source_token_metadata?.decimals),He=cm(T.destination_amount_base_unit,T.destination_token_metadata?.decimals),Fe=Gg(T.source_amount_usd),G=lm(T.source_chain_type,T.source_chain_id),Se=lm(T.destination_chain_type,T.destination_chain_id),he=()=>{T.explorer_url&&Linking.openURL(T.explorer_url);},Ie=()=>{T.destination_explorer_url&&Linking.openURL(T.destination_explorer_url);};return jsxs(gt,{ref:c,style:ce.scrollContainer,contentContainerStyle:ce.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:ce.iconSection,children:[jsxs(View,{style:ce.iconWrapper,children:[jsx(Image,{source:{uri:A},style:ce.tokenIcon}),jsx(View,{style:[ce.statusBadge,{backgroundColor:k?a.warning:a.success,borderColor:a.background}],children:k?jsx(Pt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(Qe,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:ce.statusRow,children:[jsx(View,{style:[ce.statusDot,{backgroundColor:k?a.warning:a.success}]}),jsx(Text,{style:[ce.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:k?"Processing":"Completed"})]}),jsx(Text,{style:[ce.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:Yg(T.created_at||new Date().toISOString())})]}),jsxs(View,{style:[ce.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxs(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[se," ",um(T.source_currency)]})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxs(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[He," ",um(T.destination_currency)]})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Fe})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:G})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Se})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let Ge=!b;w(Ge),Ge?setTimeout(()=>{c.current?.scrollToEnd({animated:true});},100):c.current?.scrollTo({y:0,animated:true});},style:ce.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[ce.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:b?"See less":"See more details"}),b?jsx(wo,{size:14,color:s.container.actionColor,strokeWidth:2}):jsx(Pt,{size:14,color:s.container.actionColor,strokeWidth:2})]}),b&&jsxs(View,{style:[ce.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[T.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:he,style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxs(View,{style:ce.cardRowRight,children:[jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:dm(T.transaction_hash)}),jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]})]}),T.destination_explorer_url&&I&&jsxs(TouchableOpacity,{onPress:Ie,style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxs(View,{style:ce.cardRowRight,children:[jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:dm(T.destination_transaction_hashes[0])}),jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},x=u&&l.length===0;return jsxs(Fragment,{children:[jsx(kr,{title:C?"Deposit Details":"Deposit Tracker",onClose:f,showClose:!C,showBack:!!C,onBack:y}),C?d():x?jsx(Jg,{}):jsx(gt,{style:ce.scrollContainer,contentContainerStyle:ce.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxs(View,{style:ce.emptyContainer,children:[jsx(Text,{style:[ce.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsx(Text,{style:[ce.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsx(View,{style:ce.executionsList,children:l.map(T=>jsx(kl,{execution:T,onPress:()=>S(T)},T.id))})})]})}var ce=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 sa(e,t=true){let[r,o]=useState(null),[n,a]=useState(null),[i,s]=useState(false),[l,m]=useState(false),[u,h]=useState(null),[C,g]=useState(null);useEffect(()=>{!t||r||(s(true),Ps().then(S=>{o(S),h(null);}).catch(S=>{h(S instanceof Error?S:new Error(String(S)));}).finally(()=>{s(false);}));},[t,r]),useEffect(()=>{!t||!e||n||(m(true),vs(e).then(S=>{a(S),g(null);}).catch(S=>{g(S instanceof Error?S:new Error(String(S)));}).finally(()=>{m(false);}));},[t,e,n]);let b=i||l,w=u||C||null,c=null;if(r&&n){let S=n.blocked_country_codes||[],y=r.alpha2.toUpperCase();c=!S.some(f=>f.toUpperCase()===y);}return {isAllowed:c,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:b,error:w}}var Rd="unifold_recent_tokens",ry=5,ym=[{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 Il(){try{let e=await Rc.getItem(Rd);return e?JSON.parse(e):[]}catch{return []}}async function oy(e){try{let r=(await Il()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,ry);await Rc.setItem(Rd,JSON.stringify(o));}catch{}}async function ny(e){try{let r=(await Il()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Rc.setItem(Rd,JSON.stringify(r)),r}catch{return []}}function Id({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:u}=D(),[h,C]=useState(""),[g,b]=useState([]);useEffect(()=>{e&&Il().then(b);},[e]),useEffect(()=>{e||C("");},[e]);let w=useMemo(()=>{let x=[];return r.forEach(_=>{_.chains.forEach(T=>{x.push({token:_,chain:T});});}),x},[r]),c=useMemo(()=>{let x=[],_=new Set,T=(k,I,A,V)=>{let F=`${k}-${I}:${A}`;if(_.has(F))return;let P=r.find(M=>M.symbol===k);if(!P)return;let H=P.chains.find(M=>M.chain_type===I&&M.chain_id===A);H&&(_.add(F),x.push({token:P,chain:H,isRecent:V}));};return g.forEach(k=>{T(k.symbol,k.chainType,k.chainId,true);}),ym.forEach(k=>{T(k.symbol,k.chainType,k.chainId,false);}),x},[r,g]),S=useMemo(()=>{if(!h.trim())return w;let x=h.toLowerCase();return w.filter(({token:_,chain:T})=>_.symbol.toLowerCase().includes(x)||_.name.toLowerCase().includes(x)||T.chain_name.toLowerCase().includes(x))},[w,h]),y=(x,_,T)=>ym.some(k=>k.symbol===x&&k.chainType===_&&k.chainId===T),f=async(x,_)=>{let T=`${_.chain_type}:${_.chain_id}`;if(!y(x.symbol,_.chain_type,_.chain_id)){await oy({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});let k=await Il();b(k);}C(""),a(x.symbol,T),t();},d=async(x,_)=>{let T=await ny({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});b(T);};return jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxs(View,{style:it.header,children:[jsx(View,{style:it.headerSpacer}),jsx(Text,{style:[it.headerTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:t,style:it.closeButton,children:jsx(tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:it.searchContainer,children:jsx(TextInput,{style:[it.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:m.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],placeholder:"Search",placeholderTextColor:u.search.placeholderColor,value:h,onChangeText:C,autoCapitalize:"none",autoCorrect:false})}),c.length>0&&!h&&jsxs(View,{style:it.quickSelectSection,children:[jsx(Text,{style:[it.sectionLabel,{color:u.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.quickSelectScroll,children:c.map(({token:x,chain:_,isRecent:T})=>{let k=`${_.chain_type}:${_.chain_id}`;x.symbol===o&&k===n;return jsxs(View,{children:[T&&jsx(TouchableOpacity$1,{onPress:()=>d(x,_),style:it.removeButton,children:jsx(tt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxs(TouchableOpacity$1,{onPress:()=>f(x,_),activeOpacity:.7,style:[it.quickSelectItem,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(View,{style:it.tokenIconContainer,children:[jsx(Image,{source:{uri:J(ge(x,"png"))},style:it.quickSelectIcon}),jsx(Image,{source:{uri:J(ge(_,"png"))},style:[it.quickSelectChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxs(View,{style:it.quickSelectText,children:[jsx(Text,{style:[it.quickSelectSymbol,{color:u.card.titleColor,fontFamily:m.medium}],children:x.symbol}),jsx(Text,{style:[it.quickSelectChain,{color:u.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]})]})]},`quick-${x.symbol}-${k}`)})})]}),jsx(Text,{style:[it.sectionLabel,{color:u.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsx(gt,{style:it.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.tokenListContent,children:S.length===0?jsx(View,{style:it.emptyState,children:jsx(Text,{style:[it.emptyText,{color:l.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):S.map(({token:x,chain:_})=>{let T=`${_.chain_type}:${_.chain_id}`,k=x.symbol===o&&T===n;return jsxs(TouchableOpacity$1,{onPress:()=>f(x,_),activeOpacity:.7,style:[it.tokenItem,{backgroundColor:k?u.card.backgroundColor:"transparent"}],children:[jsxs(View,{style:it.tokenIconContainerLarge,children:[jsx(Image,{source:{uri:J(ge(x,"png"))},style:it.tokenIcon}),jsx(Image,{source:{uri:J(ge(_,"png"))},style:[it.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxs(View,{style:it.tokenInfo,children:[jsx(Text,{style:[it.tokenSymbol,{color:u.card.titleColor,fontFamily:m.medium}],children:x.symbol}),jsx(Text,{style:[it.tokenChainName,{color:u.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]}),jsxs(Text,{style:[it.minDeposit,{color:u.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxs(Text,{style:{color:u.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${x.symbol}-${T}`)})})]})}var it=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Pl=(e,t)=>`${t}:${e}`,cy=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function vd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:C,onDepositError:g,wallets:b,borderTopLeftRadius:w,borderTopRightRadius:c,sheetBorderRadius:S}){let{colors:y,fonts:f,components:d}=D(),x=s&&l?`${s}:${l}`:"solana:mainnet",[_,T]=useState("USDC"),[k,I]=useState(x),[A,V]=useState([]),[F,P]=useState(!b?.length),H=b?.length?b:A,[M,se]=useState([]),[He,Fe]=useState(true),[G,Se]=useState(false),[he,Ie]=useState(false),[Ge,ke]=useState(false),[te,Te]=useState([]),[st,Ae]=useState(new Map),[Ye]=useState(()=>new Date),[We,Ee]=useState(null),[Me,me]=useState(false),[X,be]=useState(null),[pt,z]=useState(false),W=new Map;M.forEach(xe=>{xe.chains.forEach(at=>{let $=`${at.chain_type}:${at.chain_id}`;W.has($)||W.set($,at);});});let ae=Array.from(W.values()),oe=cy(k),ve=ae.find(xe=>xe.chain_type===oe.chainType&&xe.chain_id===oe.chainId),xt=ve?.chain_type||"ethereum",de=No(H,xt),le=de?.address||"",ze=useRef(false);useEffect(()=>{async function xe(){try{Fe(!0),Ee(null);let $=await jn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(se($.data),$.data.length>0&&!ze.current){ze.current=!0;let re,_e;if(s&&l)if(m)for(let pe of $.data){let ne=pe.chains.find(O=>O.chain_type===s&&O.chain_id===l&&O.token_address.toLowerCase()===m.toLowerCase());if(ne){re=pe,_e=ne;break}}else for(let pe of $.data){let ne=pe.chains.find(O=>O.chain_type===s&&O.chain_id===l);if(ne){re=pe,_e=ne;break}}if(!re&&a)for(let pe of $.data){let ne=pe.chains.find(O=>O.token_address.toLowerCase()===a.toLowerCase());if(ne){re=pe,_e=ne;break}}re||(re=$.data.find(pe=>pe.symbol==="USDC"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=$.data.find(pe=>pe.symbol==="USDT"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=$.data[0],re.chains.length>0&&(_e=re.chains[0])),re&&T(re.symbol),_e&&I(Pl(_e.chain_id,_e.chain_type));}}catch(at){console.error("Error fetching supported tokens:",at),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:at});}finally{Fe(false);}}xe();},[t,a,n,o,s,l,m,g]),useEffect(()=>{h&&h(te);},[te,h]),useEffect(()=>{if(b?.length){P(false);return}if(A.length>0){P(false);return}let xe=null,at=false,$=async()=>{if(!at){P(true);try{let re=await Ho({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);at||(V(re.data),Ee(null),P(!1));}catch(re){console.error("Error fetching wallets, retrying in 5s:",re),at||(Ee(re instanceof Error?re.message:"Failed to load wallets"),P(false),xe=setTimeout($,5e3));}}};return $(),()=>{at=true,xe&&clearTimeout(xe);}},[e,r,o,n,a,t,b,A.length]);let Yt=de?.id??"",{showWaitingUi:mt,handleIveDeposited:ue}=ra({depositConfirmationMode:u,depositAddress:le,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:te,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:Ae,setLatestExecution:be,setShowStatusSheet:me,onDepositSuccess:C,onExecutionsChange:h,onDepositError:g});useEffect(()=>{if(!M.length)return;let xe=M.find($=>$.symbol===_);if(!xe||xe.chains.length===0)return;if(!xe.chains.some($=>Pl($.chain_id,$.chain_type)===k)){let $=xe.chains[0];I(Pl($.chain_id,$.chain_type));}},[_,M,k]);let et=M.find(xe=>xe.symbol===_),_t=(et?.chains||[]).find(xe=>Pl(xe.chain_id,xe.chain_type)===k),io=async()=>{if(le)try{Clipboard.setString(le),Se(!0),setTimeout(()=>Se(!1),2e3);}catch(xe){console.error("Failed to copy:",xe);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;return He?jsxs(View,{style:U.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:y.primary}),jsx(Text,{style:[U.loadingText,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Loading currencies..."})]}):We&&M.length===0?jsxs(View,{style:U.errorContainer,children:[jsx(Text,{style:[U.errorText,{color:y.error,fontFamily:f.regular}],children:We}),jsx(Text,{style:[U.errorHint,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:U.container,children:[jsxs(View,{style:U.selectorSection,children:[jsx(Text,{style:[U.selectorLabel,{color:d.card.labelColor,fontFamily:f.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:()=>ke(true),disabled:He||M.length===0,style:[U.tokenSelectorButton,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],activeOpacity:.7,children:He?jsxs(View,{style:U.tokenSelectorLoading,children:[jsx(View,{style:[U.loadingIcon,{backgroundColor:y.cardHover}]}),jsxs(View,{style:U.loadingTextContainer,children:[jsx(View,{style:[U.loadingLine,{backgroundColor:y.cardHover,width:60}]}),jsx(View,{style:[U.loadingLine,{backgroundColor:y.cardHover,width:100,marginTop:4}]})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:U.tokenIconWrapper,children:[et&&jsx(Image,{source:{uri:J(ge(et,"png"))},style:U.tokenMainIcon}),(_t||ve)&&jsx(Image,{source:{uri:J(ge(_t||ve,"png"))},style:[U.tokenChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxs(View,{style:U.tokenSelectorInfo,children:[jsx(Text,{style:[U.tokenSelectorSymbol,{color:d.card.titleColor,fontFamily:f.semibold}],children:et?.symbol||_}),jsx(Text,{style:[U.tokenSelectorNetwork,{color:d.card.subtitleColor,fontFamily:f.regular}],numberOfLines:1,children:_t?.chain_name||ve?.chain_name||"Select network"})]}),jsxs(View,{style:U.tokenSelectorRight,children:[jsxs(Text,{style:[U.minDepositText,{color:d.card.labelHighlightRightColor,fontFamily:f.medium}],children:["$",$t," min"]}),jsx(Vr,{size:16,color:d.card.actionColor,strokeWidth:2})]})]})})]}),jsx(Id,{visible:Ge,onClose:()=>ke(false),tokens:M,selectedToken:_,selectedChainKey:k,onSelect:(xe,at)=>{T(xe),I(at);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??c}),jsx(View,{style:U.qrContainer,children:jsx(View,{style:[U.qrWrapper,{backgroundColor:y.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:F?jsxs(View,{style:U.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:y.primary}),jsx(Text,{style:[U.loadingText,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Loading..."})]}):le?jsx(as,{value:le,size:180,logoUri:J(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:45}):jsx(View,{style:U.qrLoading,children:jsx(Text,{style:[U.errorText,{color:y.error,fontFamily:f.regular}],children:"No address available"})})})}),jsxs(View,{style:U.addressSection,children:[jsxs(View,{style:U.addressHeader,children:[jsx(Text,{style:[U.addressLabel,{color:d.card.labelColor,fontFamily:f.medium}],children:"Deposit Address"}),G&&jsxs(View,{style:U.copiedIndicator,children:[jsx(Qe,{size:14,color:y.success,strokeWidth:2}),jsx(Text,{style:[U.copiedText,{color:y.success,fontFamily:f.regular}],children:"Copied"})]})]}),jsxs(Gt,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!F&&le?io:void 0,contentStyle:U.addressBox,children:[jsx(Text,{style:[U.addressText,{color:d.card.titleColor,fontFamily:f.regular}],numberOfLines:2,children:F?"Loading...":le||"No address available"}),jsx(View,{style:U.addressCopyIcon,children:jsx(Nn,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[U.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>Ie(!he),style:U.detailsHeader,children:[jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(bo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:U.chevronContainer,children:he?jsx(wo,{size:16,color:d.card.actionColor,strokeWidth:2}):jsx(Pt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),he&&jsxs(View,{style:U.detailsContent,children:[jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:["Price impact: ",Or.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(hn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:["Slippage: Auto \u2022 ",ir.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(ga,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(ul,{depositConfirmationMode:u,depositAddress:le,showWaitingUi:mt,latestExecution:X,onIveDeposited:ue}),jsx(TouchableOpacity$1,{style:U.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[U.termsText,{color:y.primary,fontFamily:f.regular}],children:"Terms apply"})}),jsxs(ct,{visible:pt,onClose:()=>z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??c,children:[jsxs(View,{style:[U.sheetHeader,{borderBottomColor:y.border}],children:[jsx(View,{style:U.sheetHeaderSpacer}),jsx(Text,{style:[U.sheetTitle,{color:d.header.titleColor,fontFamily:f.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>z(false),style:U.sheetCloseButton,children:jsx(tt,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:U.infoSheetContent,children:[jsxs(View,{style:[U.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxs(View,{style:U.infoCardHeader,children:[jsx(View,{style:[U.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(fn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[U.infoCardTitle,{color:d.card.titleColor,fontFamily:f.medium}],children:"Price Impact"}),jsxs(Text,{style:[U.infoCardValue,{color:d.card.titleColor,fontFamily:f.medium}],children:[Or.toFixed(2),"%"]})]}),jsx(Text,{style:[U.infoCardDescription,{color:d.card.descriptionColor,fontFamily:f.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."})]}),jsxs(View,{style:[U.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxs(View,{style:U.infoCardHeader,children:[jsx(View,{style:[U.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(hn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[U.infoCardTitle,{color:d.card.titleColor,fontFamily:f.medium}],children:"Max Slippage"}),jsxs(Text,{style:[U.infoCardValue,{color:d.card.titleColor,fontFamily:f.medium}],children:[ir.toFixed(2),"%"]})]}),jsx(Text,{style:[U.infoCardDescription,{color:d.card.descriptionColor,fontFamily:f.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."})]})]})]}),X&&jsx(ls,{visible:Me,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(xe=>xe.format==="png")?.url||X.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>me(false),borderTopLeftRadius:S?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:S?.depositStatus?.borderTopRightRadius??c})]})}var U=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 an={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function fy(){let{colors:e,components:t}=D(),r=useRef(new Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let a=({rightIcons:i=2})=>jsxs(View,{style:[Un.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsx(Animated.View,{style:[Un.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxs(View,{style:Un.textBlock,children:[jsx(Animated.View,{style:[Un.titleBar,{backgroundColor:n,opacity:r}]}),jsx(Animated.View,{style:[Un.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsx(View,{style:Un.rightIcons,children:Array.from({length:i}).map((s,l)=>jsx(Animated.View,{style:[Un.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxs(View,{style:Un.container,children:[jsx(a,{rightIcons:3}),jsx(a,{rightIcons:2}),jsx(a,{rightIcons:0})]})}var Un=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 hy({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,defaultChainType:u,defaultChainId:h,defaultTokenAddress:C,showBalance:g=false,hideDepositTracker:b=false,enableStripeLinkPay:w=false,StripeOnrampComponent:c,stripeOnrampEmail:S,stripeOnrampPhone:y,stripeMerchantIdentifier:f,stripePaymentSelectorPosition:d,stripeSkipSuccessConfirmation:x,stripeTheme:_,depositConfirmationMode:T="auto_ui",transferInputVariant:k="double_input",initialScreen:I="main",onDepositSuccess:A,onDepositError:V,sheetBorderRadius:F}){let P=F?.globalBorderTopLeftRadius,H=F?.globalBorderTopRightRadius,{colors:M,fonts:se}=D(),[He,Fe]=useState([]),[G,Se]=useState(null),[he,Ie]=useState("amount"),Ge=I==="tracker"&&!b?"tracker":I==="transfer"?"transfer":I==="card"?"card":"main",ke=Ge==="main",[te,Te]=useState(Ge),{isAllowed:st,isLoading:Ae}=sa(o,e);useEffect(()=>{if(!e||G)return;let de=false;return vs(o).then(async le=>{if(de)return;let ze=[];for(let Yt of le?.transfer_crypto?.networks??[]){let mt=Yt.icon_urls.find(ue=>ue.format==="png")?.url||Yt.icon_urls.find(ue=>ue.format==="svg")?.url;mt&&ze.push(J(mt));}for(let Yt of le?.payment_networks?.networks??[]){let mt=Yt.icon_urls.find(ue=>ue.format==="png")?.url||Yt.icon_urls.find(ue=>ue.format==="svg")?.url;mt&&ze.push(J(mt));}ze.length>0&&await Xc(ze),de||Se(le);}).catch(console.error),()=>{de=true;}},[e,G,o]);let Ye=()=>{t();};useEffect(()=>{e&&(Te(Ge),Ie("amount"));},[e,Ge]);let We=useCallback(()=>{ke?(Te("main"),Ie("amount")):Ye();},[ke,Ye]),Ee=He.filter(de=>de.status==="pending"||de.status==="waiting").length,me=!!(i&&s&&l&&m&&o)&&g!==false&&!!G,X=Ae||e&&!G,be=st===false,pt=null;if(te==="stripe"&&c){let de=jsx(c,{publishableKey:o,email:S,phone:y,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,merchantIdentifier:f,paymentSelectorPosition:d,skipSuccessConfirmation:x,onClose:We});pt=_?jsx(Pi,{..._,children:de}):de;}let z=te==="stripe"?.9:te==="transfer"||te==="card"?.94:te==="tracker"?.6:te==="main"?.5:void 0,W=te==="tracker"||te==="main"?.9:void 0,oe={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,tracker:F?.depositsTracker}[te],ve=oe?.borderTopLeftRadius??P,xt=oe?.borderTopRightRadius??H;return jsxs(ct,{visible:e,onClose:te==="main"?Ye:We,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:z,maxHeightPercent:W,borderTopLeftRadius:ve,borderTopRightRadius:xt,children:[te==="main"&&jsxs(Fragment,{children:[jsx(kr,{title:n,showBack:false,onClose:Ye,showBalance:me,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:G?.project_name}),X&&jsx(fy,{}),!X&&be&&jsxs(View,{style:br.centeredContainer,children:[jsx(View,{style:[br.iconContainer,{backgroundColor:M.cardHover}],children:jsx(Ts,{size:32,color:M.foreground,strokeWidth:1.5})}),jsx(Text,{style:[br.blockedTitle,{color:M.foreground,fontFamily:se.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[br.blockedDescription,{color:M.foreground,opacity:.7,fontFamily:se.regular}],children:"There are no supported tokens available from your current location."})]}),!X&&!be&&jsxs(View,{style:br.optionsContainer,children:[jsx(Ys,{onPress:()=>Te("transfer"),title:an.transferCrypto.title,subtitle:an.transferCrypto.subtitle,featuredTokens:G?.transfer_crypto?.networks}),jsx(Zs,{onPress:()=>Te("card"),title:an.depositWithCard.title,subtitle:an.depositWithCard.subtitle,paymentNetworks:G?.payment_networks?.networks}),w&&c&&jsx(ta,{onPress:()=>Te("stripe"),title:an.stripeLinkPay.title,subtitle:an.stripeLinkPay.subtitle}),!b&&jsx(Xs,{onPress:()=>Te("tracker"),title:an.depositTracker.title,subtitle:an.depositTracker.subtitle,badge:Ee>0?Ee:void 0})]})]}),te==="transfer"&&jsxs(Fragment,{children:[jsx(kr,{title:an.transferCrypto.title,showBack:false,onClose:We,showBalance:me,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:G?.project_name}),Ae&&jsx(View,{style:[br.centeredContainer,br.centeredFlex],children:jsx(ActivityIndicator,{color:M.foreground})}),!Ae&&be&&jsxs(View,{style:[br.centeredContainer,br.centeredFlex],children:[jsx(View,{style:[br.iconContainer,{backgroundColor:M.cardHover}],children:jsx(Ts,{size:32,color:M.foreground,strokeWidth:1.5})}),jsx(Text,{style:[br.blockedTitle,{color:M.foreground,fontFamily:se.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[br.blockedDescription,{color:M.foreground,opacity:.7,fontFamily:se.regular}],children:"There are no supported tokens available from your current location."})]}),!Ae&&!be&&jsx(gt,{style:br.transferScrollContainer,contentContainerStyle:br.scrollContent,showsVerticalScrollIndicator:false,children:k==="single_input"?jsx(vd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:u,defaultChainId:h,defaultTokenAddress:C,depositConfirmationMode:T,onExecutionsChange:Fe,onDepositSuccess:A,onDepositError:V,borderTopLeftRadius:P,borderTopRightRadius:H,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsx(ml,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:u,defaultChainId:h,defaultTokenAddress:C,depositConfirmationMode:T,onExecutionsChange:Fe,onDepositSuccess:A,onDepositError:V,borderTopLeftRadius:P,borderTopRightRadius:H,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),te==="card"&&jsxs(Fragment,{children:[jsx(kr,{title:`Deposit ${a||"USDC"}`,showBack:he==="onramp",onBack:()=>Ie("amount"),onClose:We,showBalance:me,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:G?.project_name}),jsx(View,{style:br.buyWithCardContainer,children:jsx(Cl,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,onDepositSuccess:A,onDepositError:V,view:he,onViewChange:de=>Ie(de),borderTopLeftRadius:P,borderTopRightRadius:H,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),te==="stripe"&&pt&&jsx(View,{style:br.stripeLinkPayContainer,children:pt}),te==="tracker"&&jsx(Td,{active:te==="tracker",onClose:We,executions:He,externalUserId:r,publishableKey:o})]})}function Dl({theme:e="auto",...t}){return jsx(hy,{...t})}var br=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Vl(e,t=true){return Jo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ra(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Fd(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return Jo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await jn(a),m=null,u=null,h=null,C=null,g,b,w,c=l.data.some(S=>S.chains.some(y=>{let f=y.chain_type===t&&y.chain_id===r&&y.token_address.toLowerCase()===o.toLowerCase();return f&&(m=y.minimum_deposit_amount_usd,u=y.estimated_processing_time,h=y.max_slippage_percent,C=y.estimated_price_impact_percent,w=y.chain_name,b=S),f}));if(b){let S=ge(b,"png");S&&(g=J(S));}return {isSupported:c,minimumAmountUsd:m,estimatedProcessingTime:u,maxSlippagePercent:h,priceImpactPercent:C,errorMessage:c?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:g,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Dd(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return Jo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await Ia(t,r,o,n,a);if(l.balance){let m=l.balance.token?.decimals??6,u=l.balance.token?.symbol??"",h=l.balance.amount,C=BigInt(h),g=BigInt(10**m),b=C/g,c=(C%g).toString().padStart(m,"0").replace(/0+$/,""),S=c?`${b}.${c}`:b.toString();return {balanceBaseUnit:h,balanceHuman:S,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:m,symbol:u}}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 yy=2500,by=3e3,Cy=6e4;function Vd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=useState([]),[l,m]=useState(false),u=useRef(new Date),h=useRef(new Map),C=useRef(false),g=useRef(n),b=useRef(a);return useEffect(()=>{g.current=n;},[n]),useEffect(()=>{b.current=a;},[a]),useEffect(()=>{o&&!C.current&&(u.current=new Date,h.current.clear()),o||h.current.clear(),C.current=o;},[o]),useEffect(()=>{if(!e||!o)return;let w=u.current,c=async()=>{try{let y=await jo(e,t,"withdraw"),f=new Date(w.getTime()-Cy),d=[...y.data].sort((k,I)=>{let A=k.created_at?new Date(k.created_at).getTime():0;return (I.created_at?new Date(I.created_at).getTime():0)-A}),x=["pending","waiting","delayed"],_=["succeeded","failed"],T=null;for(let k of d){let I=k.created_at?new Date(k.created_at):null;if(!I||I<f)continue;let A=h.current.get(k.id);if(!A){T=k;break}if(x.includes(A)&&_.includes(k.status)){T=k;break}}if(T){let k=T,I=k.created_at?new Date(k.created_at):null;if(!I||I<u.current)return;let A=h.current.get(k.id);h.current.set(k.id,k.status),s(V=>{let F=V.findIndex(P=>P.id===k.id);if(F>=0){let P=[...V];return P[F]=k,P}return [...V,k]}),k.status==="succeeded"&&(!A||x.includes(A))?g.current?.({message:"Withdrawal completed successfully",transaction:k}):k.status==="failed"&&A!=="failed"&&b.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:k});}}catch(y){console.error("Failed to fetch withdraw executions:",y),b.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:y});}};c();let S=setInterval(c,yy);return m(true),()=>{clearInterval(S),m(false);}},[e,t,o]),useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await lc({deposit_wallet_id:r},t);}catch{}};w();let c=setInterval(w,by);return ()=>clearInterval(c)},[o,r,t]),{executions:i,isPolling:l}}var Ld=(e,t)=>`${t}:${e}`;function ca({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:m,chainPickerBorderTopLeftRadius:u,chainPickerBorderTopRightRadius:h}){let{colors:C,fonts:g,components:b}=D(),[w,c]=useState(false),[S,y]=useState(false),f=b.card,d=t?e.find(k=>k.symbol===t):void 0,x=d?.chains||[],_=r?x.find(k=>Ld(k.chain_id,k.chain_type)===r):void 0,T={backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth||1,borderColor:f.borderColor};return jsxs(View,{style:Ke.row,children:[jsxs(View,{style:Ke.col,children:[jsx(Text,{style:[Ke.label,{color:f.labelColor,fontFamily:g.medium}],children:i}),jsxs(TouchableOpacity,{style:[Ke.selectButton,T],onPress:()=>!a&&e.length>0&&c(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsx(Text,{style:[Ke.placeholder,{color:f.subtitleColor,fontFamily:g.regular}],children:"Loading..."}):d?jsxs(View,{style:Ke.selectedItem,children:[jsx(Image,{source:{uri:J(ge(d,"png"))},style:Ke.icon}),jsx(Text,{style:[Ke.selectedText,{color:f.titleColor,fontFamily:g.medium}],numberOfLines:1,children:d.symbol})]}):jsx(Text,{style:[Ke.placeholder,{color:f.subtitleColor,fontFamily:g.regular}],children:"Select receive token"}),jsx(Pt,{size:16,color:f.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:Ke.col,children:[jsx(Text,{style:[Ke.label,{color:f.labelColor,fontFamily:g.medium}],children:s}),jsxs(TouchableOpacity,{style:[Ke.selectButton,T,(!d||x.length===0)&&Ke.disabled],onPress:()=>!a&&d&&x.length>0&&y(true),activeOpacity:.7,disabled:a||!d||x.length===0,children:[_?jsxs(View,{style:Ke.selectedItem,children:[jsx(Image,{source:{uri:J(ge(_,"png"))},style:Ke.icon}),jsx(Text,{style:[Ke.selectedText,{color:f.titleColor,fontFamily:g.medium}],numberOfLines:1,children:_.chain_name})]}):jsx(Text,{style:[Ke.placeholder,{color:f.subtitleColor,fontFamily:g.regular}],children:"Chain"}),jsx(Pt,{size:16,color:f.actionColor,strokeWidth:2})]})]}),jsxs(ct,{visible:w,onClose:()=>c(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:m,children:[jsxs(View,{style:Ke.pickerHeader,children:[jsx(View,{style:Ke.pickerHeaderSpacer}),jsx(Text,{style:[Ke.pickerTitle,{color:C.foreground,fontFamily:g.medium}],children:"Select Token"}),jsx(TouchableOpacity,{style:Ke.pickerHeaderClose,onPress:()=>c(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(tt,{size:20,color:C.foregroundMuted,strokeWidth:2})})]}),jsx(Fi,{data:e,keyExtractor:k=>k.symbol,contentContainerStyle:Ke.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>jsxs(TouchableOpacity,{style:[Ke.pickerItem,{backgroundColor:k.symbol===t?C.cardHover:"transparent"}],onPress:()=>{o(k.symbol),c(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:J(ge(k,"png"))},style:Ke.pickerIcon}),jsx(Text,{style:[Ke.pickerItemText,{color:C.foreground,fontFamily:g.medium}],children:k.symbol}),jsx(Text,{style:[Ke.pickerItemSub,{color:C.foregroundMuted,fontFamily:g.regular}],children:k.name}),k.symbol===t&&jsx(Qe,{size:18,color:C.primary,strokeWidth:2.5})]})})]}),jsxs(ct,{visible:S,onClose:()=>y(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:u,borderTopRightRadius:h,children:[jsxs(View,{style:Ke.pickerHeader,children:[jsx(View,{style:Ke.pickerHeaderSpacer}),jsx(Text,{style:[Ke.pickerTitle,{color:C.foreground,fontFamily:g.medium}],children:"Select Chain"}),jsx(TouchableOpacity,{style:Ke.pickerHeaderClose,onPress:()=>y(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(tt,{size:20,color:C.foregroundMuted,strokeWidth:2})})]}),jsx(Fi,{data:x,keyExtractor:k=>Ld(k.chain_id,k.chain_type),contentContainerStyle:Ke.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>{let I=Ld(k.chain_id,k.chain_type);return jsxs(TouchableOpacity,{style:[Ke.pickerItem,{backgroundColor:I===r?C.cardHover:"transparent"}],onPress:()=>{n(I),y(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:J(ge(k,"png"))},style:Ke.pickerIcon}),jsx(Text,{style:[Ke.pickerItemText,{color:C.foreground,fontFamily:g.medium}],children:k.chain_name}),I===r&&jsx(Qe,{size:18,color:C.primary,strokeWidth:2.5})]})}})]})]})}var Ke=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 Bd(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return Jo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>ac({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Ty(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function xy(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("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function _y(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Bl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:m,balanceData:u,isLoadingBalance:h,minimumWithdrawAmountUsd:C,estimatedProcessingTime:g,maxSlippagePercent:b,priceImpactPercent:w,canWithdraw:c,onDepositWalletCreation:S,onWithdraw:y,onWithdrawError:f,onWithdrawSubmitted:d,onViewTracker:x}){let _="https://unifold.io/terms",T="https://unifold.io/support",{colors:k,fonts:I,components:A}=D(),[V,F]=useState(s||""),[P,H]=useState(""),[M,se]=useState(false),[He,Fe]=useState(null),[G,Se]=useState(false),[he,Ie]=useState(""),Ge=useRef(null);useEffect(()=>{F(s||""),H(""),Fe(null);},[s]);let ke=V.trim();useEffect(()=>{let ue=setTimeout(()=>Ie(ke),500);return ()=>clearTimeout(ue)},[ke]);let{data:te,isLoading:Te,error:st}=Bd({chainType:m?.chain_type,chainId:m?.chain_id,tokenAddress:m?.token_address,recipientAddress:he,publishableKey:e,enabled:he.length>5&&!!m}),Ae=ke!==he,Ye=useMemo(()=>!ke||ke.length<=5||Ae||Te?null:st?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${m?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${m?.chain_name}`:"Invalid address":null,[ke,Ae,Te,st,te,m,l]),We=!Ae&&!!te?.valid&&!Ye,Ee=useMemo(()=>u?.exchangeRate?parseFloat(u.exchangeRate):0,[u]),Me=useMemo(()=>u?.balanceHuman?parseFloat(u.balanceHuman):0,[u]),me=n||u?.symbol||"TOKEN",X=u?.decimals??6,be=useMemo(()=>{let ue=parseFloat(P);return !ue||ue<=0?0:ue},[P]),pt=useMemo(()=>{let ue=parseFloat(P);return !ue||ue<=0?0:ue*Ee},[P,Ee]),z=useCallback(async()=>{try{let et=await $m("expo-clipboard").getStringAsync();et&&(F(et.trim()),Fe(null));}catch{}},[]),W=useCallback(()=>{Me<=0||H(u?.balanceHuman??"0");},[Me,u]),ae=C!==null&&pt>0&&pt<C,oe=be>0&&Me>0&&be>Me,ve=ke.length>0&&P.trim().length>0&&be>0&&We&&!ae&&!oe&&!!u,xt=useCallback(async()=>{if(!(!l||!m||!ve||!c)){se(true),Fe(null);try{let ue=await S({destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,recipientAddress:ke}),et=xy(be,X),xr=_y(be,X),_t={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:me,sourceTokenIconUrl:i,destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,destinationTokenSymbol:l.symbol,destinationChainName:m.chain_name,destinationTokenIconUrl:l?J(ge(l,"png")):void 0,amount:xr,amountBaseUnit:et,submittedAt:new Date,withdrawIntentAddress:ue.address,recipientAddress:ke};await y(_t),d(_t);}catch(ue){let et=ue instanceof Error?ue.message:"Withdrawal failed. Please try again.",xr=et.length>120?"Withdrawal failed. Please try again.":et;Fe(xr),f?.({message:et,error:ue,code:"WITHDRAW_FAILED"});}finally{se(false);}}},[l,m,ve,c,ke,t,r,o,me,i,P,Me,u,be,X,pt,S,y,f,d]),de=A.input,le=A.card,ze=A.button,Yt=Ye?k.error:de.borderColor,mt=useMemo(()=>M?"Processing...":oe?"Insufficient balance":ae?`Minimum $${C?.toFixed(2)}`:He?"Withdrawal failed \u2014 try again":"Withdraw",[M,oe,ae,C,He]);return jsxs(View,{style:qe.container,children:[jsxs(View,{children:[jsxs(View,{style:qe.labelRow,children:[jsx(Text,{style:[qe.label,{color:le.labelColor,fontFamily:I.medium}],children:"Recipient address"}),(Ae||Te)&&ke.length>5?jsx(ActivityIndicator,{size:"small",color:k.foregroundMuted}):jsx(TouchableOpacity,{onPress:z,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsx(Kd,{size:16,color:k.foregroundMuted,strokeWidth:1.75})})]}),jsx(View,{style:[qe.inputRow,{backgroundColor:de.backgroundColor,borderRadius:de.borderRadius,borderWidth:de.borderWidth,borderColor:Yt}],children:jsx(TextInput,{style:[qe.textInput,{color:de.textColor,fontFamily:I.regular}],placeholder:"Enter wallet address",placeholderTextColor:de.placeholderColor,value:V,onChangeText:ue=>{F(ue),Fe(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ge.current?.focus()})}),Ye?jsx(Text,{style:[qe.errorText,{color:k.error,fontFamily:I.regular}],children:Ye}):null]}),jsxs(View,{children:[jsxs(Text,{style:[qe.label,{color:le.labelColor,fontFamily:I.medium,paddingBottom:8}],children:["Amount",C!=null&&C>0&&jsx(Text,{style:{color:k.warning,fontFamily:I.regular},children:` ($${C.toFixed(2)} min)`})]}),jsxs(View,{style:[qe.amountRow,{backgroundColor:de.backgroundColor,borderRadius:de.borderRadius,borderWidth:de.borderWidth,borderColor:de.borderColor}],children:[jsx(TextInput,{ref:Ge,style:[qe.amountInput,{color:de.textColor,fontFamily:I.regular}],placeholder:"0.00",placeholderTextColor:de.placeholderColor,value:P,onChangeText:ue=>{(ue===""||/^\d*\.?\d*$/.test(ue))&&(H(ue),Fe(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsx(Text,{style:[qe.unitLabel,{color:k.foregroundMuted,fontFamily:I.medium}],children:me}),jsx(TouchableOpacity,{style:[qe.maxButton,{backgroundColor:`${k.primary}20`}],onPress:W,activeOpacity:.7,children:jsx(Text,{style:[qe.maxText,{color:k.primary,fontFamily:I.medium}],children:"Max"})})]})]}),jsxs(View,{style:[qe.detailsCard,{marginTop:24,backgroundColor:le.backgroundColor,borderRadius:le.borderRadius,borderWidth:le.borderWidth||1,borderColor:le.borderColor}],children:[jsx(TouchableOpacity,{style:qe.detailsToggle,onPress:()=>Se(!G),activeOpacity:.7,children:jsxs(View,{style:qe.detailsRow,children:[jsx(View,{style:[qe.detailIcon,{backgroundColor:le.iconBackgroundColor,borderRadius:le.iconContainerBorderRadius}],children:jsx(bo,{size:12,color:le.iconColor,strokeWidth:2})}),jsxs(Text,{style:[qe.detailsLabel,{color:le.titleColor,fontFamily:I.regular}],children:["Processing time:"," ",jsx(Text,{style:{fontFamily:I.medium},children:Ty(g)})]}),jsx(View,{style:{transform:[{rotate:G?"180deg":"0deg"}]},children:jsx(Pt,{size:16,color:le.actionColor,strokeWidth:2})})]})}),G&&jsxs(View,{style:qe.detailsExpanded,children:[jsxs(View,{style:qe.detailsRow,children:[jsx(View,{style:[qe.detailIcon,{backgroundColor:le.iconBackgroundColor,borderRadius:le.iconContainerBorderRadius}],children:jsx(hn,{size:12,color:le.iconColor,strokeWidth:2})}),jsxs(Text,{style:[qe.detailsLabel,{color:le.titleColor,fontFamily:I.regular}],children:["Slippage:"," ",jsxs(Text,{style:{fontFamily:I.medium},children:["Auto \u2022 ",(b??.25).toFixed(2),"%"]})]})]}),jsxs(View,{style:qe.detailsRow,children:[jsx(View,{style:[qe.detailIcon,{backgroundColor:le.iconBackgroundColor,borderRadius:le.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:le.iconColor,strokeWidth:2})}),jsxs(Text,{style:[qe.detailsLabel,{color:le.titleColor,fontFamily:I.regular}],children:["Price impact:"," ",jsxs(Text,{style:{fontFamily:I.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),He&&jsx(Text,{style:[qe.errorText,{color:k.error,fontFamily:I.regular,textAlign:"center"}],children:He}),jsxs(View,{style:qe.withdrawRow,children:[jsxs(TouchableOpacity,{style:[qe.withdrawButton,{backgroundColor:ze.primaryBackground,borderRadius:ze.borderRadius,borderWidth:ze.borderWidth,borderColor:ze.borderColor,opacity:!ve||!c||M?.5:1}],onPress:xt,disabled:!ve||!c||M,activeOpacity:.8,children:[M&&jsx(ActivityIndicator,{size:"small",color:ze.primaryText}),jsx(Text,{style:[qe.withdrawButtonText,{color:ze.primaryText,fontFamily:I.medium}],children:mt})]}),jsxs(View,{style:qe.footerRow,children:[jsxs(TouchableOpacity,{style:qe.historyLink,onPress:x,activeOpacity:.7,children:[jsx(bo,{size:14,color:k.foregroundMuted,strokeWidth:2}),jsx(Text,{style:[qe.historyText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Withdrawal history"})]}),jsxs(View,{style:qe.legalLinks,children:[jsx(TouchableOpacity,{onPress:()=>Linking.openURL(_),activeOpacity:.7,children:jsx(Text,{style:[qe.legalText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Terms"})}),jsx(Text,{style:[qe.legalSeparator,{color:k.foregroundMuted,fontFamily:I.regular}],children:"|"}),jsx(TouchableOpacity,{onPress:()=>Linking.openURL(T),activeOpacity:.7,children:jsx(Text,{style:[qe.legalText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Help"})})]})]})]})]})}var qe=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 vy(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 Py(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function El({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,m=J(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),u=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=vy(e.created_at||new Date().toISOString()),C=Py(e.source_amount_usd);return jsxs(Gt,{cardTokens:a,onPress:t,contentStyle:cn.container,children:[jsxs(View,{style:cn.iconContainer,children:[jsx(Image,{source:{uri:m},style:cn.tokenIcon}),jsx(View,{style:[cn.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsx(ks,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsx(ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(Qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:cn.textContainer,children:[jsx(Text,{style:[cn.title,{color:a.titleColor,fontFamily:o.medium}],children:u}),jsx(Text,{style:[cn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxs(View,{style:cn.rightContainer,children:[jsx(Text,{style:[cn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:C}),jsx(Vr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var cn=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 Ed(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(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let m=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${m} ${l}`}catch{return e}}function Dm(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 Fy(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 Vm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Lm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function da({label:e,value:t,isLast:r}){let{fonts:o,components:n}=D(),a=n.card;return jsxs(Fragment,{children:[jsxs(View,{style:Be.detailRow,children:[jsx(Text,{style:[Be.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsx(Text,{style:[Be.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsx(View,{style:[Be.divider,{backgroundColor:a.borderColor}]})]})}function zd({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=D(),[m,u]=useState([]),[h,C]=useState(!!n),g=l.card,b=l.button,w=l.header,c=l.container;useEffect(()=>{sc().then(se=>u(se.data)).catch(()=>{});},[]),useEffect(()=>{C(!!n);},[e?.id]);let S=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,y=e?e.status==="failed"||e.status==="refunded":false,f=y?i.error:S?i.warning:i.success,d=y?"Failed":S?"Processing":"Completed",x=e?.destination_token_metadata?J(ge(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?J(t.destinationTokenIconUrl):J(Ht("/icons/tokens/png/usdc.png")),_=e?.created_at?Ed(e.created_at):t.submittedAt?Ed(t.submittedAt.toISOString()):Ed(new Date().toISOString()),T=e?`${Dm(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Vm(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,k=e?`${Dm(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Vm(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,I=e?Fy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?_a(m,e.source_chain_type,e.source_chain_id):t.sourceChainId,V=e?_a(m,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,P=e?.explorer_url,H=e?.destination_transaction_hashes?.[0],M=e?.destination_explorer_url;return jsxs(gt,{style:Be.scroll,contentContainerStyle:Be.container,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Be.headerRow,children:[n?jsx(TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ii,{size:22,color:w.buttonColor,strokeWidth:2})}):jsx(View,{style:Be.headerSpacer}),jsx(Text,{style:[Be.headerTitle,{color:w.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsx(View,{style:Be.headerSpacer}):jsx(TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(tt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:Be.iconContainer,children:[jsx(Image,{source:{uri:x},style:Be.tokenIcon}),jsx(View,{style:[Be.statusBadge,{backgroundColor:f}],children:y?jsx(ks,{size:10,color:"#FFFFFF",strokeWidth:3}):S?jsx(View,{style:Be.spinnerDot}):jsx(Qe,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Be.statusRow,children:[jsx(View,{style:[Be.statusDot,{backgroundColor:f}]}),jsx(Text,{style:[Be.statusText,{color:f,fontFamily:s.medium}],children:d})]}),jsx(Text,{style:[Be.dateText,{color:c.subtitleColor,fontFamily:s.regular}],children:_}),jsxs(View,{style:[Be.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:[jsx(da,{label:"Amount Sent",value:T}),jsx(da,{label:"Amount Received",value:k}),jsx(da,{label:"USD Value",value:I}),jsx(da,{label:"Source Network",value:A}),jsx(da,{label:"Destination Network",value:V,isLast:true})]}),jsxs(TouchableOpacity,{style:Be.moreDetailsRow,onPress:()=>C(se=>!se),activeOpacity:.7,children:[jsx(Text,{style:[Be.moreDetailsText,{color:c.actionTitle,fontFamily:s.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsx(wo,{size:16,color:c.actionColor,strokeWidth:2}):jsx(Pt,{size:16,color:c.actionColor,strokeWidth:2})]}),h&&jsx(View,{style:[Be.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:F&&P?jsxs(Fragment,{children:[jsxs(TouchableOpacity,{style:Be.txRow,onPress:()=>Linking.openURL(P),activeOpacity:.7,children:[jsx(Text,{style:[Be.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsx(Text,{style:[Be.txHash,{color:g.titleColor,fontFamily:s.regular}],children:Lm(F)}),jsx(Co,{size:14,color:g.actionColor,strokeWidth:2})]}),!S&&H&&M&&jsxs(Fragment,{children:[jsx(View,{style:[Be.divider,{backgroundColor:g.borderColor}]}),jsxs(TouchableOpacity,{style:Be.txRow,onPress:()=>Linking.openURL(M),activeOpacity:.7,children:[jsx(Text,{style:[Be.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsx(Text,{style:[Be.txHash,{color:g.titleColor,fontFamily:s.regular}],children:Lm(H)}),jsx(Co,{size:14,color:g.actionColor,strokeWidth:2})]})]})]}):jsx(View,{style:Be.detailRow,children:jsx(Text,{style:[Be.detailLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxs(View,{style:Be.buttonRow,children:[jsx(TouchableOpacity,{style:[Be.button,Be.halfButton,{backgroundColor:b.secondaryBackground,borderRadius:b.borderRadius,borderWidth:b.borderWidth,borderColor:b.borderColor}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[Be.buttonText,{color:b.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsx(TouchableOpacity,{style:[Be.button,Be.halfButton,{backgroundColor:b.primaryBackground,borderRadius:b.borderRadius,borderWidth:b.borderWidth,borderColor:b.borderColor}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[Be.buttonText,{color:b.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Be=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: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 Bm(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ml({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=D(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",m=s?.status==="failed",u={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxs(View,{style:Ct.container,children:[jsx(TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[Ct.iconRing,{backgroundColor:n.successBackground}],children:jsx(Qe,{size:32,color:n.success,strokeWidth:2.5})}),jsx(Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxs(Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Bm(e.recipientAddress)]}),jsxs(View,{style:Ct.buttonRow,children:[jsx(TouchableOpacity,{style:[Ct.button,Ct.halfButton,u,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[Ct.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsx(TouchableOpacity,{style:[Ct.button,Ct.halfButton,u,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):m?jsxs(View,{style:Ct.container,children:[jsx(TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[Ct.iconRing,{backgroundColor:n.errorBackground}],children:jsx(tt,{size:32,color:n.error,strokeWidth:2.5})}),jsx(Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsx(Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsx(TouchableOpacity,{style:[Ct.button,Ct.fullButton,u,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxs(View,{style:Ct.container,children:[jsx(TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(ht,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsx(Image,{source:{uri:J(e.sourceTokenIconUrl)},style:Ct.tokenIconFill}):jsx(View,{style:[Ct.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsx(Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxs(Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Bm(e.recipientAddress)]})]})}var Ct=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 Wy(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:J(ge(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:J(ge(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 Am=(e,t)=>`${t}:${e}`;function Ey(){let{colors:e}=D(),t=useRef(new Animated.Value(.5)).current,r=e.cardHover;return useEffect(()=>{let o=Animated.loop(Animated.sequence([Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsx(View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsx(Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function Hl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,modalTitle:i="Withdraw Crypto",onWithdraw:s,onWithdrawSuccess:l,onWithdrawError:m,heightPercent:u=.94,sheetBorderRadius:h,sourceChainType:C,sourceChainId:g,sourceTokenAddress:b,sourceTokenSymbol:w,sourceChainName:c,sourceTokenIconUrl:S}){let{colors:y,fonts:f}=D(),[d,x]=useState("form"),[_,T]=useState(C),[k,I]=useState(g),[A,V]=useState(b),[F,P]=useState(w),[H,M]=useState(c),[se,He]=useState(S),[Fe,G]=useState(null),[Se,he]=useState(null),[Ie,Ge]=useState(null),[ke,te]=useState(),[Te,st]=useState([]),[Ae,Ye]=useState(null),[We,Ee]=useState("form"),Me=useRef(new Animated.Value(Dimensions.get("window").width)).current,me=useRef(null),X=!!_&&!!k&&!!A,{data:be,isLoading:pt}=Vl(r,e&&d==="form"),z=be?.data??[],{data:W,isLoading:ae}=Fd({sourceChainType:_,sourceChainId:k,sourceTokenAddress:A,sourceTokenSymbol:F,publishableKey:r,enabled:e&&X&&d==="form"}),{data:oe,isLoading:ve}=Dd({address:n,chainType:_,chainId:k,tokenAddress:A,publishableKey:r,enabled:e&&X}),{executions:xt}=Vd({userId:o,publishableKey:r,depositWalletId:ke,enabled:!!ke&&e,onWithdrawSuccess:l,onWithdrawError:m});useEffect(()=>{if(!e||d!=="tracker")return;let ne=false;return jo(o,r,"withdraw").then(O=>{ne||st(O.data);}).catch(console.error),()=>{ne=true;}},[e,d,o,r]),useEffect(()=>{e&&(me.current&&(clearTimeout(me.current),me.current=null),x("form"),T(C),I(g),V(b),P(w),M(c),He(S),G(null),he(null),Ge(null),te(void 0),st([]),Ye(null),Ee("form"),Me.setValue(Dimensions.get("window").width));},[e]),useEffect(()=>()=>{me.current&&clearTimeout(me.current);},[]),useEffect(()=>{se||W?.iconUrl&&He(W.iconUrl);},[W?.iconUrl,se]),useEffect(()=>{H||W?.chainName&&M(W.chainName);},[W?.chainName,H]),useEffect(()=>{d==="confirming"&&xt.length>0&&x("details");},[d,xt]);let de=useCallback(()=>{t(),me.current=setTimeout(()=>{x("form"),T(C),I(g),V(b),P(w),M(c),He(S),G(null),he(null),Ge(null),te(void 0),st([]),Ye(null),Ee("form"),me.current=null;},300);},[t,C,g,b,w,c,S]),le=useCallback(ne=>{let O=z.find(ft=>ft.symbol===ne);O&&(G(O),O.chains.length>0&&he(O.chains[0]));},[z]),ze=useCallback(ne=>{if(!Fe)return;let O=Fe.chains.find(ft=>Am(ft.chain_id,ft.chain_type)===ne);O&&he(O);},[Fe]),Yt=useCallback(async ne=>{let O=await Ho({external_user_id:o,destination_chain_type:ne.destinationChainType,destination_chain_id:ne.destinationChainId,destination_token_address:ne.destinationTokenAddress,recipient_address:ne.recipientAddress,action_type:"withdraw"},r),ft=No(O.data,_??"");if(!ft)throw new Error(`No deposit wallet found for chain type: ${_}`);return te(ft.id),{id:ft.id,address:ft.address}},[o,r,_]),mt=useCallback(ne=>{Ge(ne),x("confirming");},[]),ue=useCallback(ne=>{Ye(ne),Me.setValue(Dimensions.get("window").width),Animated.timing(Me,{toValue:0,duration:280,useNativeDriver:true}).start();},[Me]),et=useCallback(()=>{Animated.timing(Me,{toValue:Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ye(null));},[Me]),xr=pt||ae,_t=W?.isSupported??null,io=d==="confirming"?"Withdrawal Status":i,Or=h?.globalBorderTopLeftRadius,ir=h?.globalBorderTopRightRadius,$t=h?.main?.borderTopLeftRadius??Or,xe=h?.main?.borderTopRightRadius??ir,at=h?.tokenSelector?.borderTopLeftRadius??Or,$=h?.tokenSelector?.borderTopRightRadius??ir,re=h?.chainSelector?.borderTopLeftRadius??Or,_e=h?.chainSelector?.borderTopRightRadius??ir,pe=(()=>{if(d!=="form"||!X||ve||!oe)return;let ne=F||oe.symbol,O=oe.balanceUsd;if(O!=null){let pn=`$${parseFloat(O).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return ne?`Balance: ${pn} ${ne}`:`Balance: ${pn}`}let ft=oe.balanceHuman;if(!(!ft||ft==="0"))return ne?`Balance: ${ft} ${ne}`:`Balance: ${ft}`})();return jsx(ct,{visible:e,onClose:de,closeOnBackdropPress:false,enablePanDownToClose:d==="tracker"||d==="form",showHandle:d==="tracker"||d==="form",heightPercent:d==="confirming"?.3:d==="details"?.7:d==="tracker"?.6:u,maxHeightPercent:d==="tracker"?.9:void 0,borderTopLeftRadius:$t,borderTopRightRadius:xe,children:d==="confirming"&&Ie?jsx(Ml,{txInfo:Ie,executions:xt,onClose:de,onViewTracker:()=>{Ee("confirming"),x("tracker");}}):d==="details"&&Ie?jsx(zd,{execution:xt.length>0?xt[xt.length-1]:null,txInfo:Ie,onClose:de,onViewHistory:()=>{Ee("details"),x("tracker");},onHeaderClose:()=>x("form")}):d==="tracker"?jsxs(View,{style:Wo.trackerContainer,children:[jsx(kr,{title:"Withdrawal History",onClose:()=>x(We)}),Te.length===0?jsx(View,{style:Wo.emptyState,children:jsx(Text,{style:[Wo.emptyText,{color:y.foregroundMuted,fontFamily:f.regular}],children:"No withdrawals to track yet"})}):jsx(Fi,{data:Te,keyExtractor:ne=>ne.id,contentContainerStyle:Wo.listContent,showsVerticalScrollIndicator:false,renderItem:({item:ne})=>jsx(El,{execution:ne,onPress:()=>ue(ne)})}),Ae&&jsx(Animated.View,{style:[Wo.historyDetailOverlay,{backgroundColor:y.background,transform:[{translateX:Me}]}],children:jsx(zd,{execution:Ae,txInfo:Wy(Ae),onClose:de,onBack:et,onViewHistory:et})})]}):jsxs(Fragment,{children:[jsx(kr,{title:io,subtitle:pe,onClose:de}),xr?jsx(Ey,{}):_t===false?jsxs(View,{style:Wo.unsupportedContainer,children:[jsx(Text,{style:[Wo.unsupportedTitle,{color:y.foreground,fontFamily:f.medium}],children:"Unsupported Token"}),jsx(Text,{style:[Wo.unsupportedMessage,{color:y.foregroundMuted,fontFamily:f.regular}],children:W?.errorMessage})]}):jsx(My,{publishableKey:r,sourceChainType:_??"",sourceChainId:k??"",sourceTokenAddress:A??"",sourceTokenSymbol:F,sourceChainName:H,sourceTokenIconUrl:se,recipientAddressProp:a,destinationTokens:z,selectedToken:Fe,selectedChain:Se,selectedChainKey:Se?Am(Se.chain_id,Se.chain_type):null,onTokenChange:le,onChainChange:ze,tokensLoading:pt,balanceData:oe??null,isLoadingBalance:ve,sourceValidation:W??null,onDepositWalletCreation:Yt,onWithdraw:s,onWithdrawError:m,onWithdrawSubmitted:mt,onViewTracker:()=>{Ee("form"),x("tracker");},tokenSelectorLeft:at,tokenSelectorRight:$,chainSelectorLeft:re,chainSelectorRight:_e})]})})}function My({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:m,selectedChain:u,selectedChainKey:h,onTokenChange:C,onChainChange:g,tokensLoading:b,balanceData:w,isLoadingBalance:c,sourceValidation:S,onDepositWalletCreation:y,onWithdraw:f,onWithdrawError:d,onWithdrawSubmitted:x,onViewTracker:_,tokenSelectorLeft:T,tokenSelectorRight:k,chainSelectorLeft:I,chainSelectorRight:A}){return jsx(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxs(gt,{style:{flex:1,paddingTop:16},contentContainerStyle:Wo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsx(View,{style:Wo.doubleInputWrapper,children:jsx(ca,{tokens:l,selectedTokenSymbol:m?.symbol??null,selectedChainKey:h,onTokenChange:C,onChainChange:g,isLoading:b,tokenPickerBorderTopLeftRadius:T,tokenPickerBorderTopRightRadius:k,chainPickerBorderTopLeftRadius:I,chainPickerBorderTopRightRadius:A})}),jsx(Bl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:m,selectedChain:u,balanceData:w,isLoadingBalance:c,minimumWithdrawAmountUsd:S?.minimumAmountUsd??null,estimatedProcessingTime:S?.estimatedProcessingTime??null,maxSlippagePercent:S?.maxSlippagePercent??null,priceImpactPercent:S?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:y,onWithdraw:f,onWithdrawError:d,onWithdrawSubmitted:x,onViewTracker:_})]})})}var Wo=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}});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}});StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});StyleSheet.create({icon:{backgroundColor:"transparent"}});var Mm=createContext(null);function Gy({children:e,publishableKey:t,config:r}){let[o]=useState(()=>new qc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=useState(false),[i,s]=useState(null),[l,m]=useState(false),[u,h]=useState(null),C=useColorScheme(),g=useRef(false);g.current||(Sa({publishableKey:t}),g.current=true);let b=useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?C==="dark"?"dark":"light":P},[r?.appearance,C]);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.'),Sa({publishableKey:t});},[t]),useEffect(()=>()=>{c.current&&clearTimeout(c.current),_.current&&clearTimeout(_.current);},[]);let w=useRef(null),c=useRef(null),S=useCallback(P=>{c.current&&(clearTimeout(c.current),c.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 H=new Promise((M,se)=>{w.current={resolve:M,reject:se};});return s(P),a(true),H},[]),y=useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),a(false),c.current=setTimeout(()=>{s(null),c.current=null;},200);},[]),f=useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),d=useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),x=useRef(null),_=useRef(null),T=useRef(void 0),k=useCallback(P=>{_.current&&(clearTimeout(_.current),_.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let H=new Promise((M,se)=>{x.current={resolve:M,reject:se};});return T.current=P.onClose,h(P),m(true),H},[]),I=useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),T.current?.(),T.current=void 0,m(false),_.current=setTimeout(()=>{h(null),_.current=null;},200);},[]),A=useCallback(P=>{u?.onSuccess&&u.onSuccess(P),x.current&&(x.current.resolve(P),x.current=null);},[u]),V=useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),u?.onError&&u.onError(P),x.current&&(x.current.reject(P),x.current=null);},[u]),F=useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:y,beginWithdraw:k,closeWithdraw:I}),[t,S,y,k,I]);return jsx(Gc,{client:o,children:jsx(Mm.Provider,{value:F,children:jsxs(Pi,{mode:b,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsx(Dl,{visible:n,onClose:y,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:b,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?Yu():void 0,onDepositSuccess:f,onDepositError:d,theme:b,sheetBorderRadius:r?.sheetBorderRadius}),u&&jsx(Hl,{visible:l,onClose:I,publishableKey:t,externalUserId:u.externalUserId,senderAddress:u.senderAddress,recipientAddress:u.recipientAddress,sourceChainType:u.sourceChainType,sourceChainId:u.sourceChainId,sourceTokenAddress:u.sourceTokenAddress,sourceTokenSymbol:u.sourceTokenSymbol,onWithdraw:u.withdraw,onWithdrawSuccess:A,onWithdrawError:V,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Yy(){let e=useContext(Mm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
3
- export{La as AmountScreen,ct as BottomSheet,Ba as KYCWizardScreen,$a as OnrampScreen,qa as StripeOnramp,Ku as StripeOnrampPreconfigure,Gy as UnifoldProvider,ge as getPreferredIcon,Ea as getStripePublishableKey,Ra as getSupportedDestinationTokens,J as normalizeIconUrl,Qa as registerStripeOnramp,tu as setDevApiUrl,Wa as setStripeOnrampApiUrl,Aa as setStripeOnrampPublishableKey,sa as useAllowedCountry,za as useStripeOnramp,D as useTheme,Yy as useUnifold};
1
+ import*as Ln from'react';import Ln__default,{createContext,useContext,useState,useRef,useCallback,useEffect,useMemo,useId,Fragment as Fragment$1}from'react';import {StyleSheet,ScrollView,useWindowDimensions,Platform,PanResponder,Modal,Pressable,View,TouchableOpacity,Text,ActivityIndicator,KeyboardAvoidingView,TextInput,Keyboard,useColorScheme,Animated,Easing,Dimensions,Image,Linking,FlatList,Clipboard}from'react-native';import At,{G,Path,Defs,ClipPath,Rect,LinearGradient,Stop,Circle,Polyline,Line,SvgXml,SvgUri}from'react-native-svg';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Zd,{useSharedValue,withSpring,withTiming,runOnJS,useAnimatedStyle,interpolate,Extrapolation}from'react-native-reanimated';import {GestureHandlerRootView,TouchableOpacity as TouchableOpacity$1}from'react-native-gesture-handler';import {Onramp,useOnramp,isPlatformPaySupported,PlatformPay,initStripe}from'@stripe/stripe-react-native';import Rc from'@react-native-async-storage/async-storage';import Lh from'expo-constants';import hg from'react-native-qrcode-svg';import {WebView}from'react-native-webview';var jd=e=>{throw TypeError(e)};var $m=(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 jl=(e,t,r)=>t.has(e)||jd("Cannot "+r);var u=(e,t,r)=>(jl(e,t,"read from private field"),r?r.call(e):t.get(e)),J=(e,t,r)=>t.has(e)?jd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),B=(e,t,r,o)=>(jl(e,t,"write to private field"),t.set(e,r),r),Be=(e,t,r)=>(jl(e,t,"access private method"),r);var Cs=(e,t,r,o)=>({set _(n){B(e,t,n);},get _(){return u(e,t,o)}});var $l={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)"}},ql=$l;function fa(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ws(e,t,r){let o=r?t?.[r]:void 0,n=(d,g,T)=>{let h=o?.[d]?.[g];if(h!==void 0)return h;let y=t?.[d]?.[g];return y!==void 0?y:T},a={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,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,m=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,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:fa(a,i)},transferCrypto:{depositAddress:{card:fa(a,s)}},depositCard:{quoteProvider:{card:fa(a,l)}},depositTracker:{executionRow:{card:fa(a,m)}}}}function Ql(e,t,r){let n={...$l[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Kl=createContext(null);function D(){let e=useContext(Kl);if(!e){let t=ql.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ws(t,void 0,"dark"),isDark:true}}return e}function ft({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=D(),l=a??s.warning,m=i??"#FBBF24",d=useRef(new Animated.Value(0)).current,g=useId(),T=useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),h=(e-t)/2,y=2*Math.PI*h,w=e/2,c=o??Math.max(0,Math.round(e-t*2-8)),S=(e-c)/2;useEffect(()=>{let p=Animated.loop(Animated.timing(d,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return p.start(),()=>p.stop()},[d]);let b=d.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:[{width:e,height:e},n],children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:b}]},children:jsxs(At,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:l}),jsx(Stop,{offset:"100%",stopColor:m})]})}),jsx(Circle,{cx:w,cy:w,r:h,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${y*.75} ${y*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsx(View,{style:{position:"absolute",top:S+1.5,left:S,width:c,height:c},children:r}):null]})}function Jl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ri({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function So({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ss({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ar({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ii({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ot({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function qn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 qe({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ks({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function To({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 vi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ba({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(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 Ts({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(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"}),jsx(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"}),jsx(Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(At,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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"}),jsx(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"}),jsx(Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Pi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=useColorScheme(),l=useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),m=useMemo(()=>{let h=o?.[l];return Ql(l,h,r)},[l,o,r]),d=useMemo(()=>ws(m,i,l),[m,i,l]),g=useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),T=useMemo(()=>({mode:l,colors:m,fonts:g,components:d,isDark:l==="dark"}),[l,m,g,d]);return jsx(Kl.Provider,{value:T,children:e})}var Rs={damping:28,stiffness:300,mass:.8},kf=80,Tf=500;function ct({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:m=false,borderTopLeftRadius:d=24,borderTopRightRadius:g=24}){let{colors:T}=D(),{height:h}=useWindowDimensions(),[y,w]=useState(false),c=useRef(e);c.current=e;let S=useRef(0),b=i!=null&&i>=1,p=b||m?0:Platform.OS==="ios"?34:24,f=s!=null&&i!=null&&s>i,x=i!=null?(f?s:i)*h:void 0,_=f?(s-i)*h:0,k=l?0:_,C=useSharedValue(h),R=useCallback(()=>{c.current||w(false);},[]);useEffect(()=>{e?(w(true),C.value=withSpring(k,Rs)):y&&(C.value=withTiming(h,{duration:250},N=>{N&&runOnJS(R)();}));},[e]),useEffect(()=>{y&&e&&(C.value=withSpring(k,Rs));},[k]);let A=useCallback(()=>{o&&t();},[o,t]),F=useMemo(()=>{if(!(!n&&!f))return PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{S.current=C.value;},onPanResponderMove:(N,M)=>{if(Math.abs(M.dy)<4)return;let de=S.current+M.dy;C.value=Math.max(0,de);},onPanResponderRelease:(N,M)=>{if(!(Math.abs(M.dy)<4)){if(n&&(M.dy>kf||M.vy>Tf)){t();return}if(f){let de=_/2,Me=C.value<de?0:_;C.value=withSpring(Me,Rs);}else C.value=withSpring(k,Rs);}},onPanResponderTerminate:()=>{C.value=withSpring(k,Rs);}}).panHandlers},[n,f,_,k,C,t]),O=useAnimatedStyle(()=>({transform:[{translateY:C.value}]})),P=useAnimatedStyle(()=>({opacity:interpolate(C.value,[0,h*.5,h],[.5,.25,0],Extrapolation.CLAMP)}));return y?jsx(Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxs(GestureHandlerRootView,{style:Oi.root,children:[jsx(Zd.View,{style:[Oi.backdrop,P],pointerEvents:"auto",children:jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:A})}),jsxs(Zd.View,{style:[Oi.sheet,O,{height:x,backgroundColor:T.background,borderTopLeftRadius:b?0:d,borderTopRightRadius:b?0:g}],children:[a&&jsx(View,{style:Oi.handleContainer,pointerEvents:"none",children:jsx(View,{style:[Oi.handle,{backgroundColor:T.foreground+"33"}]})}),r,p>0&&jsx(View,{style:{height:p}}),F&&jsx(View,{...F,style:Oi.dragOverlay})]})]})}):null}var Oi=StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},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}}),ht=Ln__default.forwardRef((e,t)=>jsx(ScrollView,{ref:t,...e}));ht.displayName="BottomSheetScrollView";function Di(e){return jsx(FlatList,{...e})}var xf="https://api.unifold.io",ec="__UnifoldDevApiBaseUrl__",Sr="pk_test_123",wa={};function _f(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[ec];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function Kt(){return _f()??xf}function Sa(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.'),Sr=e.publishableKey;}e.defaultConfig&&(wa=e.defaultConfig);}function tu(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[ec]=t:delete globalThis[ec];}function Is(){return Kt()}function ka(){return Sr}function Wr(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 Nt(e){let t=e.startsWith("/")?e:`/${e}`;return `${Kt()}/api/public${t}`}function X(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Kt()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Kt()}${e}`:`${Kt()}/api/public${e}`:""}async function $o(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||wa.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||wa.destinationChainId||"8453",destination_token_address:e?.destination_token_address||wa.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Sr;Wr(n);let a=await fetch(`${Kt()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function qo(e,t){return e.find(r=>r.chain_type===t)}async function Qo(e,t,r){let o=t||Sr;Wr(o);let n=await fetch(`${Kt()}/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 Ta(e,t){let r=t||Sr;Wr(r);let o=await fetch(`${Kt()}/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 be(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 Qn(e,t){let r=e||Sr;Wr(r);let o=`${Kt()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=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}?${a.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 tc(e,t){let r=t||Sr;Wr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${Kt()}/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 xa(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function rc(e,t){let r=t||Sr;Wr(r);let o=await fetch(`${Kt()}/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 oc(e,t){let r=t||Sr;Wr(r);let o=await fetch(`${Kt()}/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 nc(e,t){let r=t||Sr;Wr(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(`${Kt()}/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 ic(e){let t=e||Sr;Wr(t);let r=await fetch(`${Kt()}/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 Fi(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 vs(e){let t=e||Sr;Wr(t);let r=await fetch(`${Kt()}/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 sc(){let e=await fetch(`${Kt()}/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 _a(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Ps(){let e=await fetch(`${Kt()}/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 Ra(e){let t=e||Sr;Wr(t);let r=await fetch(`${Kt()}/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 ac(e,t){let r=t||Sr;Wr(r);let o=await fetch(`${Kt()}/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 lc(e,t){return Ta(e.deposit_wallet_id,t)}async function Ia(e,t,r,o,n){let a=n||Sr;Wr(a);let i=await fetch(`${Kt()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}function ou({size:e=28}){return jsx(At,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxs(G,{fillRule:"evenodd",children:[jsx(Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsx(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 iu({size:e=28}){return jsxs(At,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#eth_clip)",children:[jsx(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"}),jsx(Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsx(Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsx(Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsx(Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsx(Defs,{children:jsx(ClipPath,{id:"eth_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function lu({size:e=28}){return jsxs(At,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#btc_clip)",children:[jsx(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"}),jsx(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"})]}),jsx(Defs,{children:jsx(ClipPath,{id:"btc_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function cu({size:e=28}){return jsxs(At,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxs(Defs,{children:[jsxs(LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsx(Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxs(G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsx(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"}),jsx(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"}),jsx(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 du({size:e=28}){return jsx(At,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxs(G,{children:[jsx(Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsx(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 va=[{label:"Base",value:Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:ou},{label:"Ethereum",value:Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:iu},{label:"Bitcoin",value:Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:lu},{label:"Solana",value:Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:cu},{label:"Polygon",value:Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:du}];function uu(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Pa(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 Oa(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=va.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=va.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Xt({onPress:e,title:t,variant:r="close"}){let{components:o,fonts:n}=D(),a=r==="back",i=a?jsx(Ii,{size:22,color:o.header.buttonColor,strokeWidth:2.5}):jsx(rt,{size:20,color:o.header.buttonColor,strokeWidth:2}),s=jsx(TouchableOpacity,{style:bn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:a?"Back":"Close",children:i});return t?jsxs(View,{style:bn.headerWithTitle,children:[a?s:jsx(View,{style:bn.headerSide}),jsx(Text,{style:[bn.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),a?jsx(View,{style:bn.headerSide}):s]}):jsxs(View,{style:a?bn.headerWithTitle:bn.header,children:[a?s:jsx(View,{style:bn.headerSpacer}),!a&&s]})}var Da={paddingTop:8,paddingBottom:8},bn=StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Da},headerWithTitle:{flexDirection:"row",alignItems:"center",...Da},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function kr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=D();return e?jsx(Text,{style:[pu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsx(Text,{style:[pu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var pu=StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function fo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsx(Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}function fc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=useState(false),{colors:s,components:l}=D(),m=()=>{Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},d=uu(r);return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsxs(View,{style:e.rowRight,children:[jsx(Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:d}),jsx(TouchableOpacity,{onPress:m,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsx(qe,{size:14,color:s.success,strokeWidth:2.5}):jsx(qn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}var Fa={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function hu({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=D(),a=e.toLowerCase(),i=Fa[a]??n.primary,s=Math.round(o*.42);return jsxs(View,{style:{width:o,height:o,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsx(View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsx(Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsx(Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function Va({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=D(),m=Nt(`/icons/currencies/png/${e.toLowerCase()}.png`),d=Oa(r);return jsxs(View,{style:[Xr.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxs(View,{style:Xr.step,children:[jsx(Image,{source:{uri:m},style:Xr.iconImage}),jsx(Text,{style:[Xr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsx(Text,{style:[Xr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsx(Ar,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxs(View,{style:Xr.step,children:[jsxs(View,{style:Xr.iconWithBadge,children:[o?jsx(Image,{source:{uri:o},style:Xr.tokenIcon}):jsx(View,{style:[Xr.tokenIcon,{backgroundColor:Fa[t.toLowerCase()]??i.primary}]}),n?jsx(Image,{source:{uri:n},style:[Xr.networkBadge,{borderColor:i.background}]}):null]}),jsx(Text,{style:[Xr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxs(Text,{style:[Xr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",d]})]})]})}var Xr=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 Bi(){let{colors:e,fonts:t,components:r}=D(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return useMemo(()=>{let l=i.borderRadius,m={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.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:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...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:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.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"}},d={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}:{}},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:20,paddingBottom:32,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)),h={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}:{}}},y={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:s.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:m,quote:g,pm:h,wallet:y,flow:w,amount:d}},[e,t,o,n,a,i,s])}function Zf({size:e=24}){let t=e,r=e*(471/750);return jsxs(At,{width:t,height:r,viewBox:"0 0 750 471",children:[jsx(Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsx(Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsx(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"}),jsx(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"}),jsx(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 Xf({size:e=24}){return jsx(At,{width:e,height:e,viewBox:"0 0 24 24",children:jsxs(G,{fill:"none",fillRule:"evenodd",children:[jsx(Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsx(Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function eh({size:e=24}){return jsx(At,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxs(G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsx(Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsx(G,{transform:"translate(312.9867,136.7145)",children:jsx(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"})}),jsx(G,{transform:"translate(349.7917,170.655)",children:jsx(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"})}),jsx(G,{transform:"translate(780.0408,412.227)",children:jsx(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"})}),jsx(G,{transform:"translate(738.7857,721.0845)",children:jsx(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"})}),jsx(G,{transform:"translate(373.0462,548.583)",children:jsx(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"})}),jsx(G,{transform:"translate(554.5071,446.121)",children:jsx(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 gc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsx(Ri,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsx(Zf,{size:t}):o.includes("mastercard")?jsx(Xf,{size:t}):o.includes("amex")||o.includes("american express")?jsx(eh,{size:t}):jsx(Ri,{size:t*.75,color:r,strokeWidth:1.75})}var th=[50,100,500],rh=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function wu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oh(e){return e.card?`${wu(e.card.brand)} ${wu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function La({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:m,paymentTokens:d=[],onAddPaymentMethod:g,onConfirm:T,onCancel:h,sheetBorderTopLeftRadius:y,sheetBorderTopRightRadius:w}){let c=Bi(),{colors:S,components:b}=D(),p=y??b.card.borderRadius,f=w??b.card.borderRadius,[x,_]=useState(e),[k,C]=useState(r?"apple_pay":d.length>0?d[0].id:null),R=useRef(false),A=z=>{R.current=true,C(z);};useEffect(()=>{R.current||r||d.length>0&&C(d[0].id);},[d,r]);let[F,O]=useState(false),[P,N]=useState("select"),[M,de]=useState(null),Me=useRef(false);useEffect(()=>{s&&l&&/saving/i.test(l)&&N("card");},[s,l]);let Le=k==="apple_pay",Y=1e3,Ie=Le?Y:n,pe=Ie!=null&&Ie>0,ve=useMemo(()=>{if(o)return [];let z=th.map(q=>({label:`$${q}`,amount:String(q),disabled:false}));return Le?z.push({label:`$${Y}`,amount:String(Y),disabled:false}):z.push({label:"MAX",amount:pe?String(Ie):"0",disabled:!pe}),z},[o,pe,Ie,Le]),je=z=>{if(z==="\u232B"){_(q=>q.slice(0,-1));return}if(z==="."){if(x.includes("."))return;_(q=>q===""?"0.":q+".");return}_(q=>{let se=q.indexOf(".");return se!==-1&&q.length-se>2?q:q==="0"&&z!=="."?z:q+z});},ye=x===""?"0":x,te=parseFloat(x),Te=x!==""&&!isNaN(te)&&te>0,at=r||d.length>0,We=a==="header",Xe=useMemo(()=>{let z=[];r&&z.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let q of d)z.push({id:q.id,label:oh(q),hint:q.card?`Expires ${q.card.exp_month}/${q.card.exp_year}`:q.type,brand:q.card?.brand,isApplePay:false});return z},[r,d]),De=Xe.find(z=>z.id===k),Ke=k!=null&&k!=="apple_pay",Fe=De?De.label:Ke&&M?M:Ke?"Card":"Pay With",Z=De?!De.isApplePay:Ke,ie=De?.brand??M??void 0,Ge=at?jsx(TouchableOpacity,{style:[We?c.amount.paymentRowHeader:c.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(N("select"),O(true));},activeOpacity:.7,disabled:s,children:jsxs(View,{style:c.amount.paymentLeft,children:[De?.isApplePay?jsx(Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):Z?jsx(gc,{sublabel:ie,size:20}):null,jsx(Text,{style:c.amount.paymentLabel,children:Fe}),jsx(Ot,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxs(View,{style:c.form.screen,children:[jsx(Xt,{onPress:h,title:"Enter amount"}),We&&Ge,jsxs(View,{style:c.form.content,children:[jsxs(View,{style:c.amount.amountContainer,children:[jsxs(Text,{style:[c.amount.amountText,ye==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",ye]}),jsx(Text,{style:c.amount.currencyLabel,children:t.toUpperCase()})]}),!We&&Ge,ve.length>0&&jsx(View,{style:c.amount.quickRow,children:ve.map(z=>{let q=!z.disabled&&x===z.amount&&x!=="";return jsx(TouchableOpacity,{style:[c.amount.quickPill,q&&{backgroundColor:S.primary},z.disabled&&{opacity:.4}],activeOpacity:.7,disabled:z.disabled||s,onPress:()=>_(z.amount),children:jsx(Text,{style:[c.amount.quickPillText,q&&{color:S.primaryForeground}],children:z.label})},z.label)})}),jsx(View,{style:c.amount.numpad,children:rh.map((z,q)=>jsx(View,{style:c.amount.numpadRow,children:z.map(se=>jsx(TouchableOpacity,{style:[c.amount.numpadKey,s&&{opacity:.3}],onPress:()=>je(se),activeOpacity:.6,disabled:s,children:jsx(Text,{style:se==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:se})},se))},q))}),jsx(TouchableOpacity,{style:[c.form.continueBtn,(!Te||s)&&c.form.continueBtnDisabled],onPress:()=>Te&&!s&&T(x,k),disabled:!Te||s,children:s?jsx(ActivityIndicator,{size:"small",color:S.primaryForeground}):jsx(Text,{style:[c.form.continueBtnText,!Te&&c.form.continueBtnTextDisabled],children:"Continue"})}),!F&&m?jsx(Text,{style:c.amount.inlineError,children:m}):!F&&s&&l&&__DEV__?jsx(Text,{style:c.amount.inlineStatus,children:l}):null]}),jsx(ct,{visible:F,onClose:()=>{s||(O(false),N("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:f,children:jsx(View,{style:c.amount.sheetContent,children:P==="select"?jsxs(Fragment,{children:[jsxs(View,{style:c.amount.sheetTitleRow,children:[jsx(Text,{style:c.amount.sheetTitle,children:"Pay With"}),jsx(TouchableOpacity,{onPress:()=>O(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsx(rt,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxs(ht,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[Xe.map(z=>{let q=k===z.id;return jsxs(TouchableOpacity,{style:[c.amount.sheetOption,q&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{A(z.id),de(z.isApplePay?null:z.label),O(false);},children:[jsxs(View,{style:c.amount.sheetOptionLeft,children:[jsx(View,{style:c.amount.sheetOptionIcon,children:z.isApplePay?jsx(Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsx(gc,{sublabel:z.brand,size:24})}),jsxs(View,{style:{flex:1},children:[jsx(Text,{style:c.amount.sheetOptionLabel,children:z.label}),jsx(Text,{style:c.amount.sheetOptionHint,children:z.hint})]})]}),q&&jsx(qe,{size:18,color:S.primary,strokeWidth:2.5})]},z.id)}),jsx(TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Me.current){Me.current=true;try{let z=await g?.();z&&(A(z.token),de(z.sublabel),O(!1));}finally{Me.current=false;}}},children:jsx(Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:c.amount.sheetHeader,children:[jsx(TouchableOpacity,{onPress:()=>{s||N("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsx(Ii,{size:20,color:S.foreground,strokeWidth:2})}),jsx(Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),s?jsxs(View,{style:c.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:c.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):m?jsxs(Fragment,{children:[jsx(View,{style:c.amount.sheetError,children:jsx(Text,{style:c.amount.sheetErrorText,children:m})}),jsx(TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{i&&Te&&i(false,x);},children:jsx(Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxs(View,{style:c.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})})]})}var Ls=4;function Ba({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Bi(),{colors:a,fonts:i,components:s}=D(),l=s.input.placeholderColor,[m,d]=useState(1),[g,T]=useState(e.firstName??""),[h,y]=useState(e.lastName??""),[w,c]=useState(e.dobMonth??""),[S,b]=useState(e.dobDay??""),[p,f]=useState(e.dobYear??""),[x,_]=useState(e.addressLine1??""),[k,C]=useState(e.addressLine2??""),[R,A]=useState(e.city??""),[F,O]=useState(e.state??""),[P,N]=useState(e.postalCode??""),[M,de]=useState(e.country??"US"),[Me,Le]=useState(e.idNumber??""),Y=useRef(null),Ie=useRef(null),pe=useRef(null),ve=useRef(null),je=useRef(null),ye=useRef(null),te=useRef(null),Te=useRef(null),at=()=>{switch(m){case 1:return g.trim().length>0&&h.trim().length>0;case 2:return w.length===2&&S.length===2&&p.length===4;case 3:return x.trim().length>0&&R.trim().length>0&&F.trim().length>0&&P.trim().length>0;case 4:return Me.trim().length>0;default:return false}},We=()=>{at()&&(m<Ls?d(Fe=>Fe+1):r({firstName:g,lastName:h,idNumber:Me,dobMonth:w,dobDay:S,dobYear:p,addressLine1:x,addressLine2:k,city:R,state:F,postalCode:P,country:M}));},Xe=()=>{m>1?d(Fe=>Fe-1):o();},De=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],$e=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],Ke=[Wt.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsx(KeyboardAvoidingView,{style:n.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:n.form.screen,children:[jsxs(View,{style:Wt.header,children:[jsx(View,{style:Wt.headerSide,children:jsx(TouchableOpacity,{style:Wt.iconButton,onPress:Xe,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:m>1?"Back":"Cancel",children:jsx(Ss,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsx(View,{style:Wt.headerCenter,children:jsxs(Text,{style:Ke,children:[m," of ",Ls]})}),jsx(View,{style:Wt.headerSide,children:jsx(TouchableOpacity,{style:Wt.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsx(rt,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsx(View,{style:Wt.progressTrack,children:Array.from({length:Ls}).map((Fe,Z)=>jsx(View,{style:[Wt.progressSegment,{backgroundColor:Z<m||Z+1===m?a.primary:a.border}]},Z))}),jsxs(ht,{style:n.form.flex,contentContainerStyle:Wt.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsx(Text,{style:n.form.title,children:De[m-1]}),jsx(Text,{style:n.form.subtitle,children:$e[m-1]}),m===1&&jsxs(Fragment,{children:[jsx(Go,{form:n.form,label:"First name",children:jsx(TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:g,onChangeText:T,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Y.current?.focus()})}),jsx(Go,{form:n.form,label:"Last name",children:jsx(TextInput,{ref:Y,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:h,onChangeText:y,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:We})})]}),m===2&&jsxs(View,{style:Wt.dobRow,children:[jsxs(View,{style:Wt.dobCol,children:[jsx(Text,{style:[n.form.fieldLabel,Wt.dobLabel],children:"Month"}),jsx(TextInput,{style:[n.form.input,Wt.dobInput],placeholder:"MM",placeholderTextColor:l,value:w,onChangeText:Fe=>{let Z=Fe.replace(/\D/g,"").slice(0,2);c(Z),Z.length===2&&Ie.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:Wt.dobCol,children:[jsx(Text,{style:[n.form.fieldLabel,Wt.dobLabel],children:"Day"}),jsx(TextInput,{ref:Ie,style:[n.form.input,Wt.dobInput],placeholder:"DD",placeholderTextColor:l,value:S,onChangeText:Fe=>{let Z=Fe.replace(/\D/g,"").slice(0,2);b(Z),Z.length===2&&pe.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:Wt.dobColWide,children:[jsx(Text,{style:[n.form.fieldLabel,Wt.dobLabel],children:"Year"}),jsx(TextInput,{ref:pe,style:[n.form.input,Wt.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:p,onChangeText:Fe=>{let Z=Fe.replace(/\D/g,"").slice(0,4);f(Z);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:We})]})]}),m===3&&jsxs(Fragment,{children:[jsx(Go,{form:n.form,label:"Street address",children:jsx(TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:x,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>ve.current?.focus()})}),jsx(Go,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsx(TextInput,{ref:ve,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:k,onChangeText:C,returnKeyType:"next",onSubmitEditing:()=>je.current?.focus()})}),jsx(Go,{form:n.form,label:"City",children:jsx(TextInput,{ref:je,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:R,onChangeText:A,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ye.current?.focus()})}),jsxs(View,{style:Wt.row,children:[jsx(View,{style:[n.form.flex,{marginRight:8}],children:jsx(Go,{form:n.form,label:"State",children:jsx(TextInput,{ref:ye,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:F,onChangeText:Fe=>O(Fe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})}),jsx(View,{style:n.form.flex,children:jsx(Go,{form:n.form,label:"ZIP code",children:jsx(TextInput,{ref:te,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:P,onChangeText:N,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})})})]}),jsx(Go,{form:n.form,label:"Country",children:jsx(TextInput,{ref:Te,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:M,onChangeText:Fe=>de(Fe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:We})})]}),m===4&&jsxs(Go,{form:n.form,label:"Social Security Number",children:[jsx(TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:Me,onChangeText:Le,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:We}),jsx(Text,{style:[n.form.hint,Wt.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsx(View,{style:n.form.footer,children:t&&m===Ls?jsx(View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsx(ft,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[n.form.continueBtn,!at()&&n.form.continueBtnDisabled],onPress:We,disabled:!at(),children:jsx(Text,{style:[n.form.continueBtnText,!at()&&n.form.continueBtnTextDisabled],children:m===Ls?"Submit":"Continue"})})})]})})}function Go({form:e,label:t,children:r}){return jsxs(View,{style:e.fieldWrap,children:[jsx(Text,{style:e.fieldLabel,children:t}),r]})}var Wt=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,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:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},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 ku="",Tu;function Aa(e){ku=e;}function Wa(e){Tu=e;}function Ur(){let e=ku||ka();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Hr(){return Tu??Is()}async function Ea(){let e=`${Hr()}/v1/public/onramps/headless/stripe/config`,t=Ur(),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 Sc(e){let t=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Ur(),"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 xu(e){let t=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Ur(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!t.ok)throw new Error(`Failed to exchange auth intent for tokens: ${t.status}`);return t.json()}async function kc(e){let t=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Ur(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})}),r=await t.json().catch(()=>({}));if(!t.ok)throw new Error(r?.message??`Failed to refresh OAuth token: ${t.status}`);return r}async function _u(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(`${Hr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Ur(),"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 Ru(e,t){let r=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Ur(),"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 Ma(e,t){let r=`${Hr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Ur(),"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 Iu(e,t){let r=`${Hr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Ur(),"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 Tc(e,t){let r=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Ur(),"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 vu(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(`${Hr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Ur(),"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 xc(e,t){let r=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Ur(),"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 Pu(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(`${Hr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Ur(),"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 _c(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 Ou(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Hr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Ur()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}var Ic="@unifold/stripe_oauth";async function Du(){try{let e=await Rc.getItem(Ic);return e?JSON.parse(e):null}catch{return null}}async function vc(e){try{await Rc.setItem(Ic,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Sn(){try{await Rc.removeItem(Ic);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var uh=5,Tn=null,Fu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function za(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:m,registerWalletAddress:d,collectPaymentMethod:g,createCryptoPaymentToken:T}=useOnramp(),[h,y]=useState(r),[w,c]=useState(!!e?.externalUserId),[S,b]=useState(false),[p,f]=useState(""),[x,_]=useState(null),[k,C]=useState(e?.email??""),[R,A]=useState(e?.phone??""),[F,O]=useState(""),[P,N]=useState("US"),[M,de]=useState(""),[Me,Le]=useState(""),Y=useRef(""),Ie=useRef(""),pe=useRef(""),[ve,je]=useState(false),[ye,te]=useState(false),Te=useRef(0),at=useRef(false),We=useRef(false),Xe=useRef(false),De=useRef(""),$e=useRef(e?.defaultNetwork??Onramp.CryptoNetwork.base),Ke=useRef(null),[Fe,Z]=useState(Fu),[ie,Ge]=useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[z,q]=useState(""),[se,ne]=useState(e?.defaultNetwork??Onramp.CryptoNetwork.base),[ue,Zt]=useState(e?.defaultSourceAmount??"100"),[me,ae]=useState(e?.defaultSourceCurrency??"usd"),[xe,Pt]=useState(e?.defaultDestinationCurrency??"usdc"),[pt,fe]=useState(null),[tt,Rr]=useState(),[xt,Gr]=useState(),[co,wr]=useState(false),qt=useRef(null),we=useRef(false),et=useRef(0),$=useRef(e?.onComplete),oe=useRef(e?.onError),_e=useRef(e?.onStepChange),he=useRef(r);useEffect(()=>{$.current=e?.onComplete;},[e?.onComplete]),useEffect(()=>{oe.current=e?.onError;},[e?.onError]),useEffect(()=>{_e.current=e?.onStepChange;},[e?.onStepChange]);let bt=useRef(r);useEffect(()=>{h!==bt.current&&(_e.current?.(h,bt.current),bt.current=h),he.current=h;},[h]),useEffect(()=>{w&&h!==r&&c(false);},[w,h,r]);let L=useCallback((I,v,H)=>{let ee={code:I,message:v,step:he.current,stripeErrorCode:H};_(ee),f(""),oe.current?.(ee);},[]),Ir=useCallback(I=>{let v={sessionId:I.id,status:I.status,sourceAmount:I.transaction_details.source_amount,sourceCurrency:I.transaction_details.source_currency,destinationAmount:I.transaction_details.destination_amount,destinationCurrency:I.transaction_details.destination_currency,destinationNetwork:I.transaction_details.destination_network,walletAddress:I.transaction_details.wallet_address,fees:{networkFee:I.transaction_details.fees.network_fee_amount,transactionFee:I.transaction_details.fees.transaction_fee_amount}};return $.current?.(v),v},[]),E=useCallback(()=>_(null),[]),_t=I=>I.refresh_token??I.refresh?.refresh_token??"",mt=useCallback((I,v,H,ee,ge)=>{Ie.current=v,Y.current=H,e?.externalUserId&&vc({accessToken:v,refreshToken:H,customerId:I,externalUserId:e.externalUserId,email:ge||k,expiresAt:Date.now()+ee*1e3});},[e?.externalUserId,k]),Vr=useCallback(async()=>{let I=Y.current;if(!I)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let v=await kc(I),H=v.access_token,ee=_t(v)||I;return Le(H),mt(pe.current,H,ee,v.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),H}catch(v){return console.error("[tryRefreshAccessToken] refresh failed:",v?.message),await Sn(),Tn=null,Ie.current="",Y.current="",pe.current="",Le(""),de(""),null}},[mt]),Qt=useCallback(async I=>{try{return await I(Ie.current)}catch(v){let H=v?.message??"";if(H.includes("stripe_onramp_forbidden")||H.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let ee=await Vr();if(!ee)throw L("authorization_error","Session expired. Please sign in again."),y("email"),v;return await I(ee)}throw v}},[Vr,L]);useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){wr(false);return}let v=false;return isPlatformPaySupported().then(H=>{v||wr(H);}),()=>{v=true;}},[e?.merchantIdentifier]),useEffect(()=>(we.current=false,()=>{we.current=true,qt.current&&clearTimeout(qt.current);}),[]);let xi=useRef(false);useEffect(()=>{if(xi.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),Sn(),Tn=null,c(false);return}let I=false;return (async()=>{try{let v=await Du();if(I||!v){I||c(!1);return}if(v.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",v.externalUserId,"current:",e.externalUserId),await Sn(),Tn=null,I||c(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",v.customerId);let H=Date.now()>=v.expiresAt,ee=v.accessToken,ge=v.refreshToken;if(H){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let ze=await kc(v.refreshToken);if(I)return;ee=ze.access_token,ge=ze.refresh_token??ze.refresh?.refresh_token??v.refreshToken,await vc({accessToken:ee,refreshToken:ge,customerId:v.customerId,externalUserId:e.externalUserId,email:v.email,expiresAt:Date.now()+(ze.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(ze){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",ze?.message),await Sn(),Tn=null,I||c(!1);return}}if(I)return;if(xi.current=!0,de(v.customerId),pe.current=v.customerId,Le(ee),Ie.current=ee,Y.current=ge,v.email&&C(v.email),Tn===v.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",v.customerId,"\u2014 skipping configure()"),Ke.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",v.customerId);let ze=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:v.customerId});ze.error?console.error("[useStripeOnramp] restore configureSDK error:",ze.error.message):Tn=v.customerId,Ke.current=Promise.resolve(ze);}if(I)return;let lt=()=>new Promise(ze=>{let pr=()=>{Xe.current&&De.current?ze():setTimeout(pr,200);};pr();});try{if(await Promise.race([lt(),new Promise((pr,Lt)=>setTimeout(()=>Lt(new Error("timeout")),1e4))]),I)return;let ze=De.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",ze,"network:",$e.current),await d(ze,$e.current);}catch(ze){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",ze?.message);}if(I)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),y("session_params");}finally{I||c(false);}})(),()=>{I=true;}},[]),useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ve||ye)return;let I=false;te(true);async function v(){try{let[H,ee]=await Promise.all([Pu({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?Ou({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Bt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Bt?.message),null)):Promise.resolve(null)]);if(I)return;let ge=e?.destinationChainType??"ethereum",lt=H.data.find(Bt=>Bt.chain_type===ge);if(lt?.address){let Bt=lt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Bt,"recipient:",lt.recipient_address),Ge(Bt),De.current=Bt,lt.recipient_address&&q(lt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",ge,"in",H.data?.length,"wallets");let ze={base:Onramp.CryptoNetwork.base,ethereum:Onramp.CryptoNetwork.ethereum,solana:Onramp.CryptoNetwork.solana,bitcoin:Onramp.CryptoNetwork.bitcoin,polygon:Onramp.CryptoNetwork.polygon},pr={8453:"base",1:"ethereum",137:"polygon"},Lt=ee?.destination_network,ar="none";if(Lt&&ze[Lt])ne(ze[Lt]),$e.current=ze[Lt],ar=Lt+" (from default_token API)";else if(e?.destinationChainId&&pr[e.destinationChainId]){let Bt=pr[e.destinationChainId];ze[Bt]&&(ne(ze[Bt]),$e.current=ze[Bt]),ar=Bt+" (from chain_id "+e.destinationChainId+")";}else ze[ge]&&(ne(ze[ge]),$e.current=ze[ge],ar=ge+" (from chain_type fallback)");ee?.destination_currency&&Pt(ee.destination_currency.toLowerCase());let rr=ee?.destination_token_metadata,Yr=_c(rr?.icon_urls,rr?.icon_url),Jr=_c(rr?.chain?.icon_urls,rr?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",Yr,"network:",Jr),Yr&&Rr(Yr),Jr&&Gr(Jr),je(!0),Xe.current=!0;}catch(H){console.error("[useStripeOnramp] Failed to resolve wallet:",H?.message),je(true),Xe.current=true;}finally{I||te(false);}}return v(),()=>{I=true;}},[e?.publishableKey,e?.externalUserId]);let uo=useCallback(async()=>{if(Ke.current)return Ke.current;let I=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(v=>(v.error&&(console.error("[useStripeOnramp] configureSDK error:",v.error.message,v.error.code),Ke.current=null),v)).catch(v=>{throw console.error("[useStripeOnramp] configureSDK threw:",v?.message??v),Ke.current=null,v});return Ke.current=I,I},[o,e?.merchantDisplayName]);useEffect(()=>{e?.externalUserId||uo();},[]);let Ho=useCallback(async I=>{if(!at.current){at.current=true,b(true),E(),f("Creating auth intent...");try{let v=await Sc(I);f("Waiting for authorization...");let H=await i(v);if(H?.error){console.log("[proceedToAuthorize] authorize error:",H.error.message),L("authorization_error","Something went wrong during authorization. Please try again."),y("email");return}if(H?.status==="Denied"){L("authorization_error","Authorization denied by user."),y("email");return}if(H?.status!=="Consented"||!H.customerId){L("authorization_error","Authorization was canceled."),y("email");return}f("Exchanging tokens...");let ee=await xu(v),ge=H.customerId,lt=ee.access_token,ze=_t(ee);console.log("[useStripeOnramp] customerId:",ge),console.log("[useStripeOnramp] accessToken acquired, length:",lt.length),de(ge),pe.current=ge,Tn=ge,Le(lt),mt(ge,lt,ze,ee.expires_in??3600),f("Checking verification status...");try{let pr=await Ma(ge,lt),Lt=pr.verifications.find(hn=>hn.name==="kyc_verified"),ar=pr.verifications.find(hn=>hn.name==="id_document_verified"),rr=Lt?.status==="verified",Yr=Lt?.status==="rejected",Jr=ar?.status==="verified",Bt=pr.provided_fields.includes("first_name");if(f(""),Yr&&!Bt)L("kyc_error","KYC was previously rejected. Please submit with correct info."),y("kyc");else if(Yr&&Bt)y(Jr?"wallet":"identity");else if(!rr&&!Bt)y("kyc");else if(!Jr)y("identity");else if(Xe.current&&De.current)try{let hn=De.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",hn,"network:",se);let ma=await d(hn,se);ma?.error?(console.warn("[proceedToAuthorize] wallet registration error:",ma.error.message),L("wallet_error",ma.error.message,ma.error.code),y("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),y("session_params"));}catch(hn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",hn?.message),y("wallet");}else y("wallet");}catch(pr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",pr?.message),f(""),y("kyc");}}catch(v){L("authorization_error",v?.message??String(v)),y("email");}finally{at.current=false,b(false);}}},[i,E,L,mt,d,se]),Q=useCallback(async()=>{if(Keyboard.dismiss(),!k){L("validation_error","Please enter an email address.");return}b(true),E(),f("");try{f("Configuring...");let I=await uo();if(I.error){L("configuration_error",I.error.message,I.error.code);return}f("Checking Link account...");let v=await n(k);if(v.error){L("authorization_error",v.error.message,v.error.code);return}v.hasLinkAccount?await Ho(k):(f(""),y("register"));}catch(I){L("unknown_error",I?.message??String(I));}finally{b(false);}},[E,uo,k,L,n,Ho]),le=useCallback(async()=>{if(!R){L("validation_error","Please enter your phone number.");return}b(true),E(),f("");try{f("Creating Link account...");let I=await a({email:k,phone:R,fullName:F||k,country:P||"US"});if(I.error){L("registration_error",I.error.message,I.error.code);return}await Ho(k);}catch(I){L("registration_error",I?.message??String(I));}finally{b(false);}},[E,P,k,L,F,R,a,Ho]);useEffect(()=>{if(h!=="email"||!e?.email||w)return;let I=++Te.current,v=false,H=()=>v||Te.current!==I;return e?.phone?(async()=>{b(true),E();try{f("Configuring...");let ee=await uo();if(H())return;if(ee.error){L("configuration_error",ee.error.message,ee.error.code);return}f("Checking Link account...");let ge=await n(e.email);if(H())return;if(ge.error){L("authorization_error",ge.error.message,ge.error.code);return}if(ge.hasLinkAccount){if(H())return;await Ho(e.email);}else {f("Creating Link account...");let lt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(H())return;if(lt.error){L("registration_error",lt.error.message,lt.error.code);return}if(H())return;await Ho(e.email);}}catch(ee){H()||L("unknown_error",ee?.message??String(ee));}finally{b(false);}})():(async()=>{b(true),E();try{f("Configuring...");let ee=await uo();if(H())return;if(ee.error){L("configuration_error",ee.error.message,ee.error.code);return}f("Checking Link account...");let ge=await n(e.email);if(H())return;if(ge.error){L("authorization_error",ge.error.message,ge.error.code);return}if(ge.hasLinkAccount){if(H())return;await Ho(e.email);}else {if(H())return;f(""),y("register");}}catch(ee){H()||L("unknown_error",ee?.message??String(ee));}finally{b(false);}})(),()=>{v=true;}},[h,e?.email,e?.phone,w]);let wt=useCallback(async I=>{b(true),E(),f(""),Z(I);try{let v={firstName:I.firstName,lastName:I.lastName,idNumber:I.idNumber||void 0,dateOfBirth:{day:parseInt(I.dobDay,10),month:parseInt(I.dobMonth,10),year:parseInt(I.dobYear,10)},address:{line1:I.addressLine1,line2:I.addressLine2||void 0,city:I.city,state:I.state,postalCode:I.postalCode,country:I.country}},H=await s(v);if(H?.error){if(H.error.stripeErrorCode==="consumer_person_already_verified"){f(""),y("identity");return}L("kyc_error",H.error.message,H.error.stripeErrorCode??H.error.code),y("kyc");return}f("Please review your KYC information...");let ee=await l(null);if(ee?.error){L("kyc_error",ee.error.message,ee.error.stripeErrorCode??ee.error.code),y("kyc");return}if(ee?.status==="UpdateAddress"){L("kyc_error","Please update your address and resubmit."),y("kyc");return}f(""),y("identity");}catch(v){L("kyc_error",v?.message??String(v)),y("kyc");}finally{b(false);}},[s,E,L,l]),Lr=useCallback(async()=>{if(!We.current){We.current=true,b(true),E(),f("Launching identity verification...");try{let I=await m();if(I?.error){L("identity_error",I.error.message,I.error.code);return}f(""),y("wallet");}catch(I){L("identity_error",I?.message??String(I));}finally{We.current=false,b(false);}}},[E,L,m]);useEffect(()=>{h==="identity"&&!S&&Lr();},[h]);let bs=useCallback(async()=>{if(!ie){L("validation_error","Please enter a wallet address.");return}b(true),E(),f("");try{let I=ie.toLowerCase();console.log("[registerWallet] registering wallet:",I,"network:",se);let v=await d(I,se);if(v?.error){console.warn("[registerWallet] error:",v.error.message),L("wallet_error",v.error.message,v.error.code);return}console.log("[registerWallet] wallet registered successfully"),f(""),y("session_params");}catch(I){L("wallet_error",I?.message??String(I));}finally{b(false);}},[E,L,ie,se,d]);useEffect(()=>{h==="wallet"&&ve&&ie&&bs();},[h,ve,ie]);let po=useCallback(I=>{we.current=false,et.current=0;let v=0,H=async()=>{v+=1;let ee=Ie.current;try{let ge=await Iu(I,ee);if(console.log(`[pollSessionStatus] poll #${v} session=${I} status="${ge.status}"`),we.current)return;et.current=0,ge.status==="fulfillment_complete"?(fe(ge),y("success")):qt.current=setTimeout(H,3e3);}catch(ge){if(we.current)return;let lt=ge?.message??"";if((lt.includes("stripe_onramp_forbidden")||lt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Vr()&&!we.current)){qt.current=setTimeout(H,1e3);return}if(et.current+=1,console.error(`[pollSessionStatus] poll #${v} error:`,lt),et.current>=uh){L("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}qt.current=setTimeout(H,5e3);}};qt.current=setTimeout(H,3e3);},[L,Vr]),mo=useCallback(()=>{if(he.current==="processing"&&pt?.id){if(!Ie.current){L("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}E(),et.current=0,qt.current&&(clearTimeout(qt.current),qt.current=null),po(pt.id);}},[E,L,po,pt?.id]),Br=useCallback(async I=>{b(true),E(),f("");try{f("Confirming purchase...");let v=await Qt(H=>Ru(I,H));console.log("[finalizeOnrampSession] confirmed session:",v.id,"status:",v.status),fe(v),y("processing"),f(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",v.id),po(v.id);}finally{b(false);}},[E,po,Qt]),No=useRef(false),zm=useCallback(async()=>{if(!(!pt||No.current)){No.current=true;try{b(!0),E(),f("Refreshing quote...");let I=await Qt(v=>Tc(pt.id,v));fe(I),await Br(I.id);}catch(I){console.log("[confirmCheckout] error:",I?.message),L("session_error","Something went wrong. Please try again."),y("quote");}finally{b(false),No.current=false;}}},[E,L,Br,pt,Qt]),Nd=useCallback(async()=>{let I=k;if(!I)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",I),f("Verifying identity...");let v=await Sc(I),H=await i(v);return H?.status==="Consented"&&H.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",H.customerId),pe.current=H.customerId,de(H.customerId),Tn=H.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",H?.status),!1)}catch(v){return console.warn("[reauthorizeLink] failed:",v?.message),false}},[i,k]),Um=useCallback(async(I=false,v,H)=>{let ee=v??ue;if(console.log("[collectPaymentMethod] called:",{useApplePay:I,amt:ee,amountOverride:v,sourceAmount:ue,hasSavedToken:!!H}),!ee||isNaN(Number(ee))||Number(ee)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),L("validation_error","Please enter a valid amount.");return}v&&Zt(v),b(true),E(),f("");try{let ge=await uo();if(ge.error){L("configuration_error",ge.error.message,ge.error.code);return}let lt;if(H)console.log("[collectPaymentMethod] using saved payment token"),lt=H;else if(I){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),L("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),y("session_params");return}f("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Lt={applePay:{merchantCountryCode:"US",currencyCode:me.toUpperCase(),cartItems:[{paymentType:PlatformPay.PaymentType.Immediate,label:`${xe.toUpperCase()} purchase + fees`,amount:ee}]}},ar=await g("PlatformPay",Lt);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!ar?.error),ar?.error){let Yr=ar.error.message??"",Jr=ar.error.code??"",Bt=/cancel/i.test(Yr)||/cancel/i.test(Jr);console.log("[collectPaymentMethod] pmResult error:",ar.error,"isCancellation:",Bt),Bt||(L("payment_error",Yr,Jr),y("session_params"));return}if(!ar?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}f("Creating payment token...");let rr=await T();if(console.log("[collectPaymentMethod] tokenResult ok:",!rr?.error),rr?.error){L("payment_error",rr.error.message,rr.error.code),y("session_params");return}lt=rr.cryptoPaymentToken;}else {f("Select a payment method...");let Lt=await g("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Lt?.error),Lt?.error){let Yr=Lt.error.message??"",Jr=Lt.error.code??"",Bt=/cancel/i.test(Yr)||/cancel/i.test(Jr);console.log("[collectPaymentMethod] pmResult error:",Lt.error,"isCancellation:",Bt),Bt||(L("payment_error",Yr,Jr),y("session_params"));return}if(!Lt?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let ar=Lt.displayData;console.log("[collectPaymentMethod] displayData:",{type:ar.type,label:ar.label,sublabel:ar.sublabel,hasIcon:!!ar.icon}),f("Creating payment token...");let rr=await T();if(console.log("[collectPaymentMethod] tokenResult ok:",!rr?.error),rr?.error){L("payment_error",rr.error.message,rr.error.code),y("session_params");return}lt=rr.cryptoPaymentToken;}f("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",ie,"walletAddressRef:",De.current);let ze=De.current||ie.toLowerCase(),pr=await Qt(Lt=>_u({cryptoCustomerId:pe.current,paymentToken:lt,sourceAmount:Number(ee),sourceCurrency:me,destinationCurrency:xe,walletAddress:ze,destinationNetwork:se},Lt));console.log("[collectPaymentMethod] session created:",pr?.id,"useApplePay:",I),fe(pr),f(""),I?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await Br(pr.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):y("quote");}catch(ge){console.log("[collectPaymentMethod] error caught:",ge?.message),L("session_error","Something went wrong. Please try again."),y("session_params");}finally{b(false),f("");}},[E,uo,g,T,xe,L,Br,Zt,ue,me,ie,se,Qt,e?.merchantIdentifier]),Hm=useCallback(async()=>{b(true),E(),f("Select a payment method...");try{let I=await uo();if(I.error)return L("configuration_error",I.error.message,I.error.code),null;let v=await g("Card");if(console.log("[addPaymentMethod] Card result ok:",!v?.error),v?.error?.message&&/no active link consumer/i.test(v.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await Nd())return L("authorization_error","Please verify your identity to add a payment method."),null;v=await g("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!v?.error);}if(v?.error){let ge=v.error.message??"",lt=v.error.code??"",ze=/cancel/i.test(ge)||/cancel/i.test(lt);return console.log("[addPaymentMethod] pmResult error:",v.error,"isCancellation:",ze),ze||L("payment_error",ge,lt),null}if(!v?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let H=v.displayData;console.log("[addPaymentMethod] displayData:",{type:H.type,label:H.label,sublabel:H.sublabel,hasIcon:!!H.icon}),f("Saving payment method...");let ee=await T();return console.log("[addPaymentMethod] tokenResult ok:",!ee?.error),ee?.error?(L("payment_error",ee.error.message,ee.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:ee.cryptoPaymentToken,sublabel:H.sublabel??""})}catch(I){return console.log("[addPaymentMethod] error:",I?.message),L("session_error",I?.message??String(I)),null}finally{b(false),f("");}},[E,uo,g,T,L,Nd]),Nm=useCallback(async()=>{if(pt){b(true),E(),f("");try{let I=await Qt(v=>Tc(pt.id,v));fe(I);}catch(I){console.log("[refreshQuote] error:",I?.message),L("session_error","Something went wrong. Please try again.");}finally{b(false);}}},[E,L,pt,Qt]),jm=useCallback(()=>{we.current=true,et.current=0,qt.current&&(clearTimeout(qt.current),qt.current=null),y(r),b(false),f(""),_(null),C(e?.email??""),A(e?.phone??""),O(""),N("US"),de(""),pe.current="",Le(""),Ie.current="",Y.current="",je(false),te(false),Z(Fu),Ge(e?.recipientAddress??""),De.current="",Xe.current=false,ne(Onramp.CryptoNetwork.ethereum),Zt(e?.defaultSourceAmount??"100"),ae(e?.defaultSourceCurrency??"usd"),Pt(e?.defaultDestinationCurrency??"usdc"),q(""),Rr(void 0),Gr(void 0),fe(null),Te.current+=1,at.current=false,We.current=false;},[e,r]);return {step:h,restoring:w,loading:S,status:p,error:x,email:k,phone:R,fullName:F,country:P,customerId:M,accessToken:Me,session:pt,kycData:Fe,walletAddress:ie,resolvedRecipientAddress:z,walletNetwork:se,sourceAmount:ue,sourceCurrency:me,destinationCurrency:xe,tokenIconUrl:tt,networkIconUrl:xt,applePaySupported:co,walletReady:ve,walletLoading:ye,setStep:y,setStatus:f,setEmail:C,setPhone:A,setFullName:O,setCountry:N,setWalletAddress:Ge,setWalletNetwork:ne,setSourceAmount:Zt,setSourceCurrency:ae,setDestinationCurrency:Pt,checkEmail:Q,register:le,attachKyc:wt,verifyIdentity:Lr,registerWallet:bs,collectPaymentMethod:Um,addPaymentMethod:Hm,refreshQuote:Nm,confirmCheckout:zm,reset:jm,clearError:E,emitComplete:Ir,resumeFulfillmentPolling:mo,amountFirst:t}}function Vu({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:m}){return r?jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:m}),jsxs(View,{style:e.flow.centered,children:[jsx(ft,{size:56,strokeWidth:3}),jsx(kr,{error:n,progress:a,loading:o})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:m}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your email"}),jsx(Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Email address"}),jsx(TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ft,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsx(Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(kr,{error:n,progress:a,loading:o})]})]})})}function Bu({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:a}),jsxs(View,{style:e.flow.centered,children:[t?jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(ft,{size:48,strokeWidth:3})}),jsx(Text,{style:e.flow.heading,children:"Verifying identity"}),jsx(Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsx(Text,{style:e.flow.heading,children:"Identity verification"}),jsx(Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsx(kr,{error:o,progress:r,loading:false})]}),!t&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsx(Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function Wu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:m,onRetryStatusCheck:d}){let{colors:g}=D(),T=!!t;return jsxs(View,{style:e.form.screen,children:[T?jsx(Xt,{onPress:m}):jsx(View,{style:Da}),jsx(View,{style:e.flow.centered,children:t?jsxs(Fragment,{children:[jsx(Text,{style:e.flow.heading,children:"Could not confirm status"}),jsx(Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(ft,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.primary})}),jsx(Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxs(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&&a&&i&&jsx(Va,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxs(View,{style:e.form.footer,children:[jsx(kr,{error:t,progress:r,loading:o}),t?jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:d,children:jsx(Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Eu({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:m}){let{colors:d}=D(),g=t.transaction_details,T=Pa(g.destination_amount,g.destination_currency);return jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:m??l,title:"Review your purchase",variant:m?"back":"close"}),jsxs(View,{style:e.form.content,children:[jsx(View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsx(hu,{currency:g.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxs(View,{style:e.quote.card,children:[jsx(fo,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsx(fo,{quote:e.quote,label:"You receive",value:`${T} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(fo,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsx(fo,{quote:e.quote,label:"Transaction fee",value:`$${g.fees.transaction_fee_amount}`,last:true})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ft,{size:28,strokeWidth:2,gradientFrom:d.primaryForeground,gradientTo:d.primaryForeground})}):jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsx(Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsx(kr,{error:o,progress:n,loading:r})]})]})}function Mu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:m}){let d=D();return t?jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:m}),jsxs(View,{style:e.flow.centered,children:[jsx(ft,{size:56,strokeWidth:3}),jsx(kr,{error:o,progress:n,loading:r})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:m}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your phone"}),jsx(Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Phone number"}),jsx(TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:d.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:g=>s(g.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsx(Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxs(View,{style:e.form.emailRow,children:[jsx(Text,{style:e.form.emailLabel,children:"Signing up as"}),jsx(Text,{style:e.form.emailValue,children:a})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ft,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsx(Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(kr,{error:o,progress:n,loading:r})]})]})})}function Ih({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=D(),n=e.toLowerCase(),a=Fa[n]??o.primary,i=Math.round(r*.36);return jsxs(View,{style:{width:r,height:r,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsx(View,{style:[Io.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsx(Text,{style:[Io.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsx(View,{style:[Io.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsx(qe,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function zu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:m}=D(),d=t.transaction_details,g=Pa(d.destination_amount,d.destination_currency),T=r||o||"";Oa(d.destination_network);return jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:i,title:"Purchase complete"}),jsx(View,{style:e.form.content,children:jsxs(ht,{style:e.form.flex,contentContainerStyle:Io.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Io.iconSection,children:[jsx(Ih,{currency:d.destination_currency,tokenIconUrl:n,size:72}),jsxs(View,{style:Io.statusRow,children:[jsx(View,{style:[Io.statusDot,{backgroundColor:s.success}]}),jsx(Text,{style:[Io.statusText,{color:s.foreground,fontFamily:m.semibold}],children:"Completed"})]}),jsx(Text,{style:[Io.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsx(Va,{sourceCurrency:d.source_currency,destinationCurrency:d.destination_currency,destinationNetwork:d.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxs(View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Io.detailCard],children:[jsx(fo,{quote:e.quote,label:"You Paid",value:`${d.source_amount} ${d.source_currency.toUpperCase()}`,hideDivider:true}),jsx(fo,{quote:e.quote,label:"You Received",value:`${g} ${d.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(fo,{quote:e.quote,label:"Network Fee",value:`$${d.fees.network_fee_amount}`,hideDivider:true}),jsx(fo,{quote:e.quote,label:"Transaction Fee",value:`$${d.fees.transaction_fee_amount}`,hideDivider:true}),jsx(fc,{quote:e.quote,label:"Intent Address",address:d.wallet_address,hideDivider:true}),T?jsx(fc,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsx(fo,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsx(Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var Io=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 Uu({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:m,registerWallet:d,onClose:g}){let{components:T}=D();if(t){let h=!r&&!!o;return jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:g}),jsxs(View,{style:e.flow.centered,children:[!h&&jsx(ft,{size:56,strokeWidth:3}),jsx(kr,{error:o,progress:n,loading:r})]}),h&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:d,children:jsx(Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(Xt,{onPress:g}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Your crypto wallet"}),jsx(Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsx(TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:T.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Network"}),jsx(View,{style:e.wallet.list,children:va.map(h=>{let y=i===h.value;return jsxs(TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(h.value),m(h.defaultCrypto);},children:[jsx(View,{style:e.wallet.iconWrap,children:jsx(h.Icon,{size:24})}),jsx(Text,{style:[e.wallet.rowText,y&&e.wallet.rowTextSelected],children:h.label}),y&&jsx(View,{style:e.wallet.checkCircle,children:jsx(qe,{size:14,color:T.container.buttonTitleColor,strokeWidth:2.5})})]},h.value)})})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(ft,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:d,disabled:!a,children:jsx(Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(kr,{error:o,progress:n,loading:r})]})]})})}function $a({config:e,onClose:t}){let r=D(),o=Bi(),{step:n,restoring:a,loading:i,status:s,error:l,email:m,phone:d,session:g,kycData:T,walletAddress:h,resolvedRecipientAddress:y,walletNetwork:w,sourceAmount:c,sourceCurrency:S,destinationCurrency:b,tokenIconUrl:p,networkIconUrl:f,applePaySupported:x,setStep:_,setEmail:k,setPhone:C,setWalletAddress:R,setWalletNetwork:A,setSourceAmount:F,setDestinationCurrency:O,checkEmail:P,register:N,attachKyc:M,verifyIdentity:de,registerWallet:Me,collectPaymentMethod:Le,addPaymentMethod:Y,confirmCheckout:Ie,reset:pe,emitComplete:ve,resumeFulfillmentPolling:je,amountFirst:ye,customerId:te,accessToken:Te}=za(e),at=!!e?.email,We=!!e?.phone,Xe=!!e?.publishableKey&&!!e?.externalUserId,[De,$e]=useState(void 0),[Ke,Fe]=useState([]);useEffect(()=>{if(n!=="session_params"||!te||!Te)return;console.log("[OnrampScreen] customerId:",te);let q=ne=>{let ue=ne?.message??"";return ue.includes("stripe_onramp_forbidden")||ue.includes("403")},se=ne=>{q(ne)&&(Sn(),pe());};Ma(te,Te).then(ne=>{console.log("[OnrampScreen] customer fetched, id:",ne?.id);}).catch(ne=>{console.warn("[OnrampScreen] customer fetch error:",ne?.message),se(ne);}),xc(te,Te).then(ne=>{console.log("[OnrampScreen] payment_tokens fetched, count:",ne.data?.length??0),Fe(ne.data??[]);}).catch(ne=>{console.warn("[OnrampScreen] payment_tokens error:",ne?.message),se(ne);}),console.log("[OnrampScreen] walletAddress:",h,"walletNetwork:",w),h&&(console.log("[OnrampScreen] calling getTransactionLimits..."),vu({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:Te,cryptoCustomerId:te}).then(ne=>{console.log("[OnrampScreen] transaction_limits fetched");let ue=ne.limits?.usd;if(ue?.card?.length){let Zt=Math.max(...ue.card.map(me=>me.limit));$e(Zt),console.log("[OnrampScreen] card max amount:",Zt);}}).catch(ne=>{console.warn("[OnrampScreen] transaction_limits error:",ne?.message),se(ne);}));},[n,te,Te,h,w,pe]);let Z=async()=>{if(!(!te||!Te))try{let q=await xc(te,Te);console.log("[OnrampScreen] payment_tokens refreshed, count:",q.data?.length??0),Fe(q.data??[]);}catch(q){console.warn("[OnrampScreen] payment_tokens refresh error:",q?.message);let se=q?.message??"";(se.includes("stripe_onramp_forbidden")||se.includes("403"))&&(Sn(),pe());}},ie=async()=>{let q=await Y();return q&&await Z(),q},Ge=e?.skipSuccessConfirmation===true;useEffect(()=>{n==="success"&&Ge&&g&&(ve(g),pe(),t?.());},[n,Ge,g,ve,pe,t]);let z=()=>{pe(),t?.();};return a?jsx(View,{style:[Vh.container,{backgroundColor:r.colors.background}],children:jsx(ft,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsx(Vu,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:at,loading:i,error:l,status:s,email:m,setEmail:k,checkEmail:P,onClose:z}):n==="register"?jsx(Mu,{styles:o,hasPrefilledPhone:We,loading:i,error:l,status:s,email:m,phone:d,setPhone:C,register:N,onClose:z}):n==="kyc"?jsx(Ba,{initialData:T,loading:i,onComplete:M,onCancel:()=>_("email")}):n==="identity"?jsx(Bu,{styles:o,loading:i,status:s,error:l,verifyIdentity:de,onClose:z}):n==="wallet"?jsx(Uu,{styles:o,hasAutoWallet:Xe,loading:i,error:l,status:s,walletAddress:h,walletNetwork:w,setWalletAddress:R,setWalletNetwork:A,setDestinationCurrency:O,registerWallet:Me,onClose:z}):n==="session_params"?jsx(La,{initialAmount:c,currency:S,applePaySupported:x,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:De,paymentTokens:Ke,onAddPaymentMethod:ie,onCollectPayment:(q,se)=>{Le(q,se);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(q,se)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:q,selectedMethod:se,amountFirst:ye}),ye&&!te)F(q),_("email");else {let ne=se==="apple_pay",ue=!ne&&se?se:void 0;console.log("[OnrampScreen] isApplePay:",ne,"hasSavedToken:",!!ue),Le(ne,q,ue);}},onCancel:z}):n==="quote"&&g?jsx(Eu,{styles:o,session:g,loading:i,error:l,status:s,confirmCheckout:Ie,tokenIconUrl:p,networkIconUrl:f,onClose:z,onBack:()=>_("session_params")}):n==="processing"?jsx(Wu,{styles:o,error:l,status:s,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??b,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:p,networkIconUrl:f,onClose:z,onRetryStatusCheck:je}):n==="success"&&g&&!Ge?jsx(zu,{styles:o,session:g,resolvedRecipientAddress:y,recipientFromConfig:e?.recipientAddress,tokenIconUrl:p,networkIconUrl:f,onDone:()=>{ve(g),pe(),t?.();}}):null}var Vh=StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function ju(){try{let e=Lh.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 a=n.trim();if(a.length>0)return a}}}catch{}}function qa({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:m,onError:d,onStepChange:g,onClose:T,merchantIdentifier:h="",urlScheme:y="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:c=false}){let{colors:S,fonts:b,components:p}=D(),f=e||ka(),x=useMemo(()=>{let F=h.trim();return F.length>0?F:ju()??""},[h]),[_,k]=useState("loading"),[C,R]=useState(null);useEffect(()=>{let F=false;async function O(){try{f&&(Aa(f),Wa(Is()));let P=await Ea();if(F)return;let N=x.trim();if(await initStripe({publishableKey:P,urlScheme:y,...N?{merchantIdentifier:N}:{}}),F)return;k("ready");}catch(P){if(F)return;console.error("[StripeOnramp] Init failed:",P),R(P?.message??"Failed to load Stripe configuration"),k("error");}}return O(),()=>{F=true;}},[f,x,y]);let A=useMemo(()=>{let F={publishableKey:f,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:m,onError:d,onStepChange:g};return s&&(F.destinationTokenAddress=s),l&&(F.recipientAddress=l),t&&(F.email=t),r&&(F.phone=r),n&&(F.flowOrder=n),w&&(F.paymentSelectorPosition=w),F.skipSuccessConfirmation=c,F.merchantIdentifier=x,F},[f,o,a,i,s,l,t,r,n,w,c,x,m,d,g]);return _==="error"?jsxs(View,{style:[zi.centered,{backgroundColor:S.background}],children:[jsx(Text,{style:[zi.errorText,{color:S.error,fontFamily:b.medium}],children:"Unable to initialize"}),jsx(Text,{style:[zi.errorDetail,{color:S.foregroundMuted,fontFamily:b.regular}],children:C}),T&&jsx(TouchableOpacity,{style:[zi.retryBtn,{backgroundColor:p.button.primaryBackground,borderRadius:p.button.borderRadius}],onPress:T,children:jsx(Text,{style:[zi.retryBtnText,{color:p.button.primaryText,fontFamily:b.medium}],children:"Go Back"})})]}):_==="loading"?jsx(View,{style:[zi.centered,{backgroundColor:S.background}],children:jsx(ft,{size:56,strokeWidth:3,gradientFrom:S.primary,gradientTo:S.primary})}):jsx($a,{config:A,onClose:T})}var zi=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 Ku(){let{configure:e}=useOnramp(),t=useRef(false);return 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 Gu="__unifold_stripe_onramp__";function Qa(e){globalThis[Gu]=e;}function Yu(){return globalThis[Gu]}Qa(qa);var vo=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 ei,Rn,Ui,Ju,Nh=(Ju=class extends vo{constructor(){super();J(this,ei);J(this,Rn);J(this,Ui);B(this,Ui,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){u(this,Rn)||this.setEventListener(u(this,Ui));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Rn))==null||t.call(this),B(this,Rn,void 0));}setEventListener(t){var r;B(this,Ui,t),(r=u(this,Rn))==null||r.call(this),B(this,Rn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){u(this,ei)!==t&&(B(this,ei,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof u(this,ei)=="boolean"?u(this,ei):globalThis.document?.visibilityState!=="hidden"}},ei=new WeakMap,Rn=new WeakMap,Ui=new WeakMap,Ju),Hi=new Nh;var jh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Po,ti,Zu,$h=(Zu=class{constructor(){J(this,Po,jh);J(this,ti,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&u(this,ti)&&e!==u(this,Po)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:u(this,Po),provider:e}),B(this,Po,e),process.env.NODE_ENV!=="production"&&B(this,ti,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&B(this,ti,true),u(this,Po).setTimeout(e,t)}clearTimeout(e){u(this,Po).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&B(this,ti,true),u(this,Po).setInterval(e,t)}clearInterval(e){u(this,Po).clearInterval(e);}},Po=new WeakMap,ti=new WeakMap,Zu),Oo=new $h;function Xu(e){setTimeout(e,0);}var Fc=typeof window>"u"||"Deno"in globalThis;function Yt(){}function rp(e,t){return typeof e=="function"?e(t):e}function Ms(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ga(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yo(e,t){return typeof e=="function"?e(t):e}function Pr(e,t){return typeof e=="function"?e(t):e}function Ya(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==zs(i,t.options))return false}else if(!ni(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function Ja(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(ri(t.options.mutationKey)!==ri(a))return false}else if(!ni(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function zs(e,t){return (t?.queryKeyHashFn||ri)(e)}function ri(e){return JSON.stringify(e,(t,r)=>Dc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ni(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ni(e[r],t[r])):false}var qh=Object.prototype.hasOwnProperty;function Ka(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=ep(e)&&ep(t);if(!o&&!(Dc(e)&&Dc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},m=0;for(let d=0;d<s;d++){let g=o?d:i[d],T=e[g],h=t[g];if(T===h){l[g]=T,(o?d<a:qh.call(e,g))&&m++;continue}if(T===null||h===null||typeof T!="object"||typeof h!="object"){l[g]=h;continue}let y=Ka(T,h,r+1);l[g]=y,y===T&&m++;}return a===s&&m===a?e:l}function Za(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 ep(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Dc(e){if(!tp(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!tp(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function tp(e){return Object.prototype.toString.call(e)==="[object Object]"}function op(e){return new Promise(t=>{Oo.setTimeout(t,e);})}function Us(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 Ka(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 Ka(e,t)}return t}function np(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function ip(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var oi=Symbol();function Xa(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===oi&&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===oi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function el(e,t){return typeof e=="function"?e(...t):!!e}function sp(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 Do=(()=>{let e=()=>Fc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Hs(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});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 ap=Xu;function Qh(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=ap,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var St=Qh();var Ni,In,ji,lp,Kh=(lp=class extends vo{constructor(){super();J(this,Ni,true);J(this,In);J(this,ji);B(this,ji,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(){u(this,In)||this.setEventListener(u(this,ji));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,In))==null||t.call(this),B(this,In,void 0));}setEventListener(t){var r;B(this,ji,t),(r=u(this,In))==null||r.call(this),B(this,In,t(this.setOnline.bind(this)));}setOnline(t){u(this,Ni)!==t&&(B(this,Ni,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return u(this,Ni)}},Ni=new WeakMap,In=new WeakMap,ji=new WeakMap,lp),$i=new Kh;function Gh(e){return Math.min(1e3*2**e,3e4)}function Vc(e){return (e??"online")==="online"?$i.isOnline():true}var tl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function rl(e){let t=false,r=0,o,n=Hs(),a=()=>n.status!=="pending",i=w=>{if(!a()){let c=new tl(w);T(c),e.onCancel?.(c);}},s=()=>{t=true;},l=()=>{t=false;},m=()=>Hi.isFocused()&&(e.networkMode==="always"||$i.isOnline())&&e.canRun(),d=()=>Vc(e.networkMode)&&e.canRun(),g=w=>{a()||(o?.(),n.resolve(w));},T=w=>{a()||(o?.(),n.reject(w));},h=()=>new Promise(w=>{o=c=>{(a()||m())&&w(c);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),y=()=>{if(a())return;let w,c=r===0?e.initialPromise:void 0;try{w=c??e.fn();}catch(S){w=Promise.reject(S);}Promise.resolve(w).then(g).catch(S=>{if(a())return;let b=e.retry??(Do.isServer()?0:3),p=e.retryDelay??Gh,f=typeof p=="function"?p(r,S):p,x=b===true||typeof b=="number"&&r<b||typeof b=="function"&&b(r,S);if(t||!x){T(S);return}r++,e.onFail?.(r,S),op(f).then(()=>m()?void 0:h()).then(()=>{t?T(S):y();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:d,start:()=>(d()?y():h().then(y),n)}}var ii,cp,ol=(cp=class{constructor(){J(this,ii);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ms(this.gcTime)&&B(this,ii,Oo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Do.isServer()?1/0:300*1e3));}clearGcTimeout(){u(this,ii)!==void 0&&(Oo.clearTimeout(u(this,ii)),B(this,ii,void 0));}},ii=new WeakMap,cp);var si,qi,io,ai,nr,Ns,li,$r,fp,Jo,pp,mp=(pp=class extends ol{constructor(t){super();J(this,$r);J(this,si);J(this,qi);J(this,io);J(this,ai);J(this,nr);J(this,Ns);J(this,li);B(this,li,false),B(this,Ns,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,ai,t.client),B(this,io,u(this,ai).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,si,up(this.options)),this.state=t.state??u(this,si),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return u(this,nr)?.promise}setOptions(t){if(this.options={...u(this,Ns),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=up(this.options);r.data!==void 0&&(this.setState(dp(r.data,r.dataUpdatedAt)),B(this,si,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&u(this,io).remove(this);}setData(t,r){let o=Us(this.state.data,t,this.options);return Be(this,$r,Jo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Be(this,$r,Jo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=u(this,nr)?.promise;return u(this,nr)?.cancel(t),r?r.then(Yt).catch(Yt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return u(this,si)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Pr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===oi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yo(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:!Ga(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),u(this,nr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),u(this,nr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),u(this,io).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(u(this,nr)&&(u(this,li)||Be(this,$r,fp).call(this)?u(this,nr).cancel({revert:true}):u(this,nr).cancelRetry()),this.scheduleGc()),u(this,io).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Be(this,$r,Jo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&u(this,nr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(u(this,nr))return u(this,nr).continueRetry(),u(this,nr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(m=>m.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(B(this,li,true),o.signal)});},a=()=>{let l=Xa(this.options,r),d=(()=>{let g={client:u(this,ai),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return B(this,li,false),this.options.persister?this.options.persister(l,d,this):l(d)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:u(this,ai),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),B(this,qi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Be(this,$r,Jo).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),B(this,nr,rl({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof tl&&l.revert&&this.setState({...u(this,qi),fetchStatus:"idle"}),o.abort();},onFail:(l,m)=>{Be(this,$r,Jo).call(this,{type:"failed",failureCount:l,error:m});},onPause:()=>{Be(this,$r,Jo).call(this,{type:"pause"});},onContinue:()=>{Be(this,$r,Jo).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await u(this,nr).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),u(this,io).config.onSuccess?.(l,this),u(this,io).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof tl){if(l.silent)return u(this,nr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Be(this,$r,Jo).call(this,{type:"error",error:l}),u(this,io).config.onError?.(l,this),u(this,io).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},si=new WeakMap,qi=new WeakMap,io=new WeakMap,ai=new WeakMap,nr=new WeakMap,Ns=new WeakMap,li=new WeakMap,$r=new WeakSet,fp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Jo=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,...Lc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...dp(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,qi,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),St.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),u(this,io).notify({query:this,type:"updated",action:t});});},pp);function Lc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function dp(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function up(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 Or,Ue,$s,Tr,ci,Qi,Zo,vn,qs,Ki,Gi,di,ui,Pn,Yi,nt,js,Bc,Ac,Wc,Ec,Mc,zc,Uc,bp,yp,Nc=(yp=class extends vo{constructor(t,r){super();J(this,nt);J(this,Or);J(this,Ue);J(this,$s);J(this,Tr);J(this,ci);J(this,Qi);J(this,Zo);J(this,vn);J(this,qs);J(this,Ki);J(this,Gi);J(this,di);J(this,ui);J(this,Pn);J(this,Yi,new Set);this.options=r,B(this,Or,t),B(this,vn,null),B(this,Zo,Hs()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(u(this,Ue).addObserver(this),hp(u(this,Ue),this.options)?Be(this,nt,js).call(this):this.updateResult(),Be(this,nt,Ec).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Hc(u(this,Ue),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hc(u(this,Ue),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Be(this,nt,Mc).call(this),Be(this,nt,zc).call(this),u(this,Ue).removeObserver(this);}setOptions(t){let r=this.options,o=u(this,Ue);if(this.options=u(this,Or).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pr(this.options.enabled,u(this,Ue))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Be(this,nt,Uc).call(this),u(this,Ue).setOptions(this.options),r._defaulted&&!Za(this.options,r)&&u(this,Or).getQueryCache().notify({type:"observerOptionsUpdated",query:u(this,Ue),observer:this});let n=this.hasListeners();n&&gp(u(this,Ue),o,this.options,r)&&Be(this,nt,js).call(this),this.updateResult(),n&&(u(this,Ue)!==o||Pr(this.options.enabled,u(this,Ue))!==Pr(r.enabled,u(this,Ue))||yo(this.options.staleTime,u(this,Ue))!==yo(r.staleTime,u(this,Ue)))&&Be(this,nt,Bc).call(this);let a=Be(this,nt,Ac).call(this);n&&(u(this,Ue)!==o||Pr(this.options.enabled,u(this,Ue))!==Pr(r.enabled,u(this,Ue))||a!==u(this,Pn))&&Be(this,nt,Wc).call(this,a);}getOptimisticResult(t){let r=u(this,Or).getQueryCache().build(u(this,Or),t),o=this.createResult(r,t);return Jh(this,o)&&(B(this,Tr,o),B(this,Qi,this.options),B(this,ci,u(this,Ue).state)),o}getCurrentResult(){return u(this,Tr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&u(this,Zo).status==="pending"&&u(this,Zo).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){u(this,Yi).add(t);}getCurrentQuery(){return u(this,Ue)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=u(this,Or).defaultQueryOptions(t),o=u(this,Or).getQueryCache().build(u(this,Or),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Be(this,nt,js).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),u(this,Tr)))}createResult(t,r){let o=u(this,Ue),n=this.options,a=u(this,Tr),i=u(this,ci),s=u(this,Qi),m=t!==o?t.state:u(this,$s),{state:d}=t,g={...d},T=false,h;if(r._optimisticResults){let R=this.hasListeners(),A=!R&&hp(t,r),F=R&&gp(t,o,r,n);(A||F)&&(g={...g,...Lc(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:y,errorUpdatedAt:w,status:c}=g;h=g.data;let S=false;if(r.placeholderData!==void 0&&h===void 0&&c==="pending"){let R;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(R=a.data,S=true):R=typeof r.placeholderData=="function"?r.placeholderData(u(this,Gi)?.state.data,u(this,Gi)):r.placeholderData,R!==void 0&&(c="success",h=Us(a?.data,R,r),T=true);}if(r.select&&h!==void 0&&!S)if(a&&h===i?.data&&r.select===u(this,qs))h=u(this,Ki);else try{B(this,qs,r.select),h=r.select(h),h=Us(a?.data,h,r),B(this,Ki,h),B(this,vn,null);}catch(R){B(this,vn,R);}u(this,vn)&&(y=u(this,vn),h=u(this,Ki),w=Date.now(),c="error");let b=g.fetchStatus==="fetching",p=c==="pending",f=c==="error",x=p&&b,_=h!==void 0,C={status:c,fetchStatus:g.fetchStatus,isPending:p,isSuccess:c==="success",isError:f,isInitialLoading:x,isLoading:x,data:h,dataUpdatedAt:g.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:b,isRefetching:b&&!p,isLoadingError:f&&!_,isPaused:g.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:f&&_,isStale:jc(t,r),refetch:this.refetch,promise:u(this,Zo),isEnabled:Pr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let R=C.data!==void 0,A=C.status==="error"&&!R,F=N=>{A?N.reject(C.error):R&&N.resolve(C.data);},O=()=>{let N=B(this,Zo,C.promise=Hs());F(N);},P=u(this,Zo);switch(P.status){case "pending":t.queryHash===o.queryHash&&F(P);break;case "fulfilled":(A||C.data!==P.value)&&O();break;case "rejected":(!A||C.error!==P.reason)&&O();break}}return C}updateResult(){let t=u(this,Tr),r=this.createResult(u(this,Ue),this.options);if(B(this,ci,u(this,Ue).state),B(this,Qi,this.options),u(this,ci).data!==void 0&&B(this,Gi,u(this,Ue)),Za(r,t))return;B(this,Tr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!u(this,Yi).size)return true;let i=new Set(a??u(this,Yi));return this.options.throwOnError&&i.add("error"),Object.keys(u(this,Tr)).some(s=>{let l=s;return u(this,Tr)[l]!==t[l]&&i.has(l)})};Be(this,nt,bp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Be(this,nt,Ec).call(this);}},Or=new WeakMap,Ue=new WeakMap,$s=new WeakMap,Tr=new WeakMap,ci=new WeakMap,Qi=new WeakMap,Zo=new WeakMap,vn=new WeakMap,qs=new WeakMap,Ki=new WeakMap,Gi=new WeakMap,di=new WeakMap,ui=new WeakMap,Pn=new WeakMap,Yi=new WeakMap,nt=new WeakSet,js=function(t){Be(this,nt,Uc).call(this);let r=u(this,Ue).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Yt)),r},Bc=function(){Be(this,nt,Mc).call(this);let t=yo(this.options.staleTime,u(this,Ue));if(Do.isServer()||u(this,Tr).isStale||!Ms(t))return;let o=Ga(u(this,Tr).dataUpdatedAt,t)+1;B(this,di,Oo.setTimeout(()=>{u(this,Tr).isStale||this.updateResult();},o));},Ac=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(u(this,Ue)):this.options.refetchInterval)??false},Wc=function(t){Be(this,nt,zc).call(this),B(this,Pn,t),!(Do.isServer()||Pr(this.options.enabled,u(this,Ue))===false||!Ms(u(this,Pn))||u(this,Pn)===0)&&B(this,ui,Oo.setInterval(()=>{(this.options.refetchIntervalInBackground||Hi.isFocused())&&Be(this,nt,js).call(this);},u(this,Pn)));},Ec=function(){Be(this,nt,Bc).call(this),Be(this,nt,Wc).call(this,Be(this,nt,Ac).call(this));},Mc=function(){u(this,di)!==void 0&&(Oo.clearTimeout(u(this,di)),B(this,di,void 0));},zc=function(){u(this,ui)!==void 0&&(Oo.clearInterval(u(this,ui)),B(this,ui,void 0));},Uc=function(){let t=u(this,Or).getQueryCache().build(u(this,Or),this.options);if(t===u(this,Ue))return;let r=u(this,Ue);B(this,Ue,t),B(this,$s,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},bp=function(t){St.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(u(this,Tr));}),u(this,Or).getQueryCache().notify({query:u(this,Ue),type:"observerResultsUpdated"});});},yp);function Yh(e,t){return Pr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function hp(e,t){return Yh(e,t)||e.state.data!==void 0&&Hc(e,t,t.refetchOnMount)}function Hc(e,t,r){if(Pr(t.enabled,e)!==false&&yo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&jc(e,t)}return false}function gp(e,t,r,o){return (e!==t||Pr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&jc(e,r)}function jc(e,t){return Pr(t.enabled,e)!==false&&e.isStaleByTime(yo(t.staleTime,e))}function Jh(e,t){return !Za(e.getCurrentResult(),t)}function $c(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,m=async()=>{let d=false,g=y=>{sp(y,()=>t.signal,()=>d=true);},T=Xa(t.options,t.fetchOptions),h=async(y,w,c)=>{if(d)return Promise.reject();if(w==null&&y.pages.length)return Promise.resolve(y);let b=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:c?"backward":"forward",meta:t.options.meta};return g(_),_})(),p=await T(b),{maxPages:f}=t.options,x=c?ip:np;return {pages:x(y.pages,p,f),pageParams:x(y.pageParams,w,f)}};if(n&&a.length){let y=n==="backward",w=y?Zh:Cp,c={pages:a,pageParams:i},S=w(o,c);s=await h(c,S,y);}else {let y=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:Cp(o,s);if(l>0&&w==null)break;s=await h(s,w),l++;}while(l<y)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=m;}}}function Cp(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 Zh(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Qs,Fo,gr,pi,Vo,On,wp,Sp=(wp=class extends ol{constructor(t){super();J(this,Vo);J(this,Qs);J(this,Fo);J(this,gr);J(this,pi);B(this,Qs,t.client),this.mutationId=t.mutationId,B(this,gr,t.mutationCache),B(this,Fo,[]),this.state=t.state||Xh(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){u(this,Fo).includes(t)||(u(this,Fo).push(t),this.clearGcTimeout(),u(this,gr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){B(this,Fo,u(this,Fo).filter(r=>r!==t)),this.scheduleGc(),u(this,gr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){u(this,Fo).length||(this.state.status==="pending"?this.scheduleGc():u(this,gr).remove(this));}continue(){return u(this,pi)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Be(this,Vo,On).call(this,{type:"continue"});},o={client:u(this,Qs),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,pi,rl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Be(this,Vo,On).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Be(this,Vo,On).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(this,gr).canRun(this)}));let n=this.state.status==="pending",a=!u(this,pi).canStart();try{if(n)r();else {Be(this,Vo,On).call(this,{type:"pending",variables:t,isPaused:a}),u(this,gr).config.onMutate&&await u(this,gr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Be(this,Vo,On).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await u(this,pi).start();return await u(this,gr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await u(this,gr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Be(this,Vo,On).call(this,{type:"success",data:i}),i}catch(i){try{await u(this,gr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await u(this,gr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Be(this,Vo,On).call(this,{type:"error",error:i}),i}finally{u(this,gr).runNext(this);}}},Qs=new WeakMap,Fo=new WeakMap,gr=new WeakMap,pi=new WeakMap,Vo=new WeakSet,On=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),St.batch(()=>{u(this,Fo).forEach(o=>{o.onMutationUpdate(t);}),u(this,gr).notify({mutation:this,type:"updated",action:t});});},wp);function Xh(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Xo,bo,Ks,kp,Tp=(kp=class extends vo{constructor(t={}){super();J(this,Xo);J(this,bo);J(this,Ks);this.config=t,B(this,Xo,new Set),B(this,bo,new Map),B(this,Ks,0);}build(t,r,o){let n=new Sp({client:t,mutationCache:this,mutationId:++Cs(this,Ks)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){u(this,Xo).add(t);let r=nl(t);if(typeof r=="string"){let o=u(this,bo).get(r);o?o.push(t):u(this,bo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(u(this,Xo).delete(t)){let r=nl(t);if(typeof r=="string"){let o=u(this,bo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&u(this,bo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=nl(t);if(typeof r=="string"){let n=u(this,bo).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=nl(t);return typeof r=="string"?u(this,bo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){St.batch(()=>{u(this,Xo).forEach(t=>{this.notify({type:"removed",mutation:t});}),u(this,Xo).clear(),u(this,bo).clear();});}getAll(){return Array.from(u(this,Xo))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ja(r,o))}findAll(t={}){return this.getAll().filter(r=>Ja(t,r))}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return St.batch(()=>Promise.all(t.map(r=>r.continue().catch(Yt))))}},Xo=new WeakMap,bo=new WeakMap,Ks=new WeakMap,kp);function nl(e){return e.options.scope?.id}var Lo,xp,_p=(xp=class extends vo{constructor(t={}){super();J(this,Lo);this.config=t,B(this,Lo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??zs(n,r),i=this.get(a);return i||(i=new mp({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){u(this,Lo).has(t.queryHash)||(u(this,Lo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=u(this,Lo).get(t.queryHash);r&&(t.destroy(),r===t&&u(this,Lo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){St.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return u(this,Lo).get(t)}getAll(){return [...u(this,Lo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ya(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Ya(t,o)):r}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){St.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){St.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Lo=new WeakMap,xp);var zt,Dn,Fn,Ji,Zi,Vn,Xi,es,Rp,qc=(Rp=class{constructor(e={}){J(this,zt);J(this,Dn);J(this,Fn);J(this,Ji);J(this,Zi);J(this,Vn);J(this,Xi);J(this,es);B(this,zt,e.queryCache||new _p),B(this,Dn,e.mutationCache||new Tp),B(this,Fn,e.defaultOptions||{}),B(this,Ji,new Map),B(this,Zi,new Map),B(this,Vn,0);}mount(){Cs(this,Vn)._++,u(this,Vn)===1&&(B(this,Xi,Hi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,zt).onFocus());})),B(this,es,$i.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,zt).onOnline());})));}unmount(){var e,t;Cs(this,Vn)._--,u(this,Vn)===0&&((e=u(this,Xi))==null||e.call(this),B(this,Xi,void 0),(t=u(this,es))==null||t.call(this),B(this,es,void 0));}isFetching(e){return u(this,zt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return u(this,Dn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,zt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=u(this,zt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(yo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return u(this,zt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=u(this,zt).get(o.queryHash)?.state.data,i=rp(t,a);if(i!==void 0)return u(this,zt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return St.batch(()=>u(this,zt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,zt).get(t.queryHash)?.state}removeQueries(e){let t=u(this,zt);St.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=u(this,zt);return St.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=St.batch(()=>u(this,zt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Yt).catch(Yt)}invalidateQueries(e,t={}){return St.batch(()=>(u(this,zt).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=St.batch(()=>u(this,zt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(Yt)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(Yt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=u(this,zt).build(this,t);return r.isStaleByTime(yo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yt).catch(Yt)}fetchInfiniteQuery(e){return e.behavior=$c(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yt).catch(Yt)}ensureInfiniteQueryData(e){return e.behavior=$c(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return $i.isOnline()?u(this,Dn).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(this,zt)}getMutationCache(){return u(this,Dn)}getDefaultOptions(){return u(this,Fn)}setDefaultOptions(e){B(this,Fn,e);}setQueryDefaults(e,t){u(this,Ji).set(ri(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...u(this,Ji).values()],r={};return t.forEach(o=>{ni(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){u(this,Zi).set(ri(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...u(this,Zi).values()],r={};return t.forEach(o=>{ni(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(this,Fn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=zs(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===oi&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(this,Fn).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){u(this,zt).clear(),u(this,Dn).clear();}},zt=new WeakMap,Dn=new WeakMap,Fn=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,Vn=new WeakMap,Xi=new WeakMap,es=new WeakMap,Rp);var Qc=Ln.createContext(void 0),Kc=e=>{let t=Ln.useContext(Qc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gc=({client:e,children:t})=>(Ln.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsx(Qc.Provider,{value:e,children:t}));var Ip=Ln.createContext(false),vp=()=>Ln.useContext(Ip);Ip.Provider;function tg(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var rg=Ln.createContext(tg()),Pp=()=>Ln.useContext(rg);var Dp=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?el(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Fp=e=>{Ln.useEffect(()=>{e.clearReset();},[e]);},Vp=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||el(r,[e.error,o]));var Lp=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));}},Bp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ap=(e,t)=>e?.suspense&&t.isPending,Yc=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Wp(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=vp(),n=Pp(),a=Kc(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",Lp(i),Dp(i,n,s),Fp(n);let l=!a.getQueryCache().get(i.queryHash),[m]=Ln.useState(()=>new t(a,i)),d=m.getOptimisticResult(i),g=!o&&e.subscribed!==false;if(Ln.useSyncExternalStore(Ln.useCallback(T=>{let h=g?m.subscribe(St.batchCalls(T)):Yt;return m.updateResult(),h},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),Ln.useEffect(()=>{m.setOptions(i);},[i,m]),Ap(i,d))throw Yc(i,m,n);if(Vp({result:d,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!Do.isServer()&&Bp(d,o)&&(l?Yc(i,m,n):s?.promise)?.catch(Yt).finally(()=>{m.updateResult();}),i.notifyOnChangeProps?d:m.trackResult(d)}function en(e,t){return Wp(e,Nc)}var os=new Map;function Ep({width:e,height:t,borderRadius:r,color:o}){let n=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let a=Animated.loop(Animated.sequence([Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return a.start(),()=>a.stop()},[n]),jsx(Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function An({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=D(),[m,d]=useState(false),[g,T]=useState(false),[h,y]=useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=os.get(e);return x?{uri:e,xml:x}:null}),w=e?.toLowerCase().endsWith(".svg"),c=w&&e&&h?.uri===e?h.xml:null;useEffect(()=>{d(false),T(false);},[e]),useEffect(()=>{if(!w||!e)return;if(os.has(e)){y({uri:e,xml:os.get(e)});return}let x=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{x||(os.set(e,_),y({uri:e,xml:_}));}).catch(()=>{x||d(true);}),()=>{x=true;}},[e,w]);let S=l.card;if(!e)return jsx(View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:S},s]});let b={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},p=t-n*2,f=r-n*2;return m?jsx(View,{style:[b,{backgroundColor:i||S}]}):w?jsxs(View,{style:b,children:[!!!c&&jsx(Ep,{width:p,height:f,borderRadius:o,color:S}),c?jsx(SvgXml,{xml:c,width:p,height:f,onError:()=>d(true)}):jsx(SvgUri,{uri:e,width:p,height:f,onError:()=>d(true)})]}):jsxs(View,{style:b,children:[!g&&jsx(Ep,{width:p,height:f,borderRadius:o,color:S}),jsx(Image,{source:{uri:e,cache:"force-cache"},style:{width:p,height:f},resizeMode:"contain",onLoad:()=>T(true),onError:()=>d(true)})]})}function Xc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(os.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{os.set(r,o);}).catch(()=>{}));}else t.push(Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function xr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:m,balanceChainId:d,balanceTokenAddress:g,publishableKey:T,projectName:h,leftIcon:y,onLeftAction:w}){let{colors:c,fonts:S,components:b}=D(),[p,f]=useState(null),[x,_]=useState(false),k=useState(()=>new Animated.Value(0))[0];useEffect(()=>{if(!x)return;let R=Animated.loop(Animated.sequence([Animated.timing(k,{toValue:1,duration:700,useNativeDriver:true}),Animated.timing(k,{toValue:0,duration:700,useNativeDriver:true})]));return R.start(),()=>R.stop()},[x,k]),useEffect(()=>{if(!s||!l||!m||!d||!g||!T){f(null),_(false);return}let R=false;return _(true),Ia(l,m,d,g,T).then(A=>{if(R)return;let F=A.balance,O=null;F&&(F.amount_usd!=null&&F.amount_usd!==""?O=`$${F.amount_usd}`:O="$0.00"),f(O);}).catch(()=>{R||f(null);}).finally(()=>{R||_(false);}),()=>{R=true;}},[s,l,m,d,g,T]);let C=k.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxs(View,{style:yr.header,children:[jsx(View,{style:yr.leftContainer,children:r&&n?jsx(TouchableOpacity,{onPress:n,style:[yr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ss,{size:20,color:b.header.buttonColor,strokeWidth:2})}):y&&w?jsx(TouchableOpacity,{onPress:w,style:[yr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:y}):jsx(View,{style:yr.spacer})}),jsxs(View,{style:yr.titleContainer,children:[jsxs(View,{style:yr.titleRow,children:[jsx(Text,{style:[yr.title,{color:b.header.titleColor,fontFamily:S.medium}],children:e}),i&&i.count>0&&jsx(View,{style:[yr.titleBadge,{backgroundColor:c.card}],children:jsx(Text,{style:[yr.titleBadgeText,{color:c.foregroundMuted,fontFamily:S.regular}],children:i.count})})]}),t?jsx(Text,{style:[yr.balanceText,{color:c.foregroundMuted,fontFamily:S.regular}],children:t}):null,s&&(x?jsx(Animated.View,{style:[yr.balanceSkeleton,{backgroundColor:c.cardHover,opacity:C}]}):p!=null?jsxs(Text,{style:[yr.balanceText,{color:c.foregroundMuted,fontFamily:S.regular}],children:[h?`${h} `:"","Balance: ",p]}):null)]}),jsx(View,{style:yr.rightContainer,children:o?jsx(TouchableOpacity,{onPress:a,style:[yr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(rt,{size:20,color:b.header.buttonColor,strokeWidth:2})}):jsx(View,{style:yr.spacer})})]})}var yr=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 Jt({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=D(),s=a??i.card,l=s.backShadowColor!=="transparent",m={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},d=[Hp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],g=[m,r];return jsxs(View,{style:d,children:[l&&jsx(View,{style:[Hp.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsx(TouchableOpacity$1,{onPress:o,activeOpacity:n,style:g,children:e}):jsx(View,{style:g,children:e})]})}var Hp=StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ys({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card,s=o?[...o].sort((l,m)=>l.position-m.position):[];return jsxs(Jt,{cardTokens:i,onPress:e,style:Bo.wrapper,contentStyle:Bo.container,children:[jsxs(View,{style:Bo.leftContent,children:[jsx(View,{style:[Bo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(Jl,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:Bo.textContainer,children:[jsx(Text,{style:[Bo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[Bo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:Bo.rightContent,children:jsx(View,{style:Bo.networkIcons,children:s.map((l,m)=>{let d=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsx(View,{style:[Bo.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:s.length-m}],children:jsx(An,{uri:X(d),width:20,height:20})},l.name)})})})]})}var Bo=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 Zs({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsxs(Jt,{cardTokens:i,onPress:e,style:tn.wrapper,contentStyle:tn.container,children:[jsxs(View,{style:tn.leftContent,children:[jsx(View,{style:[tn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(Ri,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:tn.textContainer,children:[jsx(Text,{style:[tn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[tn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:tn.rightContent,children:jsx(View,{style:tn.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(m=>m.format==="png")?.url||s.icon_urls.find(m=>m.format==="svg")?.url;return jsx(An,{uri:X(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var tn=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 Xs({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsx(Jt,{cardTokens:i,onPress:e,style:rn.wrapper,contentStyle:rn.container,children:jsxs(View,{style:rn.leftContent,children:[jsxs(View,{style:[rn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsx(So,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsx(View,{style:[rn.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsx(Text,{style:[rn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxs(View,{style:rn.textContainer,children:[jsx(Text,{style:[rn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[rn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var rn=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 ta({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=D(),a=n.depositMenu.card;return jsxs(Jt,{cardTokens:a,onPress:e,style:Ao.wrapper,contentStyle:Ao.container,children:[jsxs(View,{style:Ao.leftContent,children:[jsx(View,{style:[Ao.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsx(ba,{size:20,color:a.iconColor,strokeWidth:2})}),jsxs(View,{style:Ao.textContainer,children:[jsx(Text,{style:[Ao.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsx(Text,{style:[Ao.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsx(View,{style:Ao.rightContent,children:jsx(View,{style:Ao.badge,children:jsx(Text,{style:[Ao.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Ao=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 qp=1e4,Qp=2500,Kp=3e3,Gp=6e4;function ra(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:m,setDepositExecutions:d,setTrackedExecutions:g,setLatestExecution:T,setShowStatusSheet:h,onDepositSuccess:y,onExecutionsChange:w,onDepositError:c}=e,[S,b]=useState(false),[p,f]=useState(false);return useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;b(false),t==="auto_ui"&&f(false);let _=setTimeout(()=>{b(true),t==="auto_ui"&&f(true);},qp);return ()=>clearTimeout(_)},[t,r,o]),useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-Gp),k=setInterval(async()=>{try{let A=[...(await Qo(n,a)).data??[]].sort((O,P)=>{let N=O.created_at?new Date(O.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-N}),F=null;for(let O of A){let P=O.created_at?new Date(O.created_at):null;if(!P||P<=_)continue;let N=m.get(O.id);if(!N){F=O;break}if(["pending","waiting","delayed"].includes(N)&&O.status==="succeeded"){F=O;break}}if(F){let O=F;d(P=>{let N=P.findIndex(M=>M.id===O.id);if(N>=0){let M=[...P];return M[N]=O,M}return [...P,O]}),g(P=>{let N=new Map(P);return N.set(O.id,O.status),N}),T(O),h(!0),O.status==="succeeded"&&y?.({message:"Deposit completed successfully",executionId:O.id}),w?.([...l,O]);}}catch(C){c?.({message:"Failed to check deposit status",error:C});}},Qp);return ()=>clearInterval(k)},[n,a,i,m,l,w,y,c]),useEffect(()=>{if(!S||!s)return;let _=async()=>{try{await Ta(s,a);}catch{}};_();let k=setInterval(_,Kp);return ()=>clearInterval(k)},[S,s,a]),{pollingEnabled:S,showWaitingUi:p,handleIveDeposited:()=>{b(true),f(true);}}}function as({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=D(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",m=n||s;return jsxs(View,{style:[Jp.container,{width:t,height:t}],children:[jsx(hg,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsx(View,{style:[Jp.logoContainer,{width:o+12,height:o+12,backgroundColor:m,borderRadius:(o+12)/2}],children:jsx(An,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var Jp=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function em(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Cg(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function ls({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:m}){let{colors:d,fonts:g,components:T}=D(),[h,y]=useState(false),w=t==="pending"||t==="waiting"||t==="delayed",c=t==="succeeded",S=()=>{o&&Linking.openURL(o);},b=()=>{n&&Linking.openURL(n);};return jsx(ct,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:m,children:jsxs(View,{style:Dt.container,children:[jsx(TouchableOpacity,{style:Dt.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(rt,{size:20,color:T.header.buttonColor,strokeWidth:2})}),jsx(View,{style:Dt.iconContainer,children:w?jsx(ft,{size:80,strokeWidth:4,iconSize:68,children:r?jsx(Image,{source:{uri:X(r)},style:Dt.tokenIconFill}):jsx(View,{style:[Dt.tokenIconFill,{backgroundColor:d.cardHover}]})}):jsxs(Fragment,{children:[r?jsx(Image,{source:{uri:X(r)},style:Dt.tokenIconLarge}):jsx(View,{style:[Dt.tokenIconLarge,{backgroundColor:d.cardHover}]}),jsx(View,{style:[Dt.statusBadge,{backgroundColor:T.container.iconBackgroundColor}],children:jsx(qe,{size:16,color:T.container.iconColor,strokeWidth:3})})]})}),jsx(Text,{style:[Dt.title,{color:T.container.titleColor,fontFamily:g.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxs(Text,{style:[Dt.amount,{color:T.container.titleColor,fontFamily:g.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsx(Text,{style:[Dt.date,{color:T.container.subtitleColor,fontFamily:g.regular}],children:Cg(a)}),jsx(Text,{style:[Dt.subtitle,{color:T.container.subtitleColor,fontFamily:g.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),c&&(o||n)&&jsxs(View,{style:Dt.detailsSection,children:[jsx(View,{style:[Dt.divider,{backgroundColor:d.border}]}),jsxs(TouchableOpacity,{style:Dt.detailsToggle,onPress:()=>y(!h),children:[jsx(Text,{style:[Dt.detailsToggleText,{color:T.container.actionTitle,fontFamily:g.medium}],children:h?"See less":"See more details"}),h?jsx(To,{size:18,color:T.container.actionColor,strokeWidth:2}):jsx(Ot,{size:18,color:T.container.actionColor,strokeWidth:2})]}),h&&jsxs(View,{style:Dt.txButtonsContainer,children:[o&&jsxs(TouchableOpacity,{style:[Dt.txButton,{backgroundColor:T.card.backgroundColor,borderColor:d.border}],onPress:S,children:[jsx(Text,{style:[Dt.txLabel,{color:T.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsx(Text,{style:[Dt.txHash,{color:T.card.subtitleColor,fontFamily:g.regular}],children:em(o)}),jsx(ko,{size:16,color:T.card.actionColor,strokeWidth:2})]}),n&&jsxs(TouchableOpacity,{style:[Dt.txButton,{backgroundColor:T.card.backgroundColor,borderColor:d.border}],onPress:b,children:[jsx(Text,{style:[Dt.txLabel,{color:T.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsx(Text,{style:[Dt.txHash,{color:T.card.subtitleColor,fontFamily:g.regular}],children:em(n)}),jsx(ko,{size:16,color:T.card.actionColor,strokeWidth:2})]})]})]})]})})}var Dt=StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function ul({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=D();return jsxs(Fragment,{children:[e==="manual"&&t&&!r&&jsx(TouchableOpacity,{onPress:n,activeOpacity:.8,style:[hi.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsx(Text,{style:[hi.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxs(View,{style:[hi.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsx(View,{style:[hi.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsx(Zl,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxs(View,{style:hi.processingCardText,children:[jsx(Text,{style:[hi.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsx(Text,{style:[hi.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var hi=StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var oa=(e,t)=>`${t}:${e}`,vg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function ml({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:d="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,borderTopLeftRadius:y,borderTopRightRadius:w,sheetBorderRadius:c}){let{colors:S,fonts:b,components:p}=D(),f=s&&l?`${s}:${l}`:"solana:mainnet",[x,_]=useState("USDC"),[k,C]=useState(f),[R,A]=useState([]),[F,O]=useState(true),[P,N]=useState([]),[M,de]=useState(true),[Me,Le]=useState(false),[Y,Ie]=useState(false),[pe,ve]=useState(false),[je,ye]=useState(false),[te,Te]=useState([]),[at,We]=useState(new Map),[Xe]=useState(()=>new Date),[De,$e]=useState(null),[Ke,Fe]=useState(false),[Z,ie]=useState(null),[Ge,z]=useState(false),q=new Map;P.forEach($=>{$.chains.forEach(oe=>{let _e=`${oe.chain_type}:${oe.chain_id}`;q.has(_e)||q.set(_e,oe);});});let se=Array.from(q.values()),ne=vg(k),Zt=se.find($=>$.chain_type===ne.chainType&&$.chain_id===ne.chainId)?.chain_type||"ethereum",me=qo(R,Zt),ae=me?.address||"",xe=useRef(false);useEffect(()=>{async function $(){try{de(!0),$e(null);let _e=await Qn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(N(_e.data),_e.data.length>0&&!xe.current){xe.current=!0;let he,bt;if(s&&l)if(m)for(let L of _e.data){let Ir=L.chains.find(E=>E.chain_type===s&&E.chain_id===l&&E.token_address.toLowerCase()===m.toLowerCase());if(Ir){he=L,bt=Ir;break}}else for(let L of _e.data){let Ir=L.chains.find(E=>E.chain_type===s&&E.chain_id===l);if(Ir){he=L,bt=Ir;break}}if(!he&&a)for(let L of _e.data){let Ir=L.chains.find(E=>E.token_address.toLowerCase()===a.toLowerCase());if(Ir){he=L,bt=Ir;break}}he||(he=_e.data.find(L=>L.symbol==="USDC"),he&&he.chains.length>0&&(bt=he.chains[0])),he||(he=_e.data.find(L=>L.symbol==="USDT"),he&&he.chains.length>0&&(bt=he.chains[0])),he||(he=_e.data[0],he.chains.length>0&&(bt=he.chains[0])),he&&_(he.symbol),bt&&C(oa(bt.chain_id,bt.chain_type));}}catch(oe){console.error("Error fetching supported tokens:",oe),$e("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:oe});}finally{de(false);}}$();},[t,h,s,l,m,a,n,o]),useEffect(()=>{async function $(){try{O(!0),$e(null);let oe=await $o({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);A(oe.data);}catch(oe){console.error("Error fetching wallets:",oe),$e("Failed to load wallets"),h?.({message:"Failed to load wallets",error:oe});}finally{O(false);}}$();},[e,r,o,n,a,t,h]);let Pt=me?.id??"",{showWaitingUi:pt,handleIveDeposited:fe}=ra({depositConfirmationMode:d,depositAddress:ae,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:Xe,depositWalletId:Pt,depositExecutions:te,trackedExecutions:at,setDepositExecutions:Te,setTrackedExecutions:We,setLatestExecution:ie,setShowStatusSheet:Fe,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h});useEffect(()=>{if(!P.length)return;let $=P.find(_e=>_e.symbol===x);if(!$||$.chains.length===0)return;if(!$.chains.some(_e=>oa(_e.chain_id,_e.chain_type)===k)){let _e=$.chains[0];C(oa(_e.chain_id,_e.chain_type));}},[x,P,k]);let tt=P.find($=>$.symbol===x),Rr=tt?.chains||[],xt=Rr.find($=>oa($.chain_id,$.chain_type)===k),Gr=async()=>{if(ae)try{Clipboard.setString(ae),Le(!0),setTimeout(()=>Le(!1),2e3);}catch($){console.error("Failed to copy:",$);}},co=xt?.estimated_price_impact_percent??0,wr=xt?.max_slippage_percent??.25,qt=xt?.minimum_deposit_amount_usd??3;if(M)return jsxs(View,{style:V.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:S.primary}),jsx(Text,{style:[V.loadingText,{color:S.foregroundMuted,fontFamily:b.regular}],children:"Loading currencies..."})]});if(De&&P.length===0)return jsxs(View,{style:V.errorContainer,children:[jsx(Text,{style:[V.errorText,{color:S.error,fontFamily:b.regular}],children:De}),jsx(Text,{style:[V.errorHint,{color:S.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]});let we=()=>jsxs(ct,{visible:pe,onClose:()=>ve(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.tokenSelector?.borderTopLeftRadius??y,borderTopRightRadius:c?.tokenSelector?.borderTopRightRadius??w,children:[jsxs(View,{style:[V.sheetHeader,{borderBottomColor:S.border}],children:[jsx(View,{style:V.sheetHeaderSpacer}),jsx(Text,{style:[V.sheetTitle,{color:p.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>ve(false),style:V.sheetCloseButton,children:jsx(rt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsx(ht,{style:V.sheetList,contentContainerStyle:V.sheetListContent,showsVerticalScrollIndicator:false,children:P.map($=>jsxs(TouchableOpacity$1,{onPress:()=>{_($.symbol),ve(false);},activeOpacity:.7,style:[V.sheetItem,{backgroundColor:x===$.symbol?p.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:X(be($,"png"))},style:V.sheetItemIcon}),jsxs(View,{style:V.sheetItemText,children:[jsx(Text,{style:[V.sheetItemTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:$.symbol}),jsxs(Text,{style:[V.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:b.regular}],children:[$.chains.length," network",$.chains.length!==1?"s":""," available"]})]}),x===$.symbol&&jsx(qe,{size:20,color:S.primary,strokeWidth:2})]},$.symbol))})]}),et=()=>jsxs(ct,{visible:je,onClose:()=>ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.chainSelector?.borderTopLeftRadius??y,borderTopRightRadius:c?.chainSelector?.borderTopRightRadius??w,children:[jsxs(View,{style:[V.sheetHeader,{borderBottomColor:S.border}],children:[jsx(View,{style:V.sheetHeaderSpacer}),jsx(Text,{style:[V.sheetTitle,{color:p.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>ye(false),style:V.sheetCloseButton,children:jsx(rt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsx(ht,{style:V.sheetList,contentContainerStyle:V.sheetListContent,showsVerticalScrollIndicator:false,children:Rr.map($=>{let oe=oa($.chain_id,$.chain_type),_e=k===oe;return jsxs(TouchableOpacity$1,{onPress:()=>{C(oe),ye(false);},activeOpacity:.7,style:[V.sheetItem,{backgroundColor:_e?p.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:X(be($,"png"))},style:V.sheetItemIcon}),jsxs(View,{style:V.sheetItemText,children:[jsx(Text,{style:[V.sheetItemTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:$.chain_name}),jsxs(Text,{style:[V.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:b.regular}],children:["Min deposit: $",$.minimum_deposit_amount_usd]})]}),_e&&jsx(qe,{size:20,color:S.primary,strokeWidth:2})]},oe)})})]});return jsxs(View,{style:V.container,children:[jsxs(View,{style:V.selectorSection,children:[jsx(Text,{style:[V.selectorLabel,{color:p.card.labelColor,fontFamily:b.regular}],children:"Token"}),jsxs(TouchableOpacity$1,{onPress:()=>ve(true),style:[V.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[tt&&jsx(Image,{source:{uri:X(be(tt,"png"))},style:V.selectorIcon}),jsx(Text,{style:[V.selectorText,{color:p.card.titleColor,fontFamily:b.medium}],children:x}),jsx(Ot,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:V.selectorSection,children:[jsxs(Text,{style:[V.selectorLabel,{color:p.card.labelColor,fontFamily:b.regular}],children:["Network"," ",jsxs(Text,{style:[V.minDeposit,{fontFamily:b.regular}],children:["($",qt," min)"]})]}),jsxs(TouchableOpacity$1,{onPress:()=>ye(true),style:[V.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[xt&&jsx(Image,{source:{uri:X(be(xt,"png"))},style:V.selectorIcon}),jsx(Text,{style:[V.selectorText,{color:p.card.titleColor,fontFamily:b.medium}],numberOfLines:1,children:xt?.chain_name||"Select network"}),jsx(Ot,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsx(View,{style:V.qrContainer,children:jsx(View,{style:[V.qrWrapper,{backgroundColor:S.background,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth>0?p.card.borderWidth:1,borderColor:p.card.borderColor}],children:F?jsxs(View,{style:V.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),jsx(Text,{style:[V.loadingText,{color:S.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):ae?jsx(as,{value:ae,size:160,logoUri:X(be(xt,"png")||Nt("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:V.qrLoading,children:jsx(Text,{style:[V.errorText,{color:S.error,fontFamily:b.regular}],children:"No address available"})})})}),jsxs(View,{style:V.addressSection,children:[jsxs(View,{style:V.addressHeader,children:[jsx(Text,{style:[V.addressLabel,{color:p.card.labelColor,fontFamily:b.medium}],children:"Deposit Address"}),Me&&jsxs(View,{style:V.copiedIndicator,children:[jsx(qe,{size:14,color:S.success,strokeWidth:2}),jsx(Text,{style:[V.copiedText,{color:S.success,fontFamily:b.regular}],children:"Copied"})]})]}),jsxs(Jt,{cardTokens:p.transferCrypto.depositAddress.card,onPress:!F&&ae?Gr:void 0,contentStyle:V.addressBox,children:[jsx(Text,{style:[V.addressText,{color:p.card.titleColor,fontFamily:b.regular}],numberOfLines:2,children:F?"Loading...":ae||"No address available"}),jsx(View,{style:V.addressCopyIcon,children:jsx(qn,{size:16,color:p.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[V.detailsCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>Ie(!Y),style:V.detailsHeader,children:[jsxs(View,{style:V.detailsRow,children:[jsx(View,{style:[V.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsx(So,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[V.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:V.chevronContainer,children:Y?jsx(To,{size:16,color:p.card.actionColor,strokeWidth:2}):jsx(Ot,{size:16,color:p.card.actionColor,strokeWidth:2})})]}),Y&&jsxs(View,{style:V.detailsContent,children:[jsxs(View,{style:V.detailsRow,children:[jsx(View,{style:[V.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsx(gn,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[V.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:["Price impact: ",co.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:V.detailsRow,children:[jsx(View,{style:[V.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsx(yn,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[V.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:["Slippage: Auto \u2022 ",wr.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:V.detailsRow,children:[jsx(View,{style:[V.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsx(ga,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[V.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(ul,{depositConfirmationMode:d,depositAddress:ae,showWaitingUi:pt,latestExecution:Z,onIveDeposited:fe}),jsx(TouchableOpacity$1,{style:V.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[V.termsText,{color:S.primary,fontFamily:b.regular}],children:"Terms apply"})}),we(),et(),jsxs(ct,{visible:Ge,onClose:()=>z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:c?.infoSheet?.borderTopLeftRadius??y,borderTopRightRadius:c?.infoSheet?.borderTopRightRadius??w,children:[jsxs(View,{style:[V.sheetHeader,{borderBottomColor:S.border}],children:[jsx(View,{style:V.sheetHeaderSpacer}),jsx(Text,{style:[V.sheetTitle,{color:p.header.titleColor,fontFamily:b.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>z(false),style:V.sheetCloseButton,children:jsx(rt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:V.infoSheetContent,children:[jsxs(View,{style:[V.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxs(View,{style:V.infoCardHeader,children:[jsx(View,{style:[V.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsx(gn,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[V.infoCardTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:"Price Impact"}),jsxs(Text,{style:[V.infoCardValue,{color:p.card.titleColor,fontFamily:b.medium}],children:[co.toFixed(2),"%"]})]}),jsx(Text,{style:[V.infoCardDescription,{color:p.card.descriptionColor,fontFamily:b.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxs(View,{style:[V.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxs(View,{style:V.infoCardHeader,children:[jsx(View,{style:[V.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsx(yn,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[V.infoCardTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:"Max Slippage"}),jsxs(Text,{style:[V.infoCardValue,{color:p.card.titleColor,fontFamily:b.medium}],children:[wr.toFixed(2),"%"]})]}),jsx(Text,{style:[V.infoCardDescription,{color:p.card.descriptionColor,fontFamily:b.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),Z&&jsx(ls,{visible:Ke,status:Z.status,tokenIconUrl:Z.destination_token_metadata?.icon_urls?.find($=>$.format==="png")?.url||Z.destination_token_metadata?.icon_url||be(tt,"png"),explorerUrl:Z.explorer_url,completionExplorerUrl:Z.destination_explorer_url,date:Z.created_at?new Date(Z.created_at):void 0,amountUsd:Z.source_amount_usd?parseFloat(Z.source_amount_usd):void 0,onClose:()=>Fe(false),borderTopLeftRadius:c?.depositStatus?.borderTopLeftRadius??y,borderTopRightRadius:c?.depositStatus?.borderTopRightRadius??w})]})}var V=StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function fl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=D();return jsxs(TouchableOpacity$1,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[gi.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxs(View,{style:gi.leftContent,children:[jsx(View,{style:[gi.iconContainer,{backgroundColor:o.background}],children:jsx(Image,{source:{uri:X(be(e,"png"))},style:gi.icon})}),jsxs(View,{style:gi.textContainer,children:[jsx(Text,{style:[gi.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsx(Text,{style:[gi.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(qe,{size:16,color:o.primary,strokeWidth:2})]})}var gi=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 ia({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=D();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:nm.headerContainer,children:jsx(Text,{style:[nm.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsx(fl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var nm=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function gl({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:d}=D(),[g,T]=useState(""),h=o.map(f=>r.find(x=>x.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),y=r.filter(f=>!o.includes(f.currency_code.toLowerCase())),w=f=>{if(!g)return f;let x=g.toLowerCase();return f.filter(_=>_.name.toLowerCase().includes(x)||_.currency_code.toLowerCase().includes(x))},c=w(h),S=w(y),b=f=>{a(f),t(false),T("");},p=()=>{t(false),T("");};return jsxs(ct,{visible:e,onClose:p,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsx(xr,{title:"Currency",showBack:false,onClose:p}),jsx(View,{style:yi.searchContainer,children:jsx(TextInput,{style:[yi.searchInput,{backgroundColor:d.search.backgroundColor,color:d.search.inputColor,fontFamily:m.regular,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],value:g,onChangeText:T,placeholder:"Search",placeholderTextColor:d.search.placeholderColor})}),jsx(ht,{style:yi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxs(View,{style:yi.listContent,children:[jsx(ia,{title:"Popular currencies",currencies:c,selectedCurrency:n,onSelect:b}),c.length>0&&S.length>0&&jsx(View,{style:yi.sectionSpacer}),jsx(ia,{title:"All currencies",currencies:S,selectedCurrency:n,onSelect:b}),c.length===0&&S.length===0&&jsx(View,{style:yi.noResultsContainer,children:jsx(Text,{style:[yi.noResultsText,{color:d.container.subtitleColor,fontFamily:m.regular}],children:"No currencies found"})})]})})]})}var yi=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 wd(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 Cl({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:m,onDepositError:d,borderTopLeftRadius:g,borderTopRightRadius:T,sheetBorderRadius:h}){let{colors:y,fonts:w,components:c}=D(),[S,b]=useState(""),[p,f]=useState("usd"),[x,_]=useState(false),[k,C]=useState(false),[R,A]=useState([]),[F,O]=useState(false),[P,N]=useState(null),[M,de]=useState(null),[Me,Le]=useState("amount"),[Y,Ie]=useState(null),[pe,ve]=useState(true),[je,ye]=useState(null),[te,Te]=useState(false),at=useRef(null),We=useRef(false);useEffect(()=>{at.current=Y;},[Y]),useEffect(()=>{We.current=te;},[te]);let[Xe,De]=useState([]),[$e,Ke]=useState(true),[Fe,Z]=useState(60),[ie,Ge]=useState([]),[z,q]=useState([]),[se,ne]=useState(null),[ue,Zt]=useState(null),[me,ae]=useState(true),[xe,Pt]=useState(null),[pt,fe]=useState(false),[tt,Rr]=useState(null),[xt,Gr]=useState(false),[co,wr]=useState(false),[qt,we]=useState(false),[et,$]=useState(null),oe=r??Me,_e=useRef(null),he=ie.find(Q=>Q.currency_code.toLowerCase()===p.toLowerCase()),bt=useCallback(Q=>{Le(Q),Q==="quotes"?o?.(Q,R.length):o?.(Q);},[R.length,o]);useEffect(()=>{async function Q(){try{let le=await Ps();Zt(le);}catch(le){console.error("Error fetching user IP:",le);}finally{ae(false);}}Q();},[]),useEffect(()=>{async function Q(){try{let le=await $o({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);De(le.data);}catch(le){console.error("Error fetching wallets:",le),N("Failed to load wallet addresses");}finally{Ke(false);}}Q();},[e,a,i,s,l,t]);let L=n||se?.symbol.toUpperCase()||"USDC",Ir=Fi(se?.icon_urls,"png")||se?.icon_url,E=Fi(se?.chain_icon_urls,"png")||se?.chain_icon_url;useEffect(()=>{async function Q(){try{let le=await ic(t);Ge(le.data),q(le.preferred||[]);}catch(le){console.error("Error fetching fiat currencies:",le);}}Q();},[t]),useEffect(()=>{if(x||ie.length===0||!ue?.alpha2)return;let Q=ue.alpha2.toUpperCase(),le=ie.find(wt=>wt.country_codes.includes(Q));if(le)f(le.currency_code.toLowerCase()),!S&&!k&&b(String(le.default_amount??100));else if(!S&&!k){let wt=ie.find(Lr=>Lr.currency_code.toLowerCase()==="usd");wt&&b(String(wt.default_amount??100));}},[ie,ue,x,S,k]),useEffect(()=>{if(ie.length!==0){if(_e.current!==null&&_e.current!==p){let Q=ie.find(le=>le.currency_code.toLowerCase()===p.toLowerCase());Q&&b(String(Q.default_amount??100));}_e.current=p;}},[p,ie]),useEffect(()=>{async function Q(){try{let le=await tc({chain_type:i||"",chain_id:s||"",token_address:l||""},t);ne(le);}catch(le){console.error("Error fetching supported tokens:",le);}}Q();},[i,s,l,t]),useEffect(()=>{async function Q(){if(!(!l||!s||!i)&&!me){fe(true);try{let le=await nc({country_code:ue?.alpha2?.toUpperCase()||"US",subdivision_code:ue?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);Pt(le);}catch(le){console.error("Error fetching default onramp token:",le);}finally{fe(false);}}}Q();},[l,s,i,ue,me,t]),useEffect(()=>{let Q=parseFloat(S);if(isNaN(Q)||Q<=0){A([]),de(null);return}if(!xe||pt){A([]),Ie(null);return}let le=ie.find(Lr=>Lr.currency_code.toLowerCase()===p.toLowerCase());if(le){if(Q<le.minimum_amount){A([]),Ie(null),de(`Minimum amount is ${wd(p)}${le.minimum_amount.toLocaleString()}`);return}if(Q>le.maximum_amount){A([]),Ie(null),de(`Maximum amount is ${wd(p)}${le.maximum_amount.toLocaleString()}`);return}}de(null);let wt=setTimeout(()=>{_t(Q);},500);return ()=>clearTimeout(wt)},[S,p,t,xe,pt,ie]);let _t=async Q=>{if(!xe){N("Loading token information...");return}O(true),N(null);try{let le={country_code:ue?.alpha2?.toUpperCase()||"US",source_amount:Q.toString(),source_currency:p.toLowerCase(),destination_currency:xe.destination_currency,destination_network:xe.destination_network,subdivision_code:ue?.state||void 0},wt=await rc(le,t);A(wt.data);let Lr=We.current,bs=at.current;if(Lr&&bs){let po=wt.data.find(mo=>mo.service_provider===bs.service_provider);if(po){if(Ie(po),wt.data.length>0){let mo=wt.data.reduce((Br,No)=>No.destination_amount>Br.destination_amount?No:Br);je||ye(mo.service_provider),ve(po.service_provider===je);}}else if(wt.data.length>0){let mo=wt.data.reduce((Br,No)=>No.destination_amount>Br.destination_amount?No:Br);Ie(mo),ye(mo.service_provider),ve(!0),Te(!1);}}else if(wt.data.length>0){let po=wt.data.reduce((mo,Br)=>Br.destination_amount>mo.destination_amount?Br:mo);Ie(po),ye(po.service_provider),ve(!0);}Z(60);}catch(le){console.error("Failed to fetch quotes:",le),N("Failed to fetch quotes. Please try again."),A([]);}finally{O(false);}};useEffect(()=>{if(R.length===0)return;let Q=setInterval(()=>{Z(le=>{if(le<=1){let wt=parseFloat(S);return !isNaN(wt)&&wt>0&&_t(wt),60}return le-1});},1e3);return ()=>clearInterval(Q)},[R.length,S]);let mt=Q=>{(/^\d*\.?\d{0,2}$/.test(Q)||Q==="")&&(b(Q),C(true));},Vr=Q=>{b(Q.toString()),C(true);},Qt=async()=>{if(Y&&xe)try{let Q=xe.destination_token_metadata.chain_type,le=qo(Xe,Q);if(!le?.address){N("Wallet address not available");return}let wt={service_provider:Y.service_provider,country_code:Y.country_code?.toUpperCase()||ue?.alpha2?.toUpperCase()||"US",source_currency:Y.source_currency,source_amount:S,destination_currency:Y.destination_currency,destination_network:Y.destination_network,wallet_address:le.address,subdivision_code:ue?.state||void 0},Lr=await oc(wt,t);Rr({provider:Y,sourceCurrency:p,sourceAmount:S,sessionUrl:Lr.url}),$(Lr.url),we(!0);}catch(Q){console.error("Failed to create session:",Q),N("Failed to start payment flow"),d?.({message:"Failed to start payment flow",error:Q});}},xi=wd(p),uo=()=>{we(false),bt("onramp"),m?.({message:"Payment flow completed"});},Ho=()=>jsx(Hg,{visible:qt,onClose:uo,url:et,providerName:Y?.service_provider_display_name||"Complete Payment",colors:y,fonts:w,borderTopLeftRadius:h?.webView?.borderTopLeftRadius??g,borderTopRightRadius:h?.webView?.borderTopRightRadius??T});return oe==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:j.amountViewContainer,children:[jsxs(ht,{style:j.scrollContainer,contentContainerStyle:j.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:j.currencySelector,children:jsxs(TouchableOpacity$1,{onPress:()=>Gr(true),style:[j.currencyButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],children:[he&&jsx(Image,{source:{uri:X(be(he,"png"))},style:j.currencyIcon}),jsx(Text,{style:[j.currencyText,{color:c.card.titleColor,fontFamily:w.medium}],children:p.toUpperCase()}),jsx(Ot,{size:16,color:c.card.actionColor,strokeWidth:2})]})}),jsx(gl,{open:xt,onOpenChange:Gr,currencies:ie,preferredCurrencyCodes:z,selectedCurrency:p,onSelectCurrency:Q=>{f(Q.toLowerCase()),_(true);},borderTopLeftRadius:h?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.currencyModal?.borderTopRightRadius??T}),jsx(View,{style:j.amountContainer,children:jsxs(View,{style:j.amountInputRow,children:[jsx(Text,{style:[j.currencySymbol,{color:c.container.titleColor,fontFamily:w.medium}],children:xi}),jsx(TextInput,{style:[j.amountInput,{color:c.container.titleColor,fontFamily:w.medium}],value:S,onChangeText:mt,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:y.foregroundMuted})]})}),he?.suggested_amounts&&he.suggested_amounts.length>0&&jsx(View,{style:j.quickAmounts,children:he.suggested_amounts.map(Q=>jsx(TouchableOpacity$1,{onPress:()=>Vr(Q),style:[j.quickAmountButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.button.borderRadius,borderWidth:parseFloat(S)===Q?2:c.button.borderWidth,borderColor:parseFloat(S)===Q?y.primary:c.button.borderColor}],children:jsxs(Text,{style:[j.quickAmountText,{color:c.card.titleColor,fontFamily:w.medium}],children:[xi,Q.toLocaleString()]})},Q))}),M&&jsx(Text,{style:[j.validationError,{color:y.error,fontFamily:w.regular}],children:M}),jsxs(View,{style:j.providerSection,children:[jsxs(View,{style:j.providerHeader,children:[jsx(Text,{style:[j.providerLabel,{color:c.card.labelColor,fontFamily:w.medium}],children:"Provider"}),R.length>0&&!F&&jsxs(Text,{style:[j.refreshText,{color:c.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",Fe,"s"]})]}),jsx(Jt,{cardTokens:c.depositCard.quoteProvider.card,onPress:F||R.length===0?void 0:()=>wr(true),contentStyle:StyleSheet.flatten([j.providerButton,(F||R.length===0)&&j.disabled]),children:F?jsxs(View,{style:j.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:y.primary}),jsx(Text,{style:[j.loadingText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):Y?jsxs(View,{style:j.providerContent,children:[jsxs(View,{style:j.providerInfo,children:[pe&&jsx(Text,{style:[j.autoPickedText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxs(View,{style:j.providerRow,children:[jsx(Image,{source:{uri:X(xa(Y.icon_urls,"png",Y.icon_url))},style:j.providerIconImage},`provider-${Y.service_provider}`),jsxs(View,{children:[jsx(Text,{style:[j.providerName,{color:c.card.titleColor,fontFamily:w.medium}],children:Y.service_provider_display_name}),jsxs(Text,{style:[j.bestPriceText,{color:y.success,fontFamily:w.regular}],children:["Best price \u2022 ",Y.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(Ar,{size:20,color:c.card.actionColor,strokeWidth:2})]}):jsx(Text,{style:[j.noProviderText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),P&&jsx(Text,{style:[j.errorText,{color:y.error,fontFamily:w.regular}],children:P})]}),jsxs(ct,{visible:co,onClose:()=>wr(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.providerModal?.borderTopRightRadius??T,children:[jsx(xr,{title:"Select Provider",showBack:false,onClose:()=>wr(false)}),jsx(ht,{style:j.providerModalList,contentContainerStyle:j.providerModalListContent,showsVerticalScrollIndicator:false,children:jsx(View,{style:j.quotesList,children:[...R].sort((Q,le)=>le.destination_amount-Q.destination_amount).map((Q,le)=>{let wt=Y?.service_provider===Q.service_provider,Lr=le===0;return jsxs(Jt,{cardTokens:c.depositCard.quoteProvider.card,onPress:()=>{Ie(Q),Te(true),ve(Q.service_provider===je),wr(false);},contentStyle:StyleSheet.flatten([j.quoteItem,wt&&{borderWidth:2,borderColor:y.primary}]),children:[jsxs(View,{style:j.quoteLeft,children:[jsx(Image,{source:{uri:X(xa(Q.icon_urls,"png",Q.icon_url))},style:j.providerIconImage}),jsxs(View,{children:[jsx(Text,{style:[j.quoteName,{color:c.card.titleColor,fontFamily:w.medium}],children:Q.service_provider_display_name}),Lr&&jsx(Text,{style:[j.bestPriceLabel,{color:y.success,fontFamily:w.regular}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:j.quoteRight,children:[jsxs(Text,{style:[j.quoteAmount,{color:c.card.textRightColor,fontFamily:w.medium}],children:[Q.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[j.quoteSource,{color:c.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",xi,Q.total_fee.toFixed(2)]})]})]},Q.service_provider)})})})]})]}),jsx(View,{style:[j.continueButtonContainer,{backgroundColor:y.background}],children:jsx(View,{style:{opacity:F||$e||!Y||parseFloat(S)<=0?.5:1},children:jsx(TouchableOpacity$1,{onPress:Qt,disabled:F||$e||!Y||parseFloat(S)<=0,style:[j.continueButton,{backgroundColor:c.container.buttonColor,borderRadius:c.button.borderRadius,borderWidth:c.button.borderWidth,borderColor:c.button.borderColor}],children:jsx(Text,{style:[j.continueButtonText,{color:c.container.buttonTitleColor,fontFamily:w.medium}],children:$e?"Loading...":"Continue"})})})})]}),Ho()]}):oe==="onramp"&&tt?jsxs(View,{style:j.onrampContainer,children:[jsx(Image,{source:{uri:X(xa(tt.provider.icon_urls,"png",tt.provider.icon_url))},style:j.onrampProviderIcon}),jsxs(Text,{style:[j.onrampTitle,{color:c.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",tt.provider.service_provider_display_name]}),jsx(Text,{style:[j.onrampSubtitle,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxs(View,{style:[j.flowDiagram,{backgroundColor:c.card.backgroundColor}],children:[jsxs(View,{style:j.flowStep,children:[jsx(Image,{source:{uri:Nt(`/icons/currencies/png/${tt.sourceCurrency.toLowerCase()}.png`)},style:j.flowIconImage}),jsx(Text,{style:[j.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsx(Text,{style:[j.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:tt.sourceCurrency.toUpperCase()})]}),jsx(Ar,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxs(View,{style:j.flowStep,children:[jsxs(View,{style:j.flowIconWithBadge,children:[jsx(Image,{source:{uri:Fi(xe?.destination_token_metadata?.icon_urls,"png")||xe?.destination_token_metadata?.icon_url||Nt("/icons/tokens/png/usdc.png")},style:j.flowIconImageNoBadge}),jsx(Image,{source:{uri:Fi(xe?.destination_token_metadata?.chain?.icon_urls,"png")||xe?.destination_token_metadata?.chain?.icon_url||Nt("/icons/networks/png/polygon.png")},style:[j.flowNetworkBadge,{borderColor:y.background,borderRadius:c.badge.borderRadius}]})]}),jsx(Text,{style:[j.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsx(Text,{style:[j.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsx(Ar,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxs(View,{style:j.flowStep,children:[jsxs(View,{style:j.flowIconWithBadge,children:[jsx(Image,{source:{uri:Ir||Nt("/icons/tokens/png/usdc.png")},style:j.flowIconImageNoBadge}),jsx(Image,{source:{uri:E||Nt("/icons/networks/png/polygon.png")},style:[j.flowNetworkBadge,{borderColor:y.background,borderRadius:c.badge.borderRadius}]})]}),jsx(Text,{style:[j.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsx(Text,{style:[j.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:L})]})]}),jsx(View,{style:[j.onrampInfoBox,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:jsx(Text,{style:[j.onrampInfoText,{color:c.card.descriptionColor,fontFamily:w.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 Hg({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxs(View,{style:bi.header,children:[jsx(TouchableOpacity$1,{onPress:t,style:bi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(qe,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[bi.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsx(View,{style:bi.headerSpacer})]}),r&&jsx(View,{style:bi.container,children:jsx(WebView,{source:{uri:r},style:bi.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:bi.loading,children:jsx(ActivityIndicator,{size:"large",color:n.primary})})})})]})}var bi=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"}}),j=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"},bestPriceLabel:{fontSize:11,marginTop:2},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 qg(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 Qg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function kl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=X(be(e.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),m=i?"Deposit Processing":"Deposit Completed",d=qg(e.created_at||new Date().toISOString()),g=Qg(e.source_amount_usd);return jsxs(Jt,{cardTokens:a,onPress:t,contentStyle:an.container,children:[jsxs(View,{style:an.iconContainer,children:[jsx(Image,{source:{uri:l},style:an.tokenIcon}),jsx(View,{style:[an.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsx(ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:an.textContainer,children:[jsx(Text,{style:[an.title,{color:a.titleColor,fontFamily:o.medium}],children:m}),jsx(Text,{style:[an.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:d})]}),jsxs(View,{style:an.rightContainer,children:[jsx(Text,{style:[an.amount,{color:a.textRightColor,fontFamily:o.medium}],children:g}),jsx(Ar,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var an=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 lm(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 cm(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 Gg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var dm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function um(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Yg(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 Jg({count:e=4}){let{colors:t,components:r}=D(),o=useRef(new Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsx(View,{style:Ci.list,children:Array.from({length:e}).map((i,s)=>jsxs(View,{style:[Ci.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsx(Animated.View,{style:[Ci.icon,{backgroundColor:a,opacity:o}]}),jsxs(View,{style:Ci.textBlock,children:[jsx(Animated.View,{style:[Ci.titleBar,{backgroundColor:a,opacity:o}]}),jsx(Animated.View,{style:[Ci.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsx(Animated.View,{style:[Ci.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var Ci=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 Td({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=D(),[l,m]=useState(r),[d,g]=useState(false),[T,h]=useState(null),[y,w]=useState(false),c=useRef(null);useEffect(()=>{if(!e||!o)return;let k=async()=>{g(true);try{let A=[...(await Qo(o,n)).data].sort((F,O)=>{let P=F.created_at?new Date(F.created_at).getTime():0;return (O.created_at?new Date(O.created_at).getTime():0)-P});m(A);}catch(R){console.error("Failed to fetch executions:",R),m(r);}finally{g(false);}};k();let C=setInterval(k,1e4);return ()=>clearInterval(C)},[e,o,n,r]),useEffect(()=>{r.length>0&&m(k=>{let C=new Set(k.map(A=>A.id)),R=r.filter(A=>!C.has(A.id));return R.length>0?[...R,...k]:k});},[r]),useEffect(()=>{e||h(null);},[e]);let S=k=>{h(k);},b=()=>{h(null),w(false);},p=()=>{h(null),t();},f=()=>{if(!T)return null;let k=T,C=k.status==="pending"||k.status==="waiting"||k.status==="delayed",R=k.status==="succeeded",A=X(be(k.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),F=k.provider_metadata?.details,O=F?.currencyIn,P=F?.currencyOut;O?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let de=cm(k.source_amount_base_unit,k.source_token_metadata?.decimals),Me=cm(k.destination_amount_base_unit,k.destination_token_metadata?.decimals),Le=Gg(k.source_amount_usd),Y=lm(k.source_chain_type,k.source_chain_id),Ie=lm(k.destination_chain_type,k.destination_chain_id),pe=()=>{k.explorer_url&&Linking.openURL(k.explorer_url);},ve=()=>{k.destination_explorer_url&&Linking.openURL(k.destination_explorer_url);};return jsxs(ht,{ref:c,style:ce.scrollContainer,contentContainerStyle:ce.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:ce.iconSection,children:[jsxs(View,{style:ce.iconWrapper,children:[jsx(Image,{source:{uri:A},style:ce.tokenIcon}),jsx(View,{style:[ce.statusBadge,{backgroundColor:C?a.warning:a.success,borderColor:a.background}],children:C?jsx(Ot,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(qe,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:ce.statusRow,children:[jsx(View,{style:[ce.statusDot,{backgroundColor:C?a.warning:a.success}]}),jsx(Text,{style:[ce.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsx(Text,{style:[ce.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:Yg(k.created_at||new Date().toISOString())})]}),jsxs(View,{style:[ce.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxs(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[de," ",um(k.source_currency)]})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxs(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[Me," ",um(k.destination_currency)]})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Le})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Y})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Ie})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let je=!y;w(je),je?setTimeout(()=>{c.current?.scrollToEnd({animated:true});},100):c.current?.scrollTo({y:0,animated:true});},style:ce.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[ce.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:y?"See less":"See more details"}),y?jsx(To,{size:14,color:s.container.actionColor,strokeWidth:2}):jsx(Ot,{size:14,color:s.container.actionColor,strokeWidth:2})]}),y&&jsxs(View,{style:[ce.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[k.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:pe,style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxs(View,{style:ce.cardRowRight,children:[jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:dm(k.transaction_hash)}),jsx(ko,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsx(View,{style:[ce.cardDivider,{backgroundColor:a.border}]})]}),k.destination_explorer_url&&R&&jsxs(TouchableOpacity,{onPress:ve,style:ce.cardRow,children:[jsx(Text,{style:[ce.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxs(View,{style:ce.cardRowRight,children:[jsx(Text,{style:[ce.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:dm(k.destination_transaction_hashes[0])}),jsx(ko,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},x=d&&l.length===0;return jsxs(Fragment,{children:[jsx(xr,{title:T?"Deposit Details":"Deposit Tracker",onClose:p,showClose:!T,showBack:!!T,onBack:b}),T?f():x?jsx(Jg,{}):jsx(ht,{style:ce.scrollContainer,contentContainerStyle:ce.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxs(View,{style:ce.emptyContainer,children:[jsx(Text,{style:[ce.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsx(Text,{style:[ce.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsx(View,{style:ce.executionsList,children:l.map(k=>jsx(kl,{execution:k,onPress:()=>S(k)},k.id))})})]})}var ce=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 sa(e,t=true){let[r,o]=useState(null),[n,a]=useState(null),[i,s]=useState(false),[l,m]=useState(false),[d,g]=useState(null),[T,h]=useState(null);useEffect(()=>{!t||r||(s(true),Ps().then(S=>{o(S),g(null);}).catch(S=>{g(S instanceof Error?S:new Error(String(S)));}).finally(()=>{s(false);}));},[t,r]),useEffect(()=>{!t||!e||n||(m(true),vs(e).then(S=>{a(S),h(null);}).catch(S=>{h(S instanceof Error?S:new Error(String(S)));}).finally(()=>{m(false);}));},[t,e,n]);let y=i||l,w=d||T||null,c=null;if(r&&n){let S=n.blocked_country_codes||[],b=r.alpha2.toUpperCase();c=!S.some(p=>p.toUpperCase()===b);}return {isAllowed:c,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:y,error:w}}var Rd="unifold_recent_tokens",ry=5,ym=[{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 Il(){try{let e=await Rc.getItem(Rd);return e?JSON.parse(e):[]}catch{return []}}async function oy(e){try{let r=(await Il()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,ry);await Rc.setItem(Rd,JSON.stringify(o));}catch{}}async function ny(e){try{let r=(await Il()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Rc.setItem(Rd,JSON.stringify(r)),r}catch{return []}}function Id({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:d}=D(),[g,T]=useState(""),[h,y]=useState([]);useEffect(()=>{e&&Il().then(y);},[e]),useEffect(()=>{e||T("");},[e]);let w=useMemo(()=>{let x=[];return r.forEach(_=>{_.chains.forEach(k=>{x.push({token:_,chain:k});});}),x},[r]),c=useMemo(()=>{let x=[],_=new Set,k=(C,R,A,F)=>{let O=`${C}-${R}:${A}`;if(_.has(O))return;let P=r.find(M=>M.symbol===C);if(!P)return;let N=P.chains.find(M=>M.chain_type===R&&M.chain_id===A);N&&(_.add(O),x.push({token:P,chain:N,isRecent:F}));};return h.forEach(C=>{k(C.symbol,C.chainType,C.chainId,true);}),ym.forEach(C=>{k(C.symbol,C.chainType,C.chainId,false);}),x},[r,h]),S=useMemo(()=>{if(!g.trim())return w;let x=g.toLowerCase();return w.filter(({token:_,chain:k})=>_.symbol.toLowerCase().includes(x)||_.name.toLowerCase().includes(x)||k.chain_name.toLowerCase().includes(x))},[w,g]),b=(x,_,k)=>ym.some(C=>C.symbol===x&&C.chainType===_&&C.chainId===k),p=async(x,_)=>{let k=`${_.chain_type}:${_.chain_id}`;if(!b(x.symbol,_.chain_type,_.chain_id)){await oy({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});let C=await Il();y(C);}T(""),a(x.symbol,k),t();},f=async(x,_)=>{let k=await ny({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});y(k);};return jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxs(View,{style:st.header,children:[jsx(View,{style:st.headerSpacer}),jsx(Text,{style:[st.headerTitle,{color:d.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:t,style:st.closeButton,children:jsx(rt,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:st.searchContainer,children:jsx(TextInput,{style:[st.searchInput,{backgroundColor:d.search.backgroundColor,color:d.search.inputColor,fontFamily:m.regular,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],placeholder:"Search",placeholderTextColor:d.search.placeholderColor,value:g,onChangeText:T,autoCapitalize:"none",autoCorrect:false})}),c.length>0&&!g&&jsxs(View,{style:st.quickSelectSection,children:[jsx(Text,{style:[st.sectionLabel,{color:d.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:st.quickSelectScroll,children:c.map(({token:x,chain:_,isRecent:k})=>{let C=`${_.chain_type}:${_.chain_id}`;x.symbol===o&&C===n;return jsxs(View,{children:[k&&jsx(TouchableOpacity$1,{onPress:()=>f(x,_),style:st.removeButton,children:jsx(rt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxs(TouchableOpacity$1,{onPress:()=>p(x,_),activeOpacity:.7,style:[st.quickSelectItem,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxs(View,{style:st.tokenIconContainer,children:[jsx(Image,{source:{uri:X(be(x,"png"))},style:st.quickSelectIcon}),jsx(Image,{source:{uri:X(be(_,"png"))},style:[st.quickSelectChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxs(View,{style:st.quickSelectText,children:[jsx(Text,{style:[st.quickSelectSymbol,{color:d.card.titleColor,fontFamily:m.medium}],children:x.symbol}),jsx(Text,{style:[st.quickSelectChain,{color:d.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]})]})]},`quick-${x.symbol}-${C}`)})})]}),jsx(Text,{style:[st.sectionLabel,{color:d.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsx(ht,{style:st.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:st.tokenListContent,children:S.length===0?jsx(View,{style:st.emptyState,children:jsx(Text,{style:[st.emptyText,{color:l.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):S.map(({token:x,chain:_})=>{let k=`${_.chain_type}:${_.chain_id}`,C=x.symbol===o&&k===n;return jsxs(TouchableOpacity$1,{onPress:()=>p(x,_),activeOpacity:.7,style:[st.tokenItem,{backgroundColor:C?d.card.backgroundColor:"transparent"}],children:[jsxs(View,{style:st.tokenIconContainerLarge,children:[jsx(Image,{source:{uri:X(be(x,"png"))},style:st.tokenIcon}),jsx(Image,{source:{uri:X(be(_,"png"))},style:[st.tokenChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxs(View,{style:st.tokenInfo,children:[jsx(Text,{style:[st.tokenSymbol,{color:d.card.titleColor,fontFamily:m.medium}],children:x.symbol}),jsx(Text,{style:[st.tokenChainName,{color:d.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]}),jsxs(Text,{style:[st.minDeposit,{color:d.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxs(Text,{style:{color:d.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${x.symbol}-${k}`)})})]})}var st=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Pl=(e,t)=>`${t}:${e}`,cy=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function vd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:d="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,wallets:y,borderTopLeftRadius:w,borderTopRightRadius:c,sheetBorderRadius:S}){let{colors:b,fonts:p,components:f}=D(),x=s&&l?`${s}:${l}`:"solana:mainnet",[_,k]=useState("USDC"),[C,R]=useState(x),[A,F]=useState([]),[O,P]=useState(!y?.length),N=y?.length?y:A,[M,de]=useState([]),[Me,Le]=useState(true),[Y,Ie]=useState(false),[pe,ve]=useState(false),[je,ye]=useState(false),[te,Te]=useState([]),[at,We]=useState(new Map),[Xe]=useState(()=>new Date),[De,$e]=useState(null),[Ke,Fe]=useState(false),[Z,ie]=useState(null),[Ge,z]=useState(false),q=new Map;M.forEach(we=>{we.chains.forEach(et=>{let $=`${et.chain_type}:${et.chain_id}`;q.has($)||q.set($,et);});});let se=Array.from(q.values()),ne=cy(C),ue=se.find(we=>we.chain_type===ne.chainType&&we.chain_id===ne.chainId),Zt=ue?.chain_type||"ethereum",me=qo(N,Zt),ae=me?.address||"",xe=useRef(false);useEffect(()=>{async function we(){try{Le(!0),$e(null);let $=await Qn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(de($.data),$.data.length>0&&!xe.current){xe.current=!0;let oe,_e;if(s&&l)if(m)for(let he of $.data){let bt=he.chains.find(L=>L.chain_type===s&&L.chain_id===l&&L.token_address.toLowerCase()===m.toLowerCase());if(bt){oe=he,_e=bt;break}}else for(let he of $.data){let bt=he.chains.find(L=>L.chain_type===s&&L.chain_id===l);if(bt){oe=he,_e=bt;break}}if(!oe&&a)for(let he of $.data){let bt=he.chains.find(L=>L.token_address.toLowerCase()===a.toLowerCase());if(bt){oe=he,_e=bt;break}}oe||(oe=$.data.find(he=>he.symbol==="USDC"),oe&&oe.chains.length>0&&(_e=oe.chains[0])),oe||(oe=$.data.find(he=>he.symbol==="USDT"),oe&&oe.chains.length>0&&(_e=oe.chains[0])),oe||(oe=$.data[0],oe.chains.length>0&&(_e=oe.chains[0])),oe&&k(oe.symbol),_e&&R(Pl(_e.chain_id,_e.chain_type));}}catch(et){console.error("Error fetching supported tokens:",et),$e("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:et});}finally{Le(false);}}we();},[t,a,n,o,s,l,m,h]),useEffect(()=>{g&&g(te);},[te,g]),useEffect(()=>{if(y?.length){P(false);return}if(A.length>0){P(false);return}let we=null,et=false,$=async()=>{if(!et){P(true);try{let oe=await $o({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);et||(F(oe.data),$e(null),P(!1));}catch(oe){console.error("Error fetching wallets, retrying in 5s:",oe),et||($e(oe instanceof Error?oe.message:"Failed to load wallets"),P(false),we=setTimeout($,5e3));}}};return $(),()=>{et=true,we&&clearTimeout(we);}},[e,r,o,n,a,t,y,A.length]);let Pt=me?.id??"",{showWaitingUi:pt,handleIveDeposited:fe}=ra({depositConfirmationMode:d,depositAddress:ae,chain:C,externalUserId:e,publishableKey:t,modalOpenedAt:Xe,depositWalletId:Pt,depositExecutions:te,trackedExecutions:at,setDepositExecutions:Te,setTrackedExecutions:We,setLatestExecution:ie,setShowStatusSheet:Fe,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h});useEffect(()=>{if(!M.length)return;let we=M.find($=>$.symbol===_);if(!we||we.chains.length===0)return;if(!we.chains.some($=>Pl($.chain_id,$.chain_type)===C)){let $=we.chains[0];R(Pl($.chain_id,$.chain_type));}},[_,M,C]);let tt=M.find(we=>we.symbol===_),xt=(tt?.chains||[]).find(we=>Pl(we.chain_id,we.chain_type)===C),Gr=async()=>{if(ae)try{Clipboard.setString(ae),Ie(!0),setTimeout(()=>Ie(!1),2e3);}catch(we){console.error("Failed to copy:",we);}},co=xt?.estimated_price_impact_percent??0,wr=xt?.max_slippage_percent??.25,qt=xt?.minimum_deposit_amount_usd??3;return Me?jsxs(View,{style:U.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:b.primary}),jsx(Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:p.regular}],children:"Loading currencies..."})]}):De&&M.length===0?jsxs(View,{style:U.errorContainer,children:[jsx(Text,{style:[U.errorText,{color:b.error,fontFamily:p.regular}],children:De}),jsx(Text,{style:[U.errorHint,{color:b.foregroundMuted,fontFamily:p.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:U.container,children:[jsxs(View,{style:U.selectorSection,children:[jsx(Text,{style:[U.selectorLabel,{color:f.card.labelColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:()=>ye(true),disabled:Me||M.length===0,style:[U.tokenSelectorButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:Me?jsxs(View,{style:U.tokenSelectorLoading,children:[jsx(View,{style:[U.loadingIcon,{backgroundColor:b.cardHover}]}),jsxs(View,{style:U.loadingTextContainer,children:[jsx(View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:60}]}),jsx(View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:100,marginTop:4}]})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:U.tokenIconWrapper,children:[tt&&jsx(Image,{source:{uri:X(be(tt,"png"))},style:U.tokenMainIcon}),(xt||ue)&&jsx(Image,{source:{uri:X(be(xt||ue,"png"))},style:[U.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxs(View,{style:U.tokenSelectorInfo,children:[jsx(Text,{style:[U.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:p.semibold}],children:tt?.symbol||_}),jsx(Text,{style:[U.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:p.regular}],numberOfLines:1,children:xt?.chain_name||ue?.chain_name||"Select network"})]}),jsxs(View,{style:U.tokenSelectorRight,children:[jsxs(Text,{style:[U.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:p.medium}],children:["$",qt," min"]}),jsx(Ar,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsx(Id,{visible:je,onClose:()=>ye(false),tokens:M,selectedToken:_,selectedChainKey:C,onSelect:(we,et)=>{k(we),R(et);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??c}),jsx(View,{style:U.qrContainer,children:jsx(View,{style:[U.qrWrapper,{backgroundColor:b.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:O?jsxs(View,{style:U.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:b.primary}),jsx(Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:p.regular}],children:"Loading..."})]}):ae?jsx(as,{value:ae,size:180,logoUri:X(be(xt,"png")||Nt("/icons/networks/png/ethereum.png")),logoSize:45}):jsx(View,{style:U.qrLoading,children:jsx(Text,{style:[U.errorText,{color:b.error,fontFamily:p.regular}],children:"No address available"})})})}),jsxs(View,{style:U.addressSection,children:[jsxs(View,{style:U.addressHeader,children:[jsx(Text,{style:[U.addressLabel,{color:f.card.labelColor,fontFamily:p.medium}],children:"Deposit Address"}),Y&&jsxs(View,{style:U.copiedIndicator,children:[jsx(qe,{size:14,color:b.success,strokeWidth:2}),jsx(Text,{style:[U.copiedText,{color:b.success,fontFamily:p.regular}],children:"Copied"})]})]}),jsxs(Jt,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!O&&ae?Gr:void 0,contentStyle:U.addressBox,children:[jsx(Text,{style:[U.addressText,{color:f.card.titleColor,fontFamily:p.regular}],numberOfLines:2,children:O?"Loading...":ae||"No address available"}),jsx(View,{style:U.addressCopyIcon,children:jsx(qn,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[U.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>ve(!pe),style:U.detailsHeader,children:[jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(So,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:p.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:U.chevronContainer,children:pe?jsx(To,{size:16,color:f.card.actionColor,strokeWidth:2}):jsx(Ot,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),pe&&jsxs(View,{style:U.detailsContent,children:[jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(gn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:p.regular}],children:["Price impact: ",co.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(yn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:p.regular}],children:["Slippage: Auto \u2022 ",wr.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:U.detailsRow,children:[jsx(View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(ga,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:p.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(ul,{depositConfirmationMode:d,depositAddress:ae,showWaitingUi:pt,latestExecution:Z,onIveDeposited:fe}),jsx(TouchableOpacity$1,{style:U.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[U.termsText,{color:b.primary,fontFamily:p.regular}],children:"Terms apply"})}),jsxs(ct,{visible:Ge,onClose:()=>z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??c,children:[jsxs(View,{style:[U.sheetHeader,{borderBottomColor:b.border}],children:[jsx(View,{style:U.sheetHeaderSpacer}),jsx(Text,{style:[U.sheetTitle,{color:f.header.titleColor,fontFamily:p.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>z(false),style:U.sheetCloseButton,children:jsx(rt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:U.infoSheetContent,children:[jsxs(View,{style:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(View,{style:U.infoCardHeader,children:[jsx(View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(gn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:p.medium}],children:"Price Impact"}),jsxs(Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:p.medium}],children:[co.toFixed(2),"%"]})]}),jsx(Text,{style:[U.infoCardDescription,{color:f.card.descriptionColor,fontFamily:p.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxs(View,{style:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(View,{style:U.infoCardHeader,children:[jsx(View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsx(yn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:p.medium}],children:"Max Slippage"}),jsxs(Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:p.medium}],children:[wr.toFixed(2),"%"]})]}),jsx(Text,{style:[U.infoCardDescription,{color:f.card.descriptionColor,fontFamily:p.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),Z&&jsx(ls,{visible:Ke,status:Z.status,tokenIconUrl:Z.destination_token_metadata?.icon_urls?.find(we=>we.format==="png")?.url||Z.destination_token_metadata?.icon_url||be(tt,"png"),explorerUrl:Z.explorer_url,completionExplorerUrl:Z.destination_explorer_url,date:Z.created_at?new Date(Z.created_at):void 0,amountUsd:Z.source_amount_usd?parseFloat(Z.source_amount_usd):void 0,onClose:()=>Fe(false),borderTopLeftRadius:S?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:S?.depositStatus?.borderTopRightRadius??c})]})}var U=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 dn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function fy(){let{colors:e,components:t}=D(),r=useRef(new Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let a=({rightIcons:i=2})=>jsxs(View,{style:[Nn.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsx(Animated.View,{style:[Nn.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxs(View,{style:Nn.textBlock,children:[jsx(Animated.View,{style:[Nn.titleBar,{backgroundColor:n,opacity:r}]}),jsx(Animated.View,{style:[Nn.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsx(View,{style:Nn.rightIcons,children:Array.from({length:i}).map((s,l)=>jsx(Animated.View,{style:[Nn.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxs(View,{style:Nn.container,children:[jsx(a,{rightIcons:3}),jsx(a,{rightIcons:2}),jsx(a,{rightIcons:0})]})}var Nn=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 hy({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,defaultChainType:d,defaultChainId:g,defaultTokenAddress:T,showBalance:h=false,hideDepositTracker:y=false,enableStripeLinkPay:w=false,StripeOnrampComponent:c,stripeOnrampEmail:S,stripeOnrampPhone:b,stripeMerchantIdentifier:p,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:x,stripeTheme:_,depositConfirmationMode:k="auto_ui",transferInputVariant:C="double_input",initialScreen:R="main",onDepositSuccess:A,onDepositError:F,sheetBorderRadius:O}){let P=O?.globalBorderTopLeftRadius,N=O?.globalBorderTopRightRadius,{colors:M,fonts:de}=D(),[Me,Le]=useState([]),[Y,Ie]=useState(null),[pe,ve]=useState("amount"),je=R==="tracker"&&!y?"tracker":R==="transfer"?"transfer":R==="card"?"card":"main",ye=je==="main",[te,Te]=useState(je),{isAllowed:at,isLoading:We}=sa(o,e);useEffect(()=>{if(!e||Y)return;let me=false;return vs(o).then(async ae=>{if(me)return;let xe=[];for(let Pt of ae?.transfer_crypto?.networks??[]){let pt=Pt.icon_urls.find(fe=>fe.format==="png")?.url||Pt.icon_urls.find(fe=>fe.format==="svg")?.url;pt&&xe.push(X(pt));}for(let Pt of ae?.payment_networks?.networks??[]){let pt=Pt.icon_urls.find(fe=>fe.format==="png")?.url||Pt.icon_urls.find(fe=>fe.format==="svg")?.url;pt&&xe.push(X(pt));}xe.length>0&&await Xc(xe),me||Ie(ae);}).catch(console.error),()=>{me=true;}},[e,Y,o]);let Xe=()=>{t();};useEffect(()=>{e&&(Te(je),ve("amount"));},[e,je]);let De=useCallback(()=>{ye?(Te("main"),ve("amount")):Xe();},[ye,Xe]),$e=Me.filter(me=>me.status==="pending"||me.status==="waiting").length,Fe=!!(i&&s&&l&&m&&o)&&h!==false&&!!Y,Z=We||e&&!Y,ie=at===false,Ge=null;if(te==="stripe"&&c){let me=jsx(c,{publishableKey:o,email:S,phone:b,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,merchantIdentifier:p,paymentSelectorPosition:f,skipSuccessConfirmation:x,onClose:De});Ge=_?jsx(Pi,{..._,children:me}):me;}let z=te==="stripe"?.9:te==="transfer"||te==="card"?.94:te==="tracker"?.6:te==="main"?.5:void 0,q=te==="tracker"||te==="main"?.9:void 0,ne={main:O?.main,transfer:O?.transferCrypto,card:O?.buyWithCard,stripe:O?.stripeLinkPay,tracker:O?.depositsTracker}[te],ue=ne?.borderTopLeftRadius??P,Zt=ne?.borderTopRightRadius??N;return jsxs(ct,{visible:e,onClose:te==="main"?Xe:De,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:z,maxHeightPercent:q,borderTopLeftRadius:ue,borderTopRightRadius:Zt,children:[te==="main"&&jsxs(Fragment,{children:[jsx(xr,{title:n,showBack:false,onClose:Xe,showBalance:Fe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:Y?.project_name}),Z&&jsx(fy,{}),!Z&&ie&&jsxs(View,{style:Cr.centeredContainer,children:[jsx(View,{style:[Cr.iconContainer,{backgroundColor:M.cardHover}],children:jsx(Ts,{size:32,color:M.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Cr.blockedTitle,{color:M.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Cr.blockedDescription,{color:M.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!Z&&!ie&&jsxs(View,{style:Cr.optionsContainer,children:[jsx(Ys,{onPress:()=>Te("transfer"),title:dn.transferCrypto.title,subtitle:dn.transferCrypto.subtitle,featuredTokens:Y?.transfer_crypto?.networks}),jsx(Zs,{onPress:()=>Te("card"),title:dn.depositWithCard.title,subtitle:dn.depositWithCard.subtitle,paymentNetworks:Y?.payment_networks?.networks}),w&&c&&jsx(ta,{onPress:()=>Te("stripe"),title:dn.stripeLinkPay.title,subtitle:dn.stripeLinkPay.subtitle}),!y&&jsx(Xs,{onPress:()=>Te("tracker"),title:dn.depositTracker.title,subtitle:dn.depositTracker.subtitle,badge:$e>0?$e:void 0})]})]}),te==="transfer"&&jsxs(Fragment,{children:[jsx(xr,{title:dn.transferCrypto.title,showBack:false,onClose:De,showBalance:Fe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:Y?.project_name}),We&&jsx(View,{style:[Cr.centeredContainer,Cr.centeredFlex],children:jsx(ActivityIndicator,{color:M.primary})}),!We&&ie&&jsxs(View,{style:[Cr.centeredContainer,Cr.centeredFlex],children:[jsx(View,{style:[Cr.iconContainer,{backgroundColor:M.cardHover}],children:jsx(Ts,{size:32,color:M.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Cr.blockedTitle,{color:M.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Cr.blockedDescription,{color:M.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!We&&!ie&&jsx(ht,{style:Cr.transferScrollContainer,contentContainerStyle:Cr.scrollContent,showsVerticalScrollIndicator:false,children:C==="single_input"?jsx(vd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:k,onExecutionsChange:Le,onDepositSuccess:A,onDepositError:F,borderTopLeftRadius:P,borderTopRightRadius:N,sheetBorderRadius:{tokenSelector:O?.tokenSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}}):jsx(ml,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:k,onExecutionsChange:Le,onDepositSuccess:A,onDepositError:F,borderTopLeftRadius:P,borderTopRightRadius:N,sheetBorderRadius:{tokenSelector:O?.tokenSelector,chainSelector:O?.chainSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}})})]}),te==="card"&&jsxs(Fragment,{children:[jsx(xr,{title:`Deposit ${a||"USDC"}`,showBack:pe==="onramp",onBack:()=>ve("amount"),onClose:De,showBalance:Fe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:Y?.project_name}),jsx(View,{style:Cr.buyWithCardContainer,children:jsx(Cl,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,onDepositSuccess:A,onDepositError:F,view:pe,onViewChange:me=>ve(me),borderTopLeftRadius:P,borderTopRightRadius:N,sheetBorderRadius:{providerModal:O?.providerModal,webView:O?.webView,currencyModal:O?.currencyModal}})})]}),te==="stripe"&&Ge&&jsx(View,{style:Cr.stripeLinkPayContainer,children:Ge}),te==="tracker"&&jsx(Td,{active:te==="tracker",onClose:De,executions:Me,externalUserId:r,publishableKey:o})]})}function Fl({theme:e="auto",...t}){return jsx(hy,{...t})}var Cr=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Vl(e,t=true){return en({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ra(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Dd(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return en({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await Qn(a),m=null,d=null,g=null,T=null,h,y,w,c=l.data.some(S=>S.chains.some(b=>{let p=b.chain_type===t&&b.chain_id===r&&b.token_address.toLowerCase()===o.toLowerCase();return p&&(m=b.minimum_deposit_amount_usd,d=b.estimated_processing_time,g=b.max_slippage_percent,T=b.estimated_price_impact_percent,w=b.chain_name,y=S),p}));if(y){let S=be(y,"png");S&&(h=X(S));}return {isSupported:c,minimumAmountUsd:m,estimatedProcessingTime:d,maxSlippagePercent:g,priceImpactPercent:T,errorMessage:c?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:h,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Fd(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return en({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await Ia(t,r,o,n,a);if(l.balance){let m=l.balance.token?.decimals??6,d=l.balance.token?.symbol??"",g=l.balance.amount,T=BigInt(g),h=BigInt(10**m),y=T/h,c=(T%h).toString().padStart(m,"0").replace(/0+$/,""),S=c?`${y}.${c}`:y.toString();return {balanceBaseUnit:g,balanceHuman:S,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:m,symbol:d}}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 yy=2500,by=3e3,Cy=6e4;function Vd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=useState([]),[l,m]=useState(false),d=useRef(new Date),g=useRef(new Map),T=useRef(false),h=useRef(n),y=useRef(a);return useEffect(()=>{h.current=n;},[n]),useEffect(()=>{y.current=a;},[a]),useEffect(()=>{o&&!T.current&&(d.current=new Date,g.current.clear()),o||g.current.clear(),T.current=o;},[o]),useEffect(()=>{if(!e||!o)return;let w=d.current,c=async()=>{try{let b=await Qo(e,t,"withdraw"),p=new Date(w.getTime()-Cy),f=[...b.data].sort((C,R)=>{let A=C.created_at?new Date(C.created_at).getTime():0;return (R.created_at?new Date(R.created_at).getTime():0)-A}),x=["pending","waiting","delayed"],_=["succeeded","failed"],k=null;for(let C of f){let R=C.created_at?new Date(C.created_at):null;if(!R||R<p)continue;let A=g.current.get(C.id);if(!A){k=C;break}if(x.includes(A)&&_.includes(C.status)){k=C;break}}if(k){let C=k,R=C.created_at?new Date(C.created_at):null;if(!R||R<d.current)return;let A=g.current.get(C.id);g.current.set(C.id,C.status),s(F=>{let O=F.findIndex(P=>P.id===C.id);if(O>=0){let P=[...F];return P[O]=C,P}return [...F,C]}),C.status==="succeeded"&&(!A||x.includes(A))?h.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&A!=="failed"&&y.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(b){console.error("Failed to fetch withdraw executions:",b),y.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:b});}};c();let S=setInterval(c,yy);return m(true),()=>{clearInterval(S),m(false);}},[e,t,o]),useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await lc({deposit_wallet_id:r},t);}catch{}};w();let c=setInterval(w,by);return ()=>clearInterval(c)},[o,r,t]),{executions:i,isPolling:l}}var Ld=(e,t)=>`${t}:${e}`;function ca({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:m,chainPickerBorderTopLeftRadius:d,chainPickerBorderTopRightRadius:g}){let{colors:T,fonts:h,components:y}=D(),[w,c]=useState(false),[S,b]=useState(false),p=y.card,f=t?e.find(C=>C.symbol===t):void 0,x=f?.chains||[],_=r?x.find(C=>Ld(C.chain_id,C.chain_type)===r):void 0,k={backgroundColor:p.backgroundColor,borderRadius:p.borderRadius,borderWidth:p.borderWidth||1,borderColor:p.borderColor};return jsxs(View,{style:Qe.row,children:[jsxs(View,{style:Qe.col,children:[jsx(Text,{style:[Qe.label,{color:p.labelColor,fontFamily:h.medium}],children:i}),jsxs(TouchableOpacity,{style:[Qe.selectButton,k],onPress:()=>!a&&e.length>0&&c(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsx(Text,{style:[Qe.placeholder,{color:p.subtitleColor,fontFamily:h.regular}],children:"Loading..."}):f?jsxs(View,{style:Qe.selectedItem,children:[jsx(Image,{source:{uri:X(be(f,"png"))},style:Qe.icon}),jsx(Text,{style:[Qe.selectedText,{color:p.titleColor,fontFamily:h.medium}],numberOfLines:1,children:f.symbol})]}):jsx(Text,{style:[Qe.placeholder,{color:p.subtitleColor,fontFamily:h.regular}],children:"Select receive token"}),jsx(Ot,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:Qe.col,children:[jsx(Text,{style:[Qe.label,{color:p.labelColor,fontFamily:h.medium}],children:s}),jsxs(TouchableOpacity,{style:[Qe.selectButton,k,(!f||x.length===0)&&Qe.disabled],onPress:()=>!a&&f&&x.length>0&&b(true),activeOpacity:.7,disabled:a||!f||x.length===0,children:[_?jsxs(View,{style:Qe.selectedItem,children:[jsx(Image,{source:{uri:X(be(_,"png"))},style:Qe.icon}),jsx(Text,{style:[Qe.selectedText,{color:p.titleColor,fontFamily:h.medium}],numberOfLines:1,children:_.chain_name})]}):jsx(Text,{style:[Qe.placeholder,{color:p.subtitleColor,fontFamily:h.regular}],children:"Chain"}),jsx(Ot,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxs(ct,{visible:w,onClose:()=>c(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:m,children:[jsxs(View,{style:Qe.pickerHeader,children:[jsx(View,{style:Qe.pickerHeaderSpacer}),jsx(Text,{style:[Qe.pickerTitle,{color:T.foreground,fontFamily:h.medium}],children:"Select Token"}),jsx(TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>c(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(rt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsx(Di,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxs(TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:C.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(C.symbol),c(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:X(be(C,"png"))},style:Qe.pickerIcon}),jsx(Text,{style:[Qe.pickerItemText,{color:T.foreground,fontFamily:h.medium}],children:C.symbol}),jsx(Text,{style:[Qe.pickerItemSub,{color:T.foregroundMuted,fontFamily:h.regular}],children:C.name}),C.symbol===t&&jsx(qe,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxs(ct,{visible:S,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:d,borderTopRightRadius:g,children:[jsxs(View,{style:Qe.pickerHeader,children:[jsx(View,{style:Qe.pickerHeaderSpacer}),jsx(Text,{style:[Qe.pickerTitle,{color:T.foreground,fontFamily:h.medium}],children:"Select Chain"}),jsx(TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>b(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(rt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsx(Di,{data:x,keyExtractor:C=>Ld(C.chain_id,C.chain_type),contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let R=Ld(C.chain_id,C.chain_type);return jsxs(TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:R===r?T.cardHover:"transparent"}],onPress:()=>{n(R),b(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:X(be(C,"png"))},style:Qe.pickerIcon}),jsx(Text,{style:[Qe.pickerItemText,{color:T.foreground,fontFamily:h.medium}],children:C.chain_name}),R===r&&jsx(qe,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Qe=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 Bd(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return en({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>ac({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Ty(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function xy(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("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function _y(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Bl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:m,balanceData:d,isLoadingBalance:g,minimumWithdrawAmountUsd:T,estimatedProcessingTime:h,maxSlippagePercent:y,priceImpactPercent:w,canWithdraw:c,onDepositWalletCreation:S,onWithdraw:b,onWithdrawError:p,onWithdrawSubmitted:f,onViewTracker:x}){let _="https://unifold.io/terms",k="https://unifold.io/support",{colors:C,fonts:R,components:A}=D(),[F,O]=useState(s||""),[P,N]=useState(""),[M,de]=useState(false),[Me,Le]=useState(null),[Y,Ie]=useState(false),[pe,ve]=useState(""),je=useRef(null);useEffect(()=>{O(s||""),N(""),Le(null);},[s]);let ye=F.trim();useEffect(()=>{let fe=setTimeout(()=>ve(ye),500);return ()=>clearTimeout(fe)},[ye]);let{data:te,isLoading:Te,error:at}=Bd({chainType:m?.chain_type,chainId:m?.chain_id,tokenAddress:m?.token_address,recipientAddress:pe,publishableKey:e,enabled:pe.length>5&&!!m}),We=ye!==pe,Xe=useMemo(()=>!ye||ye.length<=5||We||Te?null:at?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${m?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${m?.chain_name}`:"Invalid address":null,[ye,We,Te,at,te,m,l]),De=!We&&!!te?.valid&&!Xe,$e=useMemo(()=>d?.exchangeRate?parseFloat(d.exchangeRate):0,[d]),Ke=useMemo(()=>d?.balanceHuman?parseFloat(d.balanceHuman):0,[d]),Fe=n||d?.symbol||"TOKEN",Z=d?.decimals??6,ie=useMemo(()=>{let fe=parseFloat(P);return !fe||fe<=0?0:fe},[P]),Ge=useMemo(()=>{let fe=parseFloat(P);return !fe||fe<=0?0:fe*$e},[P,$e]),z=useCallback(async()=>{try{let tt=await $m("expo-clipboard").getStringAsync();tt&&(O(tt.trim()),Le(null));}catch{}},[]),q=useCallback(()=>{Ke<=0||N(d?.balanceHuman??"0");},[Ke,d]),se=T!==null&&Ge>0&&Ge<T,ne=ie>0&&Ke>0&&ie>Ke,ue=ye.length>0&&P.trim().length>0&&ie>0&&De&&!se&&!ne&&!!d,Zt=useCallback(async()=>{if(!(!l||!m||!ue||!c)){de(true),Le(null);try{let fe=await S({destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,recipientAddress:ye}),tt=xy(ie,Z),Rr=_y(ie,Z),xt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:Fe,sourceTokenIconUrl:i,destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,destinationTokenSymbol:l.symbol,destinationChainName:m.chain_name,destinationTokenIconUrl:l?X(be(l,"png")):void 0,amount:Rr,amountBaseUnit:tt,submittedAt:new Date,withdrawIntentAddress:fe.address,recipientAddress:ye};await b(xt),f(xt);}catch(fe){let tt=fe instanceof Error?fe.message:"Withdrawal failed. Please try again.",Rr=tt.length>120?"Withdrawal failed. Please try again.":tt;Le(Rr),p?.({message:tt,error:fe,code:"WITHDRAW_FAILED"});}finally{de(false);}}},[l,m,ue,c,ye,t,r,o,Fe,i,P,Ke,d,ie,Z,Ge,S,b,p,f]),me=A.input,ae=A.card,xe=A.button,Pt=Xe?C.error:me.borderColor,pt=useMemo(()=>M?"Processing...":ne?"Insufficient balance":se?`Minimum $${T?.toFixed(2)}`:Me?"Withdrawal failed \u2014 try again":"Withdraw",[M,ne,se,T,Me]);return jsxs(View,{style:Ne.container,children:[jsxs(View,{children:[jsxs(View,{style:Ne.labelRow,children:[jsx(Text,{style:[Ne.label,{color:ae.labelColor,fontFamily:R.medium}],children:"Recipient address"}),(We||Te)&&ye.length>5?jsx(ActivityIndicator,{size:"small",color:C.primary}):jsx(TouchableOpacity,{onPress:z,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsx(Kd,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsx(View,{style:[Ne.inputRow,{backgroundColor:me.backgroundColor,borderRadius:me.borderRadius,borderWidth:me.borderWidth,borderColor:Pt}],children:jsx(TextInput,{style:[Ne.textInput,{color:me.textColor,fontFamily:R.regular}],placeholder:"Enter wallet address",placeholderTextColor:me.placeholderColor,value:F,onChangeText:fe=>{O(fe),Le(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>je.current?.focus()})}),Xe?jsx(Text,{style:[Ne.errorText,{color:C.error,fontFamily:R.regular}],children:Xe}):null]}),jsxs(View,{children:[jsxs(Text,{style:[Ne.label,{color:ae.labelColor,fontFamily:R.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsx(Text,{style:{color:C.warning,fontFamily:R.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxs(View,{style:[Ne.amountRow,{backgroundColor:me.backgroundColor,borderRadius:me.borderRadius,borderWidth:me.borderWidth,borderColor:me.borderColor}],children:[jsx(TextInput,{ref:je,style:[Ne.amountInput,{color:me.textColor,fontFamily:R.regular}],placeholder:"0.00",placeholderTextColor:me.placeholderColor,value:P,onChangeText:fe=>{(fe===""||/^\d*\.?\d*$/.test(fe))&&(N(fe),Le(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsx(Text,{style:[Ne.unitLabel,{color:C.foregroundMuted,fontFamily:R.medium}],children:Fe}),jsx(TouchableOpacity,{style:[Ne.maxButton,{backgroundColor:`${C.primary}20`}],onPress:q,activeOpacity:.7,children:jsx(Text,{style:[Ne.maxText,{color:C.primary,fontFamily:R.medium}],children:"Max"})})]})]}),jsxs(View,{style:[Ne.detailsCard,{marginTop:24,backgroundColor:ae.backgroundColor,borderRadius:ae.borderRadius,borderWidth:ae.borderWidth||1,borderColor:ae.borderColor}],children:[jsx(TouchableOpacity,{style:Ne.detailsToggle,onPress:()=>Ie(!Y),activeOpacity:.7,children:jsxs(View,{style:Ne.detailsRow,children:[jsx(View,{style:[Ne.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsx(So,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Ne.detailsLabel,{color:ae.titleColor,fontFamily:R.regular}],children:["Processing time:"," ",jsx(Text,{style:{fontFamily:R.medium},children:Ty(h)})]}),jsx(View,{style:{transform:[{rotate:Y?"180deg":"0deg"}]},children:jsx(Ot,{size:16,color:ae.actionColor,strokeWidth:2})})]})}),Y&&jsxs(View,{style:Ne.detailsExpanded,children:[jsxs(View,{style:Ne.detailsRow,children:[jsx(View,{style:[Ne.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsx(yn,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Ne.detailsLabel,{color:ae.titleColor,fontFamily:R.regular}],children:["Slippage:"," ",jsxs(Text,{style:{fontFamily:R.medium},children:["Auto \u2022 ",(y??.25).toFixed(2),"%"]})]})]}),jsxs(View,{style:Ne.detailsRow,children:[jsx(View,{style:[Ne.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsx(gn,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Ne.detailsLabel,{color:ae.titleColor,fontFamily:R.regular}],children:["Price impact:"," ",jsxs(Text,{style:{fontFamily:R.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Me&&jsx(Text,{style:[Ne.errorText,{color:C.error,fontFamily:R.regular,textAlign:"center"}],children:Me}),jsxs(View,{style:Ne.withdrawRow,children:[jsxs(TouchableOpacity,{style:[Ne.withdrawButton,{backgroundColor:xe.primaryBackground,borderRadius:xe.borderRadius,borderWidth:xe.borderWidth,borderColor:xe.borderColor,opacity:!ue||!c||M?.5:1}],onPress:Zt,disabled:!ue||!c||M,activeOpacity:.8,children:[M&&jsx(ActivityIndicator,{size:"small",color:xe.primaryText}),jsx(Text,{style:[Ne.withdrawButtonText,{color:xe.primaryText,fontFamily:R.medium}],children:pt})]}),jsxs(View,{style:Ne.footerRow,children:[jsxs(TouchableOpacity,{style:Ne.historyLink,onPress:x,activeOpacity:.7,children:[jsx(So,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsx(Text,{style:[Ne.historyText,{color:C.foregroundMuted,fontFamily:R.regular}],children:"Withdrawal history"})]}),jsxs(View,{style:Ne.legalLinks,children:[jsx(TouchableOpacity,{onPress:()=>Linking.openURL(_),activeOpacity:.7,children:jsx(Text,{style:[Ne.legalText,{color:C.foregroundMuted,fontFamily:R.regular}],children:"Terms"})}),jsx(Text,{style:[Ne.legalSeparator,{color:C.foregroundMuted,fontFamily:R.regular}],children:"|"}),jsx(TouchableOpacity,{onPress:()=>Linking.openURL(k),activeOpacity:.7,children:jsx(Text,{style:[Ne.legalText,{color:C.foregroundMuted,fontFamily:R.regular}],children:"Help"})})]})]})]})]})}var Ne=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 vy(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 Py(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function El({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,m=X(be(e.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),d=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=vy(e.created_at||new Date().toISOString()),T=Py(e.source_amount_usd);return jsxs(Jt,{cardTokens:a,onPress:t,contentStyle:pn.container,children:[jsxs(View,{style:pn.iconContainer,children:[jsx(Image,{source:{uri:m},style:pn.tokenIcon}),jsx(View,{style:[pn.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsx(ks,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsx(ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:pn.textContainer,children:[jsx(Text,{style:[pn.title,{color:a.titleColor,fontFamily:o.medium}],children:d}),jsx(Text,{style:[pn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxs(View,{style:pn.rightContainer,children:[jsx(Text,{style:[pn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:T}),jsx(Ar,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var pn=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 Ed(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(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let m=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${m} ${l}`}catch{return e}}function Fm(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 Dy(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 Vm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Lm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function da({label:e,value:t,isLast:r}){let{fonts:o,components:n}=D(),a=n.card;return jsxs(Fragment,{children:[jsxs(View,{style:Ae.detailRow,children:[jsx(Text,{style:[Ae.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsx(Text,{style:[Ae.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsx(View,{style:[Ae.divider,{backgroundColor:a.borderColor}]})]})}function zd({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=D(),[m,d]=useState([]),[g,T]=useState(!!n),h=l.card,y=l.button,w=l.header,c=l.container;useEffect(()=>{sc().then(de=>d(de.data)).catch(()=>{});},[]),useEffect(()=>{T(!!n);},[e?.id]);let S=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,b=e?e.status==="failed"||e.status==="refunded":false,p=b?i.error:S?i.warning:i.success,f=b?"Failed":S?"Processing":"Completed",x=e?.destination_token_metadata?X(be(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?X(t.destinationTokenIconUrl):X(Nt("/icons/tokens/png/usdc.png")),_=e?.created_at?Ed(e.created_at):t.submittedAt?Ed(t.submittedAt.toISOString()):Ed(new Date().toISOString()),k=e?`${Fm(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Vm(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${Fm(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Vm(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,R=e?Dy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?_a(m,e.source_chain_type,e.source_chain_id):t.sourceChainId,F=e?_a(m,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,O=e?.transaction_hash,P=e?.explorer_url,N=e?.destination_transaction_hashes?.[0],M=e?.destination_explorer_url;return jsxs(ht,{style:Ae.scroll,contentContainerStyle:Ae.container,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Ae.headerRow,children:[n?jsx(TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ii,{size:22,color:w.buttonColor,strokeWidth:2})}):jsx(View,{style:Ae.headerSpacer}),jsx(Text,{style:[Ae.headerTitle,{color:w.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsx(View,{style:Ae.headerSpacer}):jsx(TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(rt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:Ae.iconContainer,children:[jsx(Image,{source:{uri:x},style:Ae.tokenIcon}),jsx(View,{style:[Ae.statusBadge,{backgroundColor:p}],children:b?jsx(ks,{size:10,color:"#FFFFFF",strokeWidth:3}):S?jsx(View,{style:Ae.spinnerDot}):jsx(qe,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Ae.statusRow,children:[jsx(View,{style:[Ae.statusDot,{backgroundColor:p}]}),jsx(Text,{style:[Ae.statusText,{color:p,fontFamily:s.medium}],children:f})]}),jsx(Text,{style:[Ae.dateText,{color:c.subtitleColor,fontFamily:s.regular}],children:_}),jsxs(View,{style:[Ae.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:[jsx(da,{label:"Amount Sent",value:k}),jsx(da,{label:"Amount Received",value:C}),jsx(da,{label:"USD Value",value:R}),jsx(da,{label:"Source Network",value:A}),jsx(da,{label:"Destination Network",value:F,isLast:true})]}),jsxs(TouchableOpacity,{style:Ae.moreDetailsRow,onPress:()=>T(de=>!de),activeOpacity:.7,children:[jsx(Text,{style:[Ae.moreDetailsText,{color:c.actionTitle,fontFamily:s.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsx(To,{size:16,color:c.actionColor,strokeWidth:2}):jsx(Ot,{size:16,color:c.actionColor,strokeWidth:2})]}),g&&jsx(View,{style:[Ae.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:O&&P?jsxs(Fragment,{children:[jsxs(TouchableOpacity,{style:Ae.txRow,onPress:()=>Linking.openURL(P),activeOpacity:.7,children:[jsx(Text,{style:[Ae.txLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsx(Text,{style:[Ae.txHash,{color:h.titleColor,fontFamily:s.regular}],children:Lm(O)}),jsx(ko,{size:14,color:h.actionColor,strokeWidth:2})]}),!S&&N&&M&&jsxs(Fragment,{children:[jsx(View,{style:[Ae.divider,{backgroundColor:h.borderColor}]}),jsxs(TouchableOpacity,{style:Ae.txRow,onPress:()=>Linking.openURL(M),activeOpacity:.7,children:[jsx(Text,{style:[Ae.txLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsx(Text,{style:[Ae.txHash,{color:h.titleColor,fontFamily:s.regular}],children:Lm(N)}),jsx(ko,{size:14,color:h.actionColor,strokeWidth:2})]})]})]}):jsx(View,{style:Ae.detailRow,children:jsx(Text,{style:[Ae.detailLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxs(View,{style:Ae.buttonRow,children:[jsx(TouchableOpacity,{style:[Ae.button,Ae.halfButton,{backgroundColor:y.secondaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[Ae.buttonText,{color:y.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsx(TouchableOpacity,{style:[Ae.button,Ae.halfButton,{backgroundColor:y.primaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[Ae.buttonText,{color:y.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Ae=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: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 Bm(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ml({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=D(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",m=s?.status==="failed",d={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxs(View,{style:Ct.container,children:[jsx(TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsx(rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[Ct.iconRing,{backgroundColor:n.successBackground}],children:jsx(qe,{size:32,color:n.success,strokeWidth:2.5})}),jsx(Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxs(Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Bm(e.recipientAddress)]}),jsxs(View,{style:Ct.buttonRow,children:[jsx(TouchableOpacity,{style:[Ct.button,Ct.halfButton,d,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[Ct.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsx(TouchableOpacity,{style:[Ct.button,Ct.halfButton,d,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):m?jsxs(View,{style:Ct.container,children:[jsx(TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsx(rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[Ct.iconRing,{backgroundColor:n.errorBackground}],children:jsx(rt,{size:32,color:n.error,strokeWidth:2.5})}),jsx(Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsx(Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsx(TouchableOpacity,{style:[Ct.button,Ct.fullButton,d,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxs(View,{style:Ct.container,children:[jsx(TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsx(rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(ft,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsx(Image,{source:{uri:X(e.sourceTokenIconUrl)},style:Ct.tokenIconFill}):jsx(View,{style:[Ct.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsx(Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxs(Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Bm(e.recipientAddress)]})]})}var Ct=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 Wy(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:X(be(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:X(be(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 Am=(e,t)=>`${t}:${e}`;function Ey(){let{colors:e}=D(),t=useRef(new Animated.Value(.5)).current,r=e.cardHover;return useEffect(()=>{let o=Animated.loop(Animated.sequence([Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsx(View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsx(Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function Hl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,defaultDestinationChainType:i,defaultDestinationChainId:s,defaultDestinationTokenAddress:l,modalTitle:m="Withdraw Crypto",onWithdraw:d,onWithdrawSuccess:g,onWithdrawError:T,heightPercent:h=.94,sheetBorderRadius:y,sourceChainType:w,sourceChainId:c,sourceTokenAddress:S,sourceTokenSymbol:b,sourceChainName:p,sourceTokenIconUrl:f}){let{colors:x,fonts:_}=D(),[k,C]=useState("form"),[R,A]=useState(w),[F,O]=useState(c),[P,N]=useState(S),[M,de]=useState(b),[Me,Le]=useState(p),[Y,Ie]=useState(f),[pe,ve]=useState(null),[je,ye]=useState(null),[te,Te]=useState(null),[at,We]=useState(),[Xe,De]=useState([]),[$e,Ke]=useState(null),[Fe,Z]=useState("form"),ie=useRef(new Animated.Value(Dimensions.get("window").width)).current,Ge=useRef(null),z=!!R&&!!F&&!!P,{data:q,isLoading:se}=Vl(r,e&&k==="form"),ne=q?.data??[],{data:ue,isLoading:Zt}=Dd({sourceChainType:R,sourceChainId:F,sourceTokenAddress:P,sourceTokenSymbol:M,publishableKey:r,enabled:e&&z&&k==="form"}),{data:me,isLoading:ae}=Fd({address:n,chainType:R,chainId:F,tokenAddress:P,publishableKey:r,enabled:e&&z}),{executions:xe}=Vd({userId:o,publishableKey:r,depositWalletId:at,enabled:!!at&&e,onWithdrawSuccess:g,onWithdrawError:T});useEffect(()=>{if(!e||k!=="tracker")return;let E=false;return Qo(o,r,"withdraw").then(_t=>{E||De(_t.data);}).catch(console.error),()=>{E=true;}},[e,k,o,r]),useEffect(()=>{e&&(Ge.current&&(clearTimeout(Ge.current),Ge.current=null),C("form"),A(w),O(c),N(S),de(b),Le(p),Ie(f),ve(null),ye(null),Te(null),We(void 0),De([]),Ke(null),Z("form"),ie.setValue(Dimensions.get("window").width));},[e]),useEffect(()=>()=>{Ge.current&&clearTimeout(Ge.current);},[]),useEffect(()=>{Y||ue?.iconUrl&&Ie(ue.iconUrl);},[ue?.iconUrl,Y]),useEffect(()=>{Me||ue?.chainName&&Le(ue.chainName);},[ue?.chainName,Me]),useEffect(()=>{if(!ne.length||pe)return;let E,_t;if(i&&s)if(l)for(let mt of ne){let Vr=mt.chains.find(Qt=>Qt.chain_type===i&&Qt.chain_id===s&&Qt.token_address.toLowerCase()===l.toLowerCase());if(Vr){E=mt,_t=Vr;break}}else for(let mt of ne){let Vr=mt.chains.find(Qt=>Qt.chain_type===i&&Qt.chain_id===s);if(Vr){E=mt,_t=Vr;break}}E||(E=ne[0]),E&&(ve(E),ye(_t??E.chains[0]??null));},[ne,pe,i,s,l]),useEffect(()=>{k==="confirming"&&xe.length>0&&C("details");},[k,xe]);let Pt=useCallback(()=>{t(),Ge.current=setTimeout(()=>{C("form"),A(w),O(c),N(S),de(b),Le(p),Ie(f),ve(null),ye(null),Te(null),We(void 0),De([]),Ke(null),Z("form"),Ge.current=null;},300);},[t,w,c,S,b,p,f]),pt=useCallback(E=>{let _t=ne.find(mt=>mt.symbol===E);_t&&(ve(_t),_t.chains.length>0&&ye(_t.chains[0]));},[ne]),fe=useCallback(E=>{if(!pe)return;let _t=pe.chains.find(mt=>Am(mt.chain_id,mt.chain_type)===E);_t&&ye(_t);},[pe]),tt=useCallback(async E=>{let _t=await $o({external_user_id:o,destination_chain_type:E.destinationChainType,destination_chain_id:E.destinationChainId,destination_token_address:E.destinationTokenAddress,recipient_address:E.recipientAddress,action_type:"withdraw"},r),mt=qo(_t.data,R??"");if(!mt)throw new Error(`No deposit wallet found for chain type: ${R}`);return We(mt.id),{id:mt.id,address:mt.address}},[o,r,R]),Rr=useCallback(E=>{Te(E),C("confirming");},[]),xt=useCallback(E=>{Ke(E),ie.setValue(Dimensions.get("window").width),Animated.timing(ie,{toValue:0,duration:280,useNativeDriver:true}).start();},[ie]),Gr=useCallback(()=>{Animated.timing(ie,{toValue:Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ke(null));},[ie]),co=se||Zt,wr=ue?.isSupported??null,qt=k==="confirming"?"Withdrawal Status":m,we=y?.globalBorderTopLeftRadius,et=y?.globalBorderTopRightRadius,$=y?.main?.borderTopLeftRadius??we,oe=y?.main?.borderTopRightRadius??et,_e=y?.tokenSelector?.borderTopLeftRadius??we,he=y?.tokenSelector?.borderTopRightRadius??et,bt=y?.chainSelector?.borderTopLeftRadius??we,L=y?.chainSelector?.borderTopRightRadius??et,Ir=(()=>{if(k!=="form"||!z||ae||!me)return;let E=M||me.symbol,_t=me.balanceUsd;if(_t!=null){let Qt=`$${parseFloat(_t).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return E?`Balance: ${Qt} ${E}`:`Balance: ${Qt}`}let mt=me.balanceHuman;if(!(!mt||mt==="0"))return E?`Balance: ${mt} ${E}`:`Balance: ${mt}`})();return jsx(ct,{visible:e,onClose:Pt,closeOnBackdropPress:false,enablePanDownToClose:k==="tracker"||k==="form",showHandle:k==="tracker"||k==="form",heightPercent:k==="confirming"?.3:k==="details"?.7:k==="tracker"?.6:h,maxHeightPercent:k==="tracker"?.9:void 0,borderTopLeftRadius:$,borderTopRightRadius:oe,children:k==="confirming"&&te?jsx(Ml,{txInfo:te,executions:xe,onClose:Pt,onViewTracker:()=>{Z("confirming"),C("tracker");}}):k==="details"&&te?jsx(zd,{execution:xe.length>0?xe[xe.length-1]:null,txInfo:te,onClose:Pt,onViewHistory:()=>{Z("details"),C("tracker");},onHeaderClose:()=>C("form")}):k==="tracker"?jsxs(View,{style:zo.trackerContainer,children:[jsx(xr,{title:"Withdrawal History",onClose:()=>C(Fe)}),Xe.length===0?jsx(View,{style:zo.emptyState,children:jsx(Text,{style:[zo.emptyText,{color:x.foregroundMuted,fontFamily:_.regular}],children:"No withdrawals to track yet"})}):jsx(Di,{data:Xe,keyExtractor:E=>E.id,contentContainerStyle:zo.listContent,showsVerticalScrollIndicator:false,renderItem:({item:E})=>jsx(El,{execution:E,onPress:()=>xt(E)})}),$e&&jsx(Animated.View,{style:[zo.historyDetailOverlay,{backgroundColor:x.background,transform:[{translateX:ie}]}],children:jsx(zd,{execution:$e,txInfo:Wy($e),onClose:Pt,onBack:Gr,onViewHistory:Gr})})]}):jsxs(Fragment,{children:[jsx(xr,{title:qt,subtitle:Ir,onClose:Pt}),co?jsx(Ey,{}):wr===false?jsxs(View,{style:zo.unsupportedContainer,children:[jsx(Text,{style:[zo.unsupportedTitle,{color:x.foreground,fontFamily:_.medium}],children:"Unsupported Token"}),jsx(Text,{style:[zo.unsupportedMessage,{color:x.foregroundMuted,fontFamily:_.regular}],children:ue?.errorMessage})]}):jsx(My,{publishableKey:r,sourceChainType:R??"",sourceChainId:F??"",sourceTokenAddress:P??"",sourceTokenSymbol:M,sourceChainName:Me,sourceTokenIconUrl:Y,recipientAddressProp:a,destinationTokens:ne,selectedToken:pe,selectedChain:je,selectedChainKey:je?Am(je.chain_id,je.chain_type):null,onTokenChange:pt,onChainChange:fe,tokensLoading:se,balanceData:me??null,isLoadingBalance:ae,sourceValidation:ue??null,onDepositWalletCreation:tt,onWithdraw:d,onWithdrawError:T,onWithdrawSubmitted:Rr,onViewTracker:()=>{Z("form"),C("tracker");},tokenSelectorLeft:_e,tokenSelectorRight:he,chainSelectorLeft:bt,chainSelectorRight:L})]})})}function My({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:m,selectedChain:d,selectedChainKey:g,onTokenChange:T,onChainChange:h,tokensLoading:y,balanceData:w,isLoadingBalance:c,sourceValidation:S,onDepositWalletCreation:b,onWithdraw:p,onWithdrawError:f,onWithdrawSubmitted:x,onViewTracker:_,tokenSelectorLeft:k,tokenSelectorRight:C,chainSelectorLeft:R,chainSelectorRight:A}){return jsx(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxs(ht,{style:{flex:1,paddingTop:16},contentContainerStyle:zo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsx(View,{style:zo.doubleInputWrapper,children:jsx(ca,{tokens:l,selectedTokenSymbol:m?.symbol??null,selectedChainKey:g,onTokenChange:T,onChainChange:h,isLoading:y,tokenPickerBorderTopLeftRadius:k,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:R,chainPickerBorderTopRightRadius:A})}),jsx(Bl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:m,selectedChain:d,balanceData:w,isLoadingBalance:c,minimumWithdrawAmountUsd:S?.minimumAmountUsd??null,estimatedProcessingTime:S?.estimatedProcessingTime??null,maxSlippagePercent:S?.maxSlippagePercent??null,priceImpactPercent:S?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:b,onWithdraw:p,onWithdrawError:f,onWithdrawSubmitted:x,onViewTracker:_})]})})}var zo=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}});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}});StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});StyleSheet.create({icon:{backgroundColor:"transparent"}});var Mm=createContext(null);function Gy({children:e,publishableKey:t,config:r}){let[o]=useState(()=>new qc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=useState(false),[i,s]=useState(null),[l,m]=useState(false),[d,g]=useState(null),T=useColorScheme(),h=useRef(false);h.current||(Sa({publishableKey:t}),h.current=true);let y=useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?T==="dark"?"dark":"light":P},[r?.appearance,T]);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.'),Sa({publishableKey:t});},[t]),useEffect(()=>()=>{c.current&&clearTimeout(c.current),_.current&&clearTimeout(_.current);},[]);let w=useRef(null),c=useRef(null),S=useCallback(P=>{c.current&&(clearTimeout(c.current),c.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 N=new Promise((M,de)=>{w.current={resolve:M,reject:de};});return s(P),a(true),N},[]),b=useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),a(false),c.current=setTimeout(()=>{s(null),c.current=null;},200);},[]),p=useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),f=useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),x=useRef(null),_=useRef(null),k=useRef(void 0),C=useCallback(P=>{_.current&&(clearTimeout(_.current),_.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let N=new Promise((M,de)=>{x.current={resolve:M,reject:de};});return k.current=P.onClose,g(P),m(true),N},[]),R=useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),k.current?.(),k.current=void 0,m(false),_.current=setTimeout(()=>{g(null),_.current=null;},200);},[]),A=useCallback(P=>{d?.onSuccess&&d.onSuccess(P),x.current&&(x.current.resolve(P),x.current=null);},[d]),F=useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),d?.onError&&d.onError(P),x.current&&(x.current.reject(P),x.current=null);},[d]),O=useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:b,beginWithdraw:C,closeWithdraw:R}),[t,S,b,C,R]);return jsx(Gc,{client:o,children:jsx(Mm.Provider,{value:O,children:jsxs(Pi,{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsx(Fl,{visible:n,onClose:b,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:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?Yu():void 0,onDepositSuccess:p,onDepositError:f,theme:y,sheetBorderRadius:r?.sheetBorderRadius}),d&&jsx(Hl,{visible:l,onClose:R,publishableKey:t,externalUserId:d.externalUserId,senderAddress:d.senderAddress,recipientAddress:d.recipientAddress,sourceChainType:d.sourceChainType,sourceChainId:d.sourceChainId,sourceTokenAddress:d.sourceTokenAddress,sourceTokenSymbol:d.sourceTokenSymbol,defaultDestinationChainType:d.defaultDestinationChainType,defaultDestinationChainId:d.defaultDestinationChainId,defaultDestinationTokenAddress:d.defaultDestinationTokenAddress,onWithdraw:d.withdraw,onWithdrawSuccess:A,onWithdrawError:F,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Yy(){let e=useContext(Mm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
3
+ export{La as AmountScreen,ct as BottomSheet,Ba as KYCWizardScreen,$a as OnrampScreen,qa as StripeOnramp,Ku as StripeOnrampPreconfigure,Gy as UnifoldProvider,be as getPreferredIcon,Ea as getStripePublishableKey,Ra as getSupportedDestinationTokens,X as normalizeIconUrl,Qa as registerStripeOnramp,tu as setDevApiUrl,Wa as setStripeOnrampApiUrl,Aa as setStripeOnrampPublishableKey,sa as useAllowedCountry,za as useStripeOnramp,D as useTheme,Yy as useUnifold};