@unifold/connect-react-native 0.1.49 → 0.1.50-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- 'use strict';var qi=require('react'),reactNative=require('react-native'),Yt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),gm=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),zu=require('@react-native-async-storage/async-storage'),Qb=require('expo-constants'),QC=require('react-native-qrcode-svg/src/genMatrix'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var qi__namespace=/*#__PURE__*/_interopNamespace(qi);var Yt__default=/*#__PURE__*/_interopDefault(Yt);var gm__default=/*#__PURE__*/_interopDefault(gm);var zu__default=/*#__PURE__*/_interopDefault(zu);var Qb__default=/*#__PURE__*/_interopDefault(Qb);var QC__default=/*#__PURE__*/_interopDefault(QC);var sm=e=>{throw TypeError(e)};var Lg=(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 Zd=(e,t,r)=>t.has(e)||sm("Cannot "+r);var y=(e,t,r)=>(Zd(e,t,"read from private field"),r?r.call(e):t.get(e)),ue=(e,t,r)=>t.has(e)?sm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),$=(e,t,r,o)=>(Zd(e,t,"write to private field"),t.set(e,r),r),ct=(e,t,r)=>(Zd(e,t,"access private method"),r);var Ga=(e,t,r,o)=>({set _(n){$(e,t,n);},get _(){return y(e,t,o)}});var Xd={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)"}},eu=Xd;function ic(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Ja(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,T)=>{let h=o?.[p]?.[g];if(h!==void 0)return h;let m=t?.[p]?.[g];return m!==void 0?m:T},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,d=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:ic(s,i)},transferCrypto:{depositAddress:{card:ic(s,a)}},depositCard:{quoteProvider:{card:ic(s,l)}},depositTracker:{executionRow:{card:ic(s,d)}}}}function tu(e,t,r){let n={...Xd[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var ru=qi.createContext(null);function W(){let e=qi.useContext(ru);if(!e){let t=eu.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Ja(t,void 0,"dark"),isDark:true}}return e}function wt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=W(),l=s??a.primary,d=i??a.primary,p=qi.useRef(new reactNative.Animated.Value(0)).current,g=qi.useId(),T=qi.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),h=(e-t)/2,m=2*Math.PI*h,w=e/2,x=o??Math.max(0,Math.round(e-t*2-8)),k=(e-x)/2;qi.useEffect(()=>{let v=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),S=requestAnimationFrame(()=>v.start());return ()=>{cancelAnimationFrame(S),v.stop();}},[p]);let R=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:R}]},children:jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Yt.Defs,{children:jsxRuntime.jsxs(Yt.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Yt.Stop,{offset:"100%",stopColor:d})]})}),jsxRuntime.jsx(Yt.Circle,{cx:w,cy:w,r:h,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${m*.75} ${m*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:k+1.5,left:k,width:x,height:x},children:r}):null]})}function nu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Qs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Za({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ur({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ys({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function st({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function el({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function hn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Yt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Js({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function en({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ac({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function um({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Yt.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Yt.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function pm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Yt.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mm({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Yt__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Yt.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(Yt.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Yt.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function Zs({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=qi.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),d=qi.useMemo(()=>{let h=o?.[l];return tu(l,h,r)},[l,o,r]),p=qi.useMemo(()=>Ja(d,i,l),[d,i,l]),g=qi.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),T=qi.useMemo(()=>({mode:l,colors:d,fonts:g,components:p,isDark:l==="dark"}),[l,d,g,p]);return jsxRuntime.jsx(ru.Provider,{value:T,children:e})}var il={damping:28,stiffness:300,mass:.8},cy=80,dy=500;function _t({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:d=false,borderTopLeftRadius:p=24,borderTopRightRadius:g=24,marginHorizontal:T,marginBottom:h,overlay:m,useModal:w=true}){let{colors:x}=W(),{height:k}=reactNative.useWindowDimensions(),[R,v]=qi.useState(false),S=qi.useRef(e);S.current=e;let _=qi.useRef(0),u=i!=null&&i>=1,c=u||d?0:reactNative.Platform.OS==="ios"?34:24,C=a!=null&&i!=null&&a>i,f=i!=null?(C?a:i)*k:void 0,L=C?(a-i)*k:0,B=l?0:L,D=gm.useSharedValue(k),P=qi.useRef(null),A=qi.useCallback(()=>{P.current&&(clearTimeout(P.current),P.current=null),S.current||v(false);},[]);qi.useEffect(()=>{e?(P.current&&(clearTimeout(P.current),P.current=null),v(true),D.value=gm.withSpring(B,il)):R&&(D.value=gm.withTiming(k,{duration:250},J=>{J&&gm.runOnJS(A)();}),P.current=setTimeout(()=>{P.current=null,A();},350));},[e]),qi.useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]),qi.useEffect(()=>{R&&e&&(D.value=gm.withSpring(B,il));},[B,C]);let U=qi.useCallback(()=>{o&&t();},[o,t]),q=qi.useMemo(()=>{if(!(!n&&!C))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{_.current=D.value;},onPanResponderMove:(J,Z)=>{if(Math.abs(Z.dy)<4)return;let K=_.current+Z.dy;D.value=Math.max(0,K);},onPanResponderRelease:(J,Z)=>{if(!(Math.abs(Z.dy)<4)){if(n&&(Z.dy>cy||Z.vy>dy)){t();return}if(C){let K=L/2,Y=D.value<K?0:L;D.value=gm.withSpring(Y,il);}else D.value=gm.withSpring(B,il);}},onPanResponderTerminate:()=>{D.value=gm.withSpring(B,il);}}).panHandlers},[n,C,L,B,D,t]),Le=gm.useAnimatedStyle(()=>({transform:[{translateY:D.value}]})),ie=gm.useAnimatedStyle(()=>({opacity:gm.interpolate(D.value,[0,k*.5,k],[.5,.25,0],gm.Extrapolation.CLAMP)}));if(!R)return null;let qe=jsxRuntime.jsxs(reactNative.View,{style:[Kn.root,!w&&Kn.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(gm__default.default.View,{style:[Kn.backdrop,ie],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:U})}),jsxRuntime.jsxs(gm__default.default.View,{style:[Kn.sheet,Le,{height:f,backgroundColor:x.background,borderTopLeftRadius:u?0:p,borderTopRightRadius:u?0:g,...T?{marginHorizontal:T,marginBottom:h??T+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:p,borderBottomRightRadius:g}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:f!=null?Kn.gestureRoot:Kn.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Kn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Kn.handle,{backgroundColor:x.foreground+"33"}]})}),r,c>0&&jsxRuntime.jsx(reactNative.View,{style:{height:c}})]}),q&&jsxRuntime.jsx(reactNative.View,{...q,style:Kn.dragOverlay})]})]});return w?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[qe,m]}):qe}var Kn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{position:"absolute",left:0,right:0,top:0,bottom:0,zIndex:9999},backdrop:{position:"absolute",left:0,right:0,top:0,bottom:0,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),St=qi__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));St.displayName="BottomSheetScrollView";function Xs(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var uy="https://api.unifold.io",au="__UnifoldDevApiBaseUrl__",Hr="pk_test_123",dc={};function py(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[au];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function fr(){return py()??uy}function uc(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.'),Hr=e.publishableKey;}e.defaultConfig&&(dc=e.defaultConfig);}function Cm(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[au]=t:delete globalThis[au];}function sl(){return fr()}function pc(){return Hr}function no(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function Nt(e){let t=e.startsWith("/")?e:`/${e}`;return `${fr()}/api/public${t}`}function se(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,fr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${fr()}${e}`:`${fr()}/api/public${e}`:""}async function tn(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||dc.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||dc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||dc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Hr;no(n);let s=await fetch(`${fr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Mo(e,t){return e.find(r=>r.chain_type===t)}async function rn(e,t,r){let o=t||Hr;no(o);let n=await fetch(`${fr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function mc(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function Ie(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||Hr;no(r);let o=`${fr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function lu(e,t){let r=t||Hr;no(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${fr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function fc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function cu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function du(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function uu(e,t){let r=t||Hr;no(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${fr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function al(e){let t=e||Hr;no(t);let r=await fetch(`${fr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function _i(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 ll(e){let t=e||Hr;no(t);let r=await fetch(`${fr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function pu(){let e=await fetch(`${fr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function hc(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function cl(){let e=await fetch(`${fr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function gc(e){let t=e||Hr;no(t);let r=await fetch(`${fr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function mu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function fu(e,t){return mc(e.deposit_wallet_id,t)}async function yc(e,t,r,o,n){let s=n||Hr;no(s);let i=await fetch(`${fr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function hu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function gu(e="usd",t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function yu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}function Sm({size:e=28}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Yt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Yt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function km({size:e=28}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Yt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Yt.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Yt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Yt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Yt.Defs,{children:jsxRuntime.jsx(Yt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Yt.Rect,{width:28,height:28,fill:"white"})})})]})}function _m({size:e=28}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Yt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Yt.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(Yt.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(Yt.Defs,{children:jsxRuntime.jsx(Yt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Yt.Rect,{width:28,height:28,fill:"white"})})})]})}function Im({size:e=28}){return jsxRuntime.jsxs(Yt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Yt.Defs,{children:[jsxRuntime.jsxs(Yt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Yt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Yt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Yt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Yt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Yt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Yt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Yt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Yt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Yt.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(Yt.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(Yt.Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function vm({size:e=28}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Yt.G,{children:[jsxRuntime.jsx(Yt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var bc=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Sm},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:km},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:_m},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Im},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:vm}];function Cc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function wc(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 ra(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=bc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=bc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function $t({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=W(),i=r==="back",a=i?jsxRuntime.jsx(Ys,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(pt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ii.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:Ii.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Ii.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Ii.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Ii.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Ii.headerWithTitle:Ii.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Ii.headerSpacer}),!i&&l]})}var Sc={paddingTop:8,paddingBottom:8},Ii=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Sc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Sc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function fo({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=W();return e?jsxRuntime.jsx(reactNative.Text,{style:[Pm.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Pm.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Pm=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function on({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(qi.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function ku({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=qi.useState(false),{colors:a,components:l}=W(),d=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Cc(r);return jsxRuntime.jsxs(qi.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:d,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(st,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(Zo,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Tc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function oa({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=W(),s=e.toLowerCase(),i=Tc[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function kc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=W(),d=Nt(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ra(r);return jsxRuntime.jsxs(reactNative.View,{style:[zo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:zo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:zo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[zo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[zo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Ur,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:zo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:zo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:zo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[zo.tokenIcon,{backgroundColor:Tc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[zo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[zo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[zo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var zo=reactNative.StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function Cn(){let{colors:e,fonts:t,components:r}=W(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return qi.useMemo(()=>{let l=i.borderRadius,d={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},g={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),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}:{}}},m={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:d,quote:g,pm:h,wallet:m,flow:w,amount:p}},[e,t,o,n,s,i,a])}var Vm="",Om;function xc(e){Vm=e;}function Rc(e){Om=e;}function bo(){let e=Vm||pc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Co(){return Om??sl()}async function _c(){let e=`${Co()}/v1/public/onramps/headless/stripe/config`,t=bo(),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 xu(e){let t=await fetch(`${Co()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":bo(),"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 Lm(e,t){let r=await fetch(`${Co()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":bo(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function Ru(e,t){let r=await fetch(`${Co()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":bo(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function Bm(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(`${Co()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":bo(),"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 Am(e,t){let r=await fetch(`${Co()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":bo(),"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 Yn(e,t){let r=`${Co()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":bo(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function Wm(e){let t=`${Co()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":bo(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function Em(e,t){let r=`${Co()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":bo(),"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 _u(e,t){let r=await fetch(`${Co()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":bo(),"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 Iu(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(`${Co()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":bo(),"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 vu(e,t){let r=await fetch(`${Co()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":bo(),"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 Mm(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(`${Co()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":bo(),"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 vi(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 zm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Co()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":bo()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function My({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Yt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Yt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function zy({size:e=24}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Yt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Yt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Yt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Uy({size:e=24}){return jsxRuntime.jsx(Yt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Yt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Yt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Yt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsxRuntime.jsx(Yt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Yt.Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsxRuntime.jsx(Yt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Yt.Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsxRuntime.jsx(Yt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Yt.Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsxRuntime.jsx(Yt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Yt.Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsxRuntime.jsx(Yt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Yt.Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function Fu({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Qs,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(My,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(zy,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Uy,{size:t}):jsxRuntime.jsx(Qs,{size:t*.75,color:r,strokeWidth:1.75})}function Ic(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var Vu={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Ou(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function jm({status:e,colors:t,fontFamily:r}){let o=Ou(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Vu[e]??e})})}function qm({count:e=4}){let{colors:t,components:r}=W(),o=qi.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:na.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[na.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:na.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[na.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[na.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[na.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var na=reactNative.StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Km({active:e,interval:t=15e3,color:r}){let o=qi.useRef(new reactNative.Animated.Value(0)).current;return qi.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Qm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=W(),[s,i]=qi.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,d=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=Ou(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",h=(l?.destination_currency??"").toUpperCase(),m=e.destination_token_metadata,w=vi(m?.icon_urls,m?.icon_url),x=ra(l?.destination_network??""),k=l?.wallet_address?Cc(l.wallet_address):null,R=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,v=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,S=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):null,_=[{label:"Amount",value:g},{label:"Received",value:`${T} ${h}`},...S?[{label:"Payment",value:S}]:[],{label:"Network",value:x},...k?[{label:"Wallet",value:k}]:[],...R?[{label:"Network Fee",value:R}]:[],...v?[{label:"Transaction Fee",value:v}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx($t,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(St,{style:Ar.scroll,contentContainerStyle:Ar.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ar.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(oa,{currency:h||"USD",tokenIconUrl:w,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Ar.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:d?jsxRuntime.jsx(oo,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(st,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ar.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ar.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Vu[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Ar.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Ic(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ar.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ar.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(st,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Zo,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),_.map(u=>jsxRuntime.jsx(qi__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Ar.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:u.label}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:u.value})]})},u.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Ar.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Ar.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Ar=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function Gm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=W(),[i,a]=qi.useState(false),l=d=>{a(false),e(d);};return jsxRuntime.jsxs(reactNative.View,{style:Sn.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Sn.trigger,onPress:()=>a(d=>!d),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(um,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Sn.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Sn.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Sn.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(oo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Sn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Sn.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(mo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Sn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Sn.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(pm,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Sn.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Sn=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var tb=[50,100,500],rb=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Zm(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ob(e){return e.card?`${Zm(e.card.brand)} ${Zm(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Dc({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:d,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:T,onConfirm:h,onCancel:m,sheetBorderTopLeftRadius:w,sheetBorderTopRightRadius:x,accessToken:k,showHistoryProgressBar:R=true,onLogout:v,onRequestKYC:S,showSwitchAccount:_=true,inputDisabled:u=false}){let c=Cn(),{colors:C,components:f,fonts:L}=W(),B=w??f.card.borderRadius,D=x??f.card.borderRadius,[P,A]=qi.useState(e),[U,q]=qi.useState(r?"apple_pay":g.length>0?g[0].id:null),Le=qi.useRef(false),ie=I=>{Le.current=true,q(I);};qi.useEffect(()=>{Le.current||r||g.length>0&&q(g[0].id);},[g,r]);let[qe,J]=qi.useState(false),[Z,K]=qi.useState("select"),[Y,ge]=qi.useState(null),te=qi.useRef(false);qi.useEffect(()=>{l&&d&&/saving/i.test(d)&&K("card");},[l,d]);let fe=s,De=fe!=null&&fe>0,ve=qi.useMemo(()=>{if(o)return [];let I=tb.map(b=>({label:`$${b}`,amount:String(b),disabled:false}));return I.push({label:"MAX",amount:De?String(fe):"0",disabled:!De}),I},[o,De,fe]),it=I=>{if(I==="\u232B"){A(b=>b.slice(0,-1));return}if(I==="."){if(P.includes("."))return;A(b=>b===""?"0.":b+".");return}A(b=>{let V=b.indexOf(".");return V!==-1&&b.length-V>2?b:b==="0"&&I!=="."?I:b+I});},Ue=P===""?"0":P,Ke=parseFloat(P),He=n!=null&&!isNaN(Ke)&&Ke>0&&Ke<n,Qe=fe!=null&&fe>0&&!isNaN(Ke)&&Ke>fe,We=P!==""&&!isNaN(Ke)&&Ke>0&&!He&&!Qe,Ve=r||g.length>0,Ee=i==="header",re=qi.useMemo(()=>{let I=[];r&&I.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let b of g)I.push({id:b.id,label:ob(b),hint:b.card?`Expires ${b.card.exp_month}/${b.card.exp_year}`:b.type,brand:b.card?.brand,isApplePay:false});return I},[r,g]),ye=re.find(I=>I.id===U),Ye=U!=null&&U!=="apple_pay",bt=ye?ye.label:Ye&&Y?Y:Ye?"Card":"Pay With",tr=ye?!ye.isApplePay:Ye,Re=ye?.brand??Y??void 0,[Se,ke]=qi.useState(false),[at,Me]=qi.useState([]),[Ce,Pe]=qi.useState(false),[Pt,Ot]=qi.useState(null),[Rt,ft]=qi.useState(null),dr=qi.useRef(null);dr.current=Rt;let Be=qi.useRef(false);Be.current=Se;let Ct=qi.useCallback(async(I=false)=>{if(k){I||(Pe(true),Ot(null));try{let b=await Wm(k);if(!Be.current)return;let V=Array.isArray(b.data)?b.data:Array.isArray(b)?b:[];Me(V),I||Ot(null);let O=dr.current?.id;if(O){let Q=V.find(M=>M.id===O);Q&&ft(Q);}}catch(b){if(!Be.current)return;I||Ot(b?.message??"Failed to load history");}finally{!I&&Be.current&&Pe(false);}}},[k]),et=qi.useCallback(()=>{ke(true),Ct();},[Ct]);qi.useEffect(()=>{if(!Se||!k)return;let I=setInterval(()=>Ct(true),15e3);return ()=>clearInterval(I)},[Se,k,Ct]);let _e=qi.useCallback(I=>{switch(I){case "history":et();break;case "kyc":S?.();break;case "logout":v?.();break}},[et,S,v]),z=!!k||!!S||!!v?jsxRuntime.jsx(Gm,{onSelect:_e,showKycOption:!!S,showSwitchAccount:_&&!!v}):void 0,ae=Ve?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ee?c.amount.paymentRowHeader:c.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(K("select"),J(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:c.amount.paymentLeft,children:[ye?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):tr?jsxRuntime.jsx(Fu,{sublabel:Re,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:c.amount.paymentLabel,children:bt}),jsxRuntime.jsx(Gt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:c.form.screen,children:[jsxRuntime.jsx($t,{onPress:m,title:"Enter amount",leftAction:z}),Ee&&ae,jsxRuntime.jsxs(reactNative.View,{style:c.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.amountText,Ue==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ue]}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.currencyLabel,children:t.toUpperCase()}),He&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.minAmountText,{color:C.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),Qe&&fe!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.minAmountText,{color:C.warning}],children:["Maximum amount is $",fe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!Ee&&ae,ve.length>0&&jsxRuntime.jsx(reactNative.View,{style:c.amount.quickRow,children:ve.map(I=>{let b=!I.disabled&&P===I.amount&&P!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,b&&{backgroundColor:C.primary},I.disabled&&{opacity:.4}],activeOpacity:.7,disabled:I.disabled||l,onPress:()=>A(I.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.quickPillText,b&&{color:C.primaryForeground}],children:I.label})},I.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:rb.map((I,b)=>jsxRuntime.jsx(reactNative.View,{style:c.amount.numpadRow,children:I.map(V=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.numpadKey,(l||u)&&{opacity:.3}],onPress:()=>it(V),activeOpacity:.6,disabled:l||u,children:jsxRuntime.jsx(reactNative.Text,{style:V==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:V})},V))},b))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.form.continueBtn,(!We||l||u)&&c.form.continueBtnDisabled],onPress:()=>We&&!l&&!u&&h(P,U),disabled:!We||l||u,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,(!We||u)&&c.form.continueBtnTextDisabled],children:"Continue"})}),!qe&&p?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:p}):!qe&&l&&d&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:d}):null]}),jsxRuntime.jsx(_t,{visible:qe,onClose:()=>{l||(J(false),K("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:B,borderTopRightRadius:D,children:jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetContent,children:Z==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(pt,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(St,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[re.map(I=>{let b=U===I.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[c.amount.sheetOption,b&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{ie(I.id),ge(I.isApplePay?null:I.label),J(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetOptionIcon,children:I.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Fu,{sublabel:I.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:I.label}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:I.hint})]})]}),b&&jsxRuntime.jsx(st,{size:18,color:C.primary,strokeWidth:2.5})]},I.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!te.current){te.current=true;try{let I=await T?.();I&&(ie(I.token),ge(I.sublabel),J(!1));}finally{te.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||K("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Ys,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:d||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{a&&We&&a(false,P);},children:jsxRuntime.jsx(reactNative.Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(_t,{visible:Se,onClose:()=>{ke(false),ft(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:B,borderTopRightRadius:D,children:Rt?jsxRuntime.jsx(Qm,{session:Rt,onBack:()=>ft(null)}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetContent,children:[jsxRuntime.jsx($t,{onPress:()=>ke(false),title:"Purchase History"}),R&&jsxRuntime.jsx(Km,{active:Se&&!Ce&&at.length>0,color:C.primary}),Ce?jsxRuntime.jsx(qm,{}):Pt?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:Pt})}):at.length===0?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.sheetStatusText,{color:C.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(St,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:at.map(I=>{let b=I.transaction_details,V=b?.source_amount?`$${parseFloat(b.source_amount).toFixed(2)}`:"\u2014",O=(b?.destination_currency??"").toUpperCase(),Q=b?.destination_amount?`${parseFloat(b.destination_amount).toFixed(2)} ${O}`:"",M=Ic(I.created),$e=I.destination_token_metadata,Ne=vi($e?.icon_urls,$e?.icon_url),Gr=vi($e?.chain?.icon_urls,$e?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.sheetOption,activeOpacity:.7,onPress:()=>ft(I),children:[jsxRuntime.jsx(oa,{currency:O||"USD",tokenIconUrl:Ne,networkIconUrl:Gr,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:V}),Q?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:Q}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(jm,{status:I.status,colors:C,fontFamily:L.regular}),M?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:C.foregroundMuted,fontFamily:L.regular},children:M}):null]}),jsxRuntime.jsx(Ur,{size:14,color:C.foregroundMuted,strokeWidth:2})]})]},I.id)})})]})})]})}function Vc({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Cn(),{colors:i,fonts:a,components:l}=W(),d=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[T,h]=qi.useState(1),[m,w]=qi.useState(e.firstName??""),[x,k]=qi.useState(e.lastName??""),[R,v]=qi.useState(e.dobMonth??""),[S,_]=qi.useState(e.dobDay??""),[u,c]=qi.useState(e.dobYear??""),[C,f]=qi.useState(e.addressLine1??""),[L,B]=qi.useState(e.addressLine2??""),[D,P]=qi.useState(e.city??""),[A,U]=qi.useState(e.state??""),[q,Le]=qi.useState(e.postalCode??""),[ie,qe]=qi.useState(e.country??"US"),[J,Z]=qi.useState(e.idNumber??""),K=qi.useRef(null),Y=qi.useRef(null),ge=qi.useRef(null),te=qi.useRef(null),fe=qi.useRef(null),De=qi.useRef(null),ve=qi.useRef(null),it=qi.useRef(null),Ue=p[T-1],Ke=()=>{switch(Ue){case "name":return m.trim().length>0&&x.trim().length>0;case "dob":return R.length===2&&S.length===2&&u.length===4;case "address":return C.trim().length>0&&D.trim().length>0&&A.trim().length>0&&q.trim().length>0;case "ssn":return J.trim().length>0;default:return false}},He=()=>{Ke()&&(T<g?h(re=>re+1):o({firstName:m,lastName:x,idNumber:J,dobMonth:R,dobDay:S,dobYear:u,addressLine1:C,addressLine2:L,city:D,state:A,postalCode:q,country:ie}));},Qe=()=>{T>1?h(re=>re-1):n();},We={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:Ve}=We[Ue],Ee=[wr.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:wr.header,children:[jsxRuntime.jsx(reactNative.View,{style:wr.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wr.iconButton,onPress:Qe,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(Za,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:wr.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Ee,children:[T," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:wr.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(pt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:wr.progressTrack,children:Array.from({length:g}).map((re,ye)=>jsxRuntime.jsx(reactNative.View,{style:[wr.progressSegment,{backgroundColor:ye<T||ye+1===T?i.primary:i.border}]},ye))}),jsxRuntime.jsx(St,{style:s.form.flex,contentContainerStyle:wr.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:Ve}),Ue==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jn,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:d,value:m,onChangeText:w,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>K.current?.focus()})}),jsxRuntime.jsx(Jn,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:K,style:s.form.input,placeholder:"Doe",placeholderTextColor:d,value:x,onChangeText:k,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:He})})]}),Ue==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:wr.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:wr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,wr.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,wr.dobInput],placeholder:"MM",placeholderTextColor:d,value:R,onChangeText:re=>{let ye=re.replace(/\D/g,"").slice(0,2);v(ye),ye.length===2&&Y.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,wr.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[s.form.input,wr.dobInput],placeholder:"DD",placeholderTextColor:d,value:S,onChangeText:re=>{let ye=re.replace(/\D/g,"").slice(0,2);_(ye),ye.length===2&&ge.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,wr.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ge,style:[s.form.input,wr.dobInput],placeholder:"YYYY",placeholderTextColor:d,value:u,onChangeText:re=>{let ye=re.replace(/\D/g,"").slice(0,4);c(ye);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:He})]})]}),Ue==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jn,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:d,value:C,onChangeText:f,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})}),jsxRuntime.jsx(Jn,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:d,value:L,onChangeText:B,returnKeyType:"next",onSubmitEditing:()=>fe.current?.focus()})}),jsxRuntime.jsx(Jn,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:fe,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:d,value:D,onChangeText:P,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>De.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:wr.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Jn,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:De,style:s.form.input,placeholder:"CA",placeholderTextColor:d,value:A,onChangeText:re=>U(re.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>ve.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(Jn,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ve,style:s.form.input,placeholder:"94001",placeholderTextColor:d,value:q,onChangeText:Le,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>it.current?.focus()})})})]}),jsxRuntime.jsx(Jn,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:it,style:s.form.input,placeholder:"US",placeholderTextColor:d,value:ie,onChangeText:re=>qe(re.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:He})})]}),Ue==="ssn"&&jsxRuntime.jsxs(Jn,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:d,value:J,onChangeText:Z,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:He}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,wr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&T>=g?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Ke()&&s.form.continueBtnDisabled],onPress:He,disabled:!Ke(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Ke()&&s.form.continueBtnTextDisabled],children:T>=g?"Submit":"Continue"})})})]})})}function Jn({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var wr=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Uu="@unifold/stripe_oauth";async function ef(){try{let e=await zu__default.default.getItem(Uu);return e?JSON.parse(e):null}catch{return null}}async function Hu(e){try{await zu__default.default.setItem(Uu,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function aa(){try{await zu__default.default.removeItem(Uu);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var ub=5,Bi=null,Nu=false,$u={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Oc(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:d,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[h,m]=qi.useState(r),[w,x]=qi.useState(!!e?.externalUserId),[k,R]=qi.useState(false),[v,S]=qi.useState(false),[_,u]=qi.useState(""),[c,C]=qi.useState(null),[f,L]=qi.useState(e?.email??""),[B,D]=qi.useState(e?.phone??""),[P,A]=qi.useState(""),[U,q]=qi.useState("US"),[Le,ie]=qi.useState(""),[qe,J]=qi.useState(""),Z=qi.useRef(""),K=qi.useRef(""),Y=qi.useRef(""),[ge,te]=qi.useState(false),[fe,De]=qi.useState(false),ve=qi.useRef(0),it=qi.useRef(false),Ue=qi.useRef(false),Ke=qi.useRef(false),He=qi.useRef(false),Qe=qi.useRef(e?.email??""),We=qi.useRef(false),Ve=qi.useRef(null),Ee=qi.useRef(""),re=qi.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ye=qi.useRef(null),[Xe,Ye]=qi.useState(0),[bt,tr]=qi.useState($u),[Re,Se]=qi.useState(e?.defaultWalletAddress??""),[ke,at]=qi.useState(""),[Me,Ce]=qi.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Pe,Pt]=qi.useState(e?.defaultSourceAmount??"100"),[Ot,Rt]=qi.useState(e?.defaultSourceCurrency??"usd"),[ft,dr]=qi.useState(e?.defaultDestinationCurrency??"usdc"),[Be,Ct]=qi.useState(null),[et,_e]=qi.useState(),[be,z]=qi.useState(),[ae,I]=qi.useState(false),b=qi.useRef(null),V=qi.useRef(false),O=qi.useRef(0),Q=qi.useRef(e?.onComplete),M=qi.useRef(e?.onError),$e=qi.useRef(e?.onStepChange),Ne=qi.useRef(r);qi.useEffect(()=>{Q.current=e?.onComplete;},[e?.onComplete]),qi.useEffect(()=>{M.current=e?.onError;},[e?.onError]),qi.useEffect(()=>{$e.current=e?.onStepChange;},[e?.onStepChange]);let Gr=qi.useRef(r);qi.useEffect(()=>{h!==Gr.current&&($e.current?.(h,Gr.current),Gr.current=h),Ne.current=h;},[h]),qi.useEffect(()=>{v&&h!=="email"&&S(false);},[v,h]),qi.useEffect(()=>{w&&h!==r&&x(false);},[w,h,r]);let X=qi.useCallback((F,E,le)=>{let xe={code:F,message:E,step:Ne.current,stripeErrorCode:le};C(xe),u(""),M.current?.(xe);},[]),$s=qi.useCallback(F=>{let E={sessionId:F.id,status:F.status,sourceAmount:F.transaction_details.source_amount,sourceCurrency:F.transaction_details.source_currency,destinationAmount:F.transaction_details.destination_amount,destinationCurrency:F.transaction_details.destination_currency,destinationNetwork:F.transaction_details.destination_network,walletAddress:F.transaction_details.wallet_address,fees:{networkFee:F.transaction_details.fees.network_fee_amount,transactionFee:F.transaction_details.fees.transaction_fee_amount}};return Q.current?.(E),E},[]),Lt=qi.useCallback(()=>C(null),[]),Fe=F=>F.refresh_token??F.refresh?.refresh_token??"",Ft=qi.useCallback((F,E,le,xe,Te)=>{K.current=E,Z.current=le,e?.externalUserId&&Hu({accessToken:E,refreshToken:le,customerId:F,externalUserId:e.externalUserId,email:Te||f,expiresAt:Date.now()+xe*1e3});},[e?.externalUserId,f]),tt=qi.useCallback(async()=>{let F=Z.current;if(!F)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let E=await Ru(F,Y.current??void 0),le=E.access_token,xe=Fe(E)||F;return J(le),Ft(Y.current,le,xe,E.expires_in??3600),le}catch(E){return console.error("[tryRefreshAccessToken] refresh failed:",E?.message),await aa(),Bi=null,ye.current=null,K.current="",Z.current="",Y.current="",J(""),ie(""),null}},[Ft]),Ge=qi.useCallback(async F=>{try{return await F(K.current)}catch(E){let le=E?.message??"";if(le.includes("stripe_onramp_forbidden")||le.includes("403")){let xe=await tt();if(!xe)throw X("authorization_error","Session expired. Please sign in again."),m("email"),E;return await F(xe)}throw E}},[tt,X]);qi.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){I(false);return}let E=false;return stripeReactNative.isPlatformPaySupported().then(le=>{E||I(le);}),()=>{E=true;}},[e?.merchantIdentifier]),qi.useEffect(()=>(V.current=false,()=>{V.current=true,b.current&&clearTimeout(b.current);}),[]);let ro=qi.useRef(false);qi.useEffect(()=>{if(ro.current)return;if(!e?.externalUserId){aa(),Bi=null,ye.current=null,x(false);return}let F=false;return (async()=>{try{let E=await ef();if(F||!E){F||x(!1);return}if(E.externalUserId!==e.externalUserId){await aa(),Bi=null,ye.current=null,F||x(!1);return}let le=Date.now()>=E.expiresAt,xe=E.accessToken,Te=E.refreshToken;if(le)try{let lt=await Ru(E.refreshToken,E.customerId);if(F)return;xe=lt.access_token,Te=lt.refresh_token??lt.refresh?.refresh_token??E.refreshToken,await Hu({accessToken:xe,refreshToken:Te,customerId:E.customerId,externalUserId:e.externalUserId,email:E.email,expiresAt:Date.now()+(lt.expires_in??3600)*1e3});}catch(lt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",lt?.message),await aa(),Bi=null,ye.current=null,F||x(!1);return}if(F)return;if(ro.current=!0,ie(E.customerId),Y.current=E.customerId,J(xe),K.current=xe,Z.current=Te,E.email&&(L(E.email),Qe.current=E.email),Bi===E.customerId)ye.current=Promise.resolve({error:void 0});else {let lt=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:E.customerId});lt.error?console.error("[useStripeOnramp] restore configureSDK error:",lt.error.message):Bi=E.customerId,ye.current=Promise.resolve(lt);}if(F)return;let rt=()=>new Promise(lt=>{let rr=()=>{We.current&&Ee.current?lt():setTimeout(rr,200);};rr();});try{if(await Promise.race([rt(),new Promise((rr,ht)=>setTimeout(()=>ht(new Error("timeout")),1e4))]),F)return;let lt=Ee.current.toLowerCase();await p(lt,re.current);}catch(lt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",lt?.message);}if(F)return;try{let rr=(await Yn(Y.current,K.current)).kyc_tiers??[],ht=rr.find(Io=>Io.tier==="l0"),Fr=rr.find(Io=>Io.tier==="l1"),Jr=rr.find(Io=>Io.tier==="l2"),zr=ht?.verification_status==="verified",Jo=Fr?.verification_status==="verified",or=Jr?.verification_status==="verified",jn=!!ht?.verification_status&&ht.verification_status!=="not_started";m(zr||Jo||or?"session_params":jn?"kyc_offer":"kyc");}catch{m("kyc");}}finally{F||x(false);}})(),()=>{F=true;}},[]),qi.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ge)return;let F=false;De(true);async function E(){try{let[le,xe]=await Promise.all([Mm({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?zm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(or=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",or?.message),null)):Promise.resolve(null)]);if(F)return;let Te=e?.destinationChainType??"ethereum",rt=le.data.find(or=>or.chain_type===Te);if(rt?.address){let or=rt.address.toLowerCase();Se(or),Ee.current=or,rt.recipient_address&&at(rt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",Te,"in",le.data?.length,"wallets");let lt={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},rr={8453:"base",1:"ethereum",137:"polygon"},ht=xe?.destination_network,Fr="none";if(ht&&lt[ht])Ce(lt[ht]),re.current=lt[ht],Fr=ht+" (from default_token API)";else if(e?.destinationChainId&&rr[e.destinationChainId]){let or=rr[e.destinationChainId];lt[or]&&(Ce(lt[or]),re.current=lt[or]),Fr=or+" (from chain_id "+e.destinationChainId+")";}else lt[Te]&&(Ce(lt[Te]),re.current=lt[Te],Fr=Te+" (from chain_type fallback)");xe?.destination_currency&&dr(xe.destination_currency.toLowerCase());let Jr=xe?.destination_token_metadata,zr=vi(Jr?.icon_urls,Jr?.icon_url),Jo=vi(Jr?.chain?.icon_urls,Jr?.chain?.icon_url);zr&&_e(zr),Jo&&z(Jo),te(!0),We.current=!0;}catch(le){if(F)return;console.error("[resolveWallet] Failed to resolve wallet:",le?.message),te(true),We.current=true;}finally{F||De(false);}}return Ve.current=E(),()=>{F=true;}},[e?.publishableKey,e?.externalUserId,Xe]);let qt=qi.useCallback(async()=>{if(ye.current)return ye.current;let F=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(E=>(E.error&&(console.error("[useStripeOnramp] configureSDK error:",E.error.message,E.error.code),ye.current=null),E)).catch(E=>{throw console.error("[useStripeOnramp] configureSDK threw:",E?.message??E),ye.current=null,E});return ye.current=F,F},[o,e?.merchantDisplayName]);qi.useEffect(()=>{e?.externalUserId||qt();},[]);let Mr=qi.useCallback(async F=>{if(!it.current){it.current=true,R(true),Lt(),u("Creating auth intent...");try{let E=await xu(F);u("Waiting for authorization...");let le=await i(E);if(le?.error){X("authorization_error","Something went wrong during authorization. Please try again."),m("email");return}if(le?.status==="Denied"){X("authorization_error","Authorization denied by user."),m("email");return}if(le?.status!=="Consented"||!le.customerId){X("authorization_error","Authorization was canceled."),m("email");return}u("Exchanging tokens...");let xe=le.customerId,Te=await Lm(E,xe),rt=Te.access_token,lt=Fe(Te);L(F),Qe.current=F,ie(xe),Y.current=xe,Bi=xe,J(rt),Ft(xe,rt,lt,Te.expires_in??3600,F),u("Checking verification status...");try{let ht=(await Yn(xe,rt)).kyc_tiers??[],Fr=ht.find(po=>po.tier==="l0"),Jr=ht.find(po=>po.tier==="l1"),zr=ht.find(po=>po.tier==="l2"),Jo=Fr?.verification_status==="verified",or=Jr?.verification_status==="verified",jn=zr?.verification_status==="verified",Io=!!Fr?.verification_status&&Fr.verification_status!=="not_started";if(u(""),Jo||or||jn){Ve.current&&(u("Resolving wallet..."),await Ve.current,u(""));let po=Ee.current;if(po)try{let xi=po.toLowerCase(),nc=re.current,qn=await p(xi,nc);qn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",qn.error.message),X("wallet_error",qn.error.message,qn.error.code),m("wallet")):m("session_params");}catch(xi){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",xi?.message),m("wallet");}else m("wallet");}else Io?(await $n(),u(""),m("kyc_offer")):m("kyc");}catch(rr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",rr?.message),u(""),m("kyc");}}catch(E){X("authorization_error",E?.message??String(E)),m("email");}finally{it.current=false,R(false);}}},[i,Lt,X,Ft,p,Me]),Br=qi.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!f){X("validation_error","Please enter an email address.");return}R(true),Lt(),u("");try{u("Configuring...");let F=await qt();if(F.error){X("configuration_error",F.error.message,F.error.code);return}u("Checking Link account...");let E=await n(f);if(E.error){X("authorization_error",E.error.message,E.error.code);return}E.hasLinkAccount?await Mr(f):(u(""),m("disclaimer"));}catch(F){X("unknown_error",F?.message??String(F));}finally{R(false);}},[Lt,qt,f,X,n,Mr]),js=qi.useCallback(async()=>{if(!Ke.current){if(!B){X("validation_error","Please enter your phone number.");return}Ke.current=true,R(true),Lt(),u("");try{u("Creating Link account...");let F=await s({email:f,phone:B,fullName:P||f,country:U||"US"});if(F.error){X("registration_error",F.error.message,F.error.code);return}await Mr(f);}catch(F){X("registration_error",F?.message??String(F));}finally{Ke.current=false,R(false);}}},[Lt,U,f,X,P,B,s,Mr]);qi.useEffect(()=>{if(h!=="email")return;let F=He.current||Nu;if(F&&(He.current=false,Nu=false),!e?.email||w)return;if(F){S(true);return}let E=++ve.current,le=false,xe=()=>le||ve.current!==E;return e?.phone?(async()=>{R(true),Lt();try{u("Configuring...");let Te=await qt();if(xe())return;if(Te.error){X("configuration_error",Te.error.message,Te.error.code);return}u("Checking Link account...");let rt=await n(e.email);if(xe())return;if(rt.error){X("authorization_error",rt.error.message,rt.error.code);return}if(rt.hasLinkAccount){if(xe())return;await Mr(e.email);}else {if(xe())return;u(""),m("disclaimer");}}catch(Te){xe()||X("unknown_error",Te?.message??String(Te));}finally{R(false);}})():(async()=>{R(true),Lt();try{u("Configuring...");let Te=await qt();if(xe())return;if(Te.error){X("configuration_error",Te.error.message,Te.error.code);return}u("Checking Link account...");let rt=await n(e.email);if(xe())return;if(rt.error){X("authorization_error",rt.error.message,rt.error.code);return}if(rt.hasLinkAccount){if(xe())return;await Mr(e.email);}else {if(xe())return;u(""),m("disclaimer");}}catch(Te){xe()||X("unknown_error",Te?.message??String(Te));}finally{R(false);}})(),()=>{le=true;}},[h,e?.email,e?.phone,w]);let $n=qi.useCallback(async()=>{Ve.current&&(u("Resolving wallet..."),await Ve.current);let F=Ee.current;if(F)try{u("Registering wallet...");let E=F.toLowerCase(),le=re.current;await p(E,le);}catch(E){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",E?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),ec=qi.useCallback(async(F,E)=>{R(true),Lt(),u(""),tr(rt=>({...rt,...F}));let le=!E,xe=E??"kyc_offer",Te=E?"kyc_l1":"kyc";try{let rt=F.dobDay&&F.dobMonth&&F.dobYear,lt=F.firstName&&F.lastName,rr={};lt&&(rr.firstName=F.firstName,rr.lastName=F.lastName),F.addressLine1&&(rr.address={line1:F.addressLine1,line2:F.addressLine2||void 0,city:F.city,state:F.state,postalCode:F.postalCode,country:F.country}),F.idNumber&&(rr.idNumber=F.idNumber),rt&&(rr.dateOfBirth={day:parseInt(F.dobDay,10),month:parseInt(F.dobMonth,10),year:parseInt(F.dobYear,10)});let ht=await a(rr);if(ht?.error?.message&&(/no active link consumer/i.test(ht.error.message)||/not be verified/i.test(ht.error.message))){if(u("Verifying identity..."),!await as()){X("kyc_error","Please verify your identity to continue."),m(Te);return}ht=await a(rr);}if(ht?.error){let or=le?"l0":"l1";try{let Io=(await Yn(Y.current,K.current)).kyc_tiers?.find(po=>po.tier===or);if(Io?.verification_status==="verified"){let po=le?"session_params":xe;await $n(),u(""),m(po);return}if(Io?.verification_status==="rejected"){if(le){await $n(),u(""),m(xe);return}X("kyc_error","Something went wrong. Please try again."),m(Te);return}}catch(jn){console.warn("[attachKyc] could not fetch verification status:",jn?.message);}if(le){await $n(),u(""),m(xe);return}X("kyc_error",ht.error.message,ht.error.stripeErrorCode??ht.error.code),m(Te);return}if(!(ht&&Object.keys(ht).length>0&&!ht.error)){let or=le?"l0":"l1";if(u("Verifying identity..."),(!Y.current||!K.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${or} \u2014 missing customerIdRef or accessTokenRef`),!le)){X("kyc_error","Unable to verify identity. Please try again."),m(Te);return}let jn=Y.current,Io=K.current,po=10,xi=!1;if(jn&&Io)for(let nc=0;nc<po;nc++){try{let Jd=(await Yn(jn,Io)).kyc_tiers?.find(Og=>Og.tier===or);if(Jd?.verification_status==="verified"){xi=!0;break}if(Jd?.verification_status==="rejected"){if(le)break;console.warn(`[attachKyc] \u274C ${or} rejected:`,Jd?.verification_errors),X("kyc_error","KYC verification was rejected. Please try again."),m(Te);return}}catch(qn){console.warn(`[attachKyc] ${or} poll error:`,qn?.message);}await new Promise(qn=>setTimeout(qn,2e3));}if(!xi&&!le){console.warn(`[attachKyc] \u274C ${or} verification timed out after`,po,"attempts"),X("kyc_error","Identity verification is taking longer than expected. Please try again."),m(Te);return}await $n(),u(""),m(le&&xi?"session_params":xe);return}u("Please review your KYC information...");let zr=await l(null);if(zr?.error){X("kyc_error",zr.error.message,zr.error.stripeErrorCode??zr.error.code),m(Te);return}if(zr?.status==="UpdateAddress"){X("kyc_error","Please update your address and resubmit."),m(Te);return}await $n(),u(""),m(le?"session_params":xe);}catch(rt){X("kyc_error",rt?.message??String(rt)),m(Te);}finally{R(false);}},[a,Lt,X,l,$n]),as=qi.useCallback(async()=>{let F=Qe.current||e?.email;if(!F)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(Qe.current),"config.email:",e?.email),false;try{let E=await xu(F),le=await i(E);return le?.status==="Consented"&&le.customerId?(Y.current=le.customerId,ie(le.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",le?.status),!1)}catch(E){return console.warn("[reestablishLinkSession] failed:",E?.message),false}},[i,e?.email]),tc=qi.useCallback(async()=>{if(!Ue.current){Ue.current=true,R(true),Lt(),u("Launching identity verification...");try{let F=await d();if(F?.error?.message&&(/no active link consumer/i.test(F.error.message)||/not be verified/i.test(F.error.message))){if(u("Verifying identity..."),!await as()){X("identity_error","Please verify your identity to continue.");return}F=await d();}if(F?.error){let le=F.error.message??"";if(/cancel/i.test(le)){u("");return}X("identity_error",le,F.error.code);return}u(""),ls.current?(ls.current=!1,m("session_params")):m("wallet");}catch(F){X("identity_error",F?.message??String(F));}finally{Ue.current=false,R(false);}}},[Lt,X,as,d]),ls=qi.useRef(false);qi.useEffect(()=>{h==="identity"&&!k&&tc();},[h]);let rc=qi.useCallback(async()=>{if(!Re){X("validation_error","Please enter a wallet address.");return}R(true),Lt(),u("");try{let F=Re.toLowerCase(),E=await p(F,Me);if(E?.error){console.warn("[registerWallet] error:",E.error.message),X("wallet_error",E.error.message,E.error.code);return}u(""),m("kyc_offer");}catch(F){console.error("[registerWallet] exception:",F?.message??String(F)),X("wallet_error",F?.message??String(F));}finally{R(false);}},[Lt,X,Re,Me,p]);qi.useEffect(()=>{h==="wallet"&&ge&&Re&&rc();},[h,ge,Re]);let qs=qi.useCallback(F=>{V.current=false,O.current=0;let E=0,le=async()=>{E+=1;let xe=K.current;try{let Te=await Em(F,xe);if(V.current)return;O.current=0,Te.status==="fulfillment_complete"?(Ct(Te),m("success")):b.current=setTimeout(le,3e3);}catch(Te){if(V.current)return;let rt=Te?.message??"";if((rt.includes("stripe_onramp_forbidden")||rt.includes("403"))&&await tt()&&!V.current){b.current=setTimeout(le,1e3);return}if(O.current+=1,console.error(`[pollSessionStatus] poll #${E} error:`,rt),O.current>=ub){X("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}b.current=setTimeout(le,5e3);}};b.current=setTimeout(le,3e3);},[X,tt]),Yd=qi.useCallback(()=>{if(Ne.current==="processing"&&Be?.id){if(!K.current){X("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Lt(),O.current=0,b.current&&(clearTimeout(b.current),b.current=null),qs(Be.id);}},[Lt,X,qs,Be?.id]),Ti=qi.useCallback(async F=>{R(true),Lt(),u("");try{u("Confirming purchase...");let E=await Ge(le=>Am(F,le));Ct(E),m("processing"),u(""),qs(E.id);}finally{R(false);}},[Lt,qs,Ge]),Ya=qi.useRef(false),Gd=qi.useCallback(async()=>{if(!(!Be||Ya.current)){Ya.current=true;try{R(!0),Lt(),u("Refreshing quote...");let F=await Ge(E=>_u(Be.id,E));Ct(F),await Ti(F.id);}catch{X("session_error","Something went wrong. Please try again."),m("quote");}finally{R(false),Ya.current=false;}}},[Lt,X,Ti,Be,Ge]),de=qi.useCallback(async(F=false,E,le)=>{let xe=E??Pe;if(!xe||isNaN(Number(xe))||Number(xe)<=0){X("validation_error","Please enter a valid amount.");return}E&&Pt(E),R(true),Lt(),u("");try{let Te=await qt();if(Te.error){X("configuration_error",Te.error.message,Te.error.code);return}let rt;if(le)rt=le;else if(F){if(!e?.merchantIdentifier?.trim()){X("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),m("session_params");return}u("Opening Apple Pay...");let ht={applePay:{merchantCountryCode:"US",currencyCode:Ot.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ft.toUpperCase()} purchase + fees`,amount:xe}]}},Fr=await g("PlatformPay",ht);if(Fr?.error){let zr=Fr.error.message??"",Jo=Fr.error.code??"";/cancel/i.test(zr)||/cancel/i.test(Jo)||(X("payment_error",zr,Jo),m("session_params"));return}if(!Fr?.displayData)return;u("Creating payment token...");let Jr=await T();if(Jr?.error){X("payment_error",Jr.error.message,Jr.error.code),m("session_params");return}rt=Jr.cryptoPaymentToken;}else {u("Select a payment method...");let ht=await g("Card");if(ht?.error){let Jr=ht.error.message??"",zr=ht.error.code??"";/cancel/i.test(Jr)||/cancel/i.test(zr)||(X("payment_error",Jr,zr),m("session_params"));return}if(!ht?.displayData)return;u("Creating payment token...");let Fr=await T();if(Fr?.error){X("payment_error",Fr.error.message,Fr.error.code),m("session_params");return}rt=Fr.cryptoPaymentToken;}u("Creating onramp session...");let lt=Ee.current||Re;if(!lt){X("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let rr=await Ge(ht=>Bm({cryptoCustomerId:Y.current,paymentToken:rt,sourceAmount:Number(xe),sourceCurrency:Ot,destinationCurrency:ft,walletAddress:lt,destinationNetwork:Me},ht));Ct(rr),u(""),F?await Ti(rr.id):m("quote");}catch{X("session_error","Something went wrong. Please try again."),m("session_params");}finally{R(false),u("");}},[Lt,qt,g,T,ft,X,Ti,Pt,Pe,Ot,Re,Me,Ge,e?.merchantIdentifier]),ze=qi.useCallback(async()=>{R(true),Lt(),u("Select a payment method...");try{let F=await qt();if(F.error)return X("configuration_error",F.error.message,F.error.code),null;let E=await g("Card");if(E?.error?.message&&(/no active link consumer/i.test(E.error.message)||/not be verified/i.test(E.error.message))){if(!await as())return X("authorization_error","Please verify your identity to add a payment method."),null;E=await g("Card");}if(E?.error){let rt=E.error.message??"",lt=E.error.code??"";return /cancel/i.test(rt)||/cancel/i.test(lt)||X("payment_error",rt,lt),null}if(!E?.displayData)return null;let xe=E.displayData;u("Saving payment method...");let Te=await T();return Te?.error?(X("payment_error",Te.error.message,Te.error.code),null):{token:Te.cryptoPaymentToken,sublabel:xe.sublabel??""}}catch(F){return X("session_error",F?.message??String(F)),null}finally{R(false),u("");}},[Lt,qt,g,T,X,as]),mr=qi.useCallback(async()=>{if(Be){R(true),Lt(),u("");try{let F=await Ge(E=>_u(Be.id,E));Ct(F);}catch{X("session_error","Something went wrong. Please try again.");}finally{R(false);}}},[Lt,X,Be,Ge]),fn=qi.useCallback(()=>{V.current=true,O.current=0,b.current&&(clearTimeout(b.current),b.current=null),m(r),R(false),S(false),u(""),C(null),L(e?.email??""),Qe.current=e?.email??"",D(e?.phone??""),A(""),q("US"),ie(""),Y.current="",J(""),K.current="",Z.current="",te(false),De(false),Ve.current=null,Ye(F=>F+1),tr($u),Se(""),Ee.current="",We.current=false,Ce(stripeReactNative.Onramp.CryptoNetwork.ethereum),Pt(e?.defaultSourceAmount??"100"),Rt(e?.defaultSourceCurrency??"usd"),dr(e?.defaultDestinationCurrency??"usdc"),at(""),_e(void 0),z(void 0),Ct(null),ve.current+=1,it.current=false,Ue.current=false,Ke.current=false;},[e,r]),oc=qi.useCallback(()=>{ls.current=true,m("kyc_offer");},[]),ki=qi.useCallback(async()=>{await aa(),Bi=null,ye.current=null,Nu=true,He.current=true,V.current=true,O.current=0,b.current&&(clearTimeout(b.current),b.current=null),ve.current+=1,it.current=false,Ue.current=false,Ke.current=false,K.current="",Z.current="",Y.current="",Ee.current="",We.current=false,Ve.current=null,J(""),ie(""),L(e?.email??""),Qe.current=e?.email??"",D(e?.phone??""),A(""),q("US"),Ct(null),C(null),R(false),S(false),u(""),tr($u),Se(""),te(false),De(false),Ye(F=>F+1),at(""),_e(void 0),z(void 0),m(r);},[e?.email,e?.phone,r]);return {step:h,restoring:w,loading:k,status:_,error:c,email:f,phone:B,fullName:P,country:U,customerId:Le,accessToken:qe,session:Be,kycData:bt,walletAddress:Re,resolvedRecipientAddress:ke,walletNetwork:Me,sourceAmount:Pe,sourceCurrency:Ot,destinationCurrency:ft,tokenIconUrl:et,networkIconUrl:be,applePaySupported:ae,walletReady:ge,walletLoading:fe,setStep:m,setStatus:u,setEmail:L,setPhone:D,setFullName:A,setCountry:q,setWalletAddress:Se,setWalletNetwork:Ce,setSourceAmount:Pt,setSourceCurrency:Rt,setDestinationCurrency:dr,checkEmail:Br,register:js,attachKyc:ec,verifyIdentity:tc,requestKYCUpgrade:oc,kycUpgradeMode:ls,logout:ki,registerWallet:rc,collectPaymentMethod:de,addPaymentMethod:ze,refreshQuote:mr,confirmCheckout:Gd,reset:fn,clearError:Lt,emitComplete:$s,resumeFulfillmentPolling:Yd,amountFirst:t,switchingAccount:v}}function tf({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Cn(),{colors:a,fonts:l,components:d}=W(),p=d.input.placeholderColor,[g,T]=qi.useState(e.dobMonth??""),[h,m]=qi.useState(e.dobDay??""),[w,x]=qi.useState(e.dobYear??""),[k,R]=qi.useState(e.idNumber??""),[v,S]=qi.useState(null),_=qi.useRef(null),u=qi.useRef(null),c=qi.useRef(null),C=g.length===2&&h.length===2&&w.length===4&&k.trim().length>0,f=()=>{if(!C)return;let B=parseInt(g,10),D=parseInt(h,10),P=parseInt(w,10),A=new Date().getFullYear();if(B<1||B>12){S("Please enter a valid month (01\u201312).");return}if(D<1||D>31){S("Please enter a valid day (01\u201331).");return}if(P<1900||P>A){S(`Please enter a valid year (1900\u2013${A}).`);return}S(null),o({dobMonth:g,dobDay:h,dobYear:w,idNumber:k});},L=v||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx($t,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(St,{style:i.form.flex,contentContainerStyle:xn.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:xn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:xn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:xn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,xn.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:B=>{let D=B.replace(/\D/g,"").slice(0,2);T(D),D.length===2&&_.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:xn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:_,style:[i.form.input,xn.dobInput],placeholder:"DD",placeholderTextColor:p,value:h,onChangeText:B=>{let D=B.replace(/\D/g,"").slice(0,2);m(D),D.length===2&&u.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:xn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:[i.form.input,xn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:w,onChangeText:B=>{let D=B.replace(/\D/g,"").slice(0,4);x(D),D.length===4&&c.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:xn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:c,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:k,onChangeText:R,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:f,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),L?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:L}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!C&&i.form.continueBtnDisabled],onPress:f,disabled:!C,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!C&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var xn=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function rf({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=qi.useRef(new reactNative.Animated.Value(.3)).current;return qi.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Dt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:Dt.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Dt.skeletonLine,{width:"60%"}]})]})}function of({onRefresh:e,colors:t,fonts:r}){let[o,n]=qi.useState(10),s=qi.useRef(null);qi.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=qi.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:Dt.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(Js,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[Dt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function lf({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:d="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:T=false,currentLimit:h}){let m=Cn(),{colors:w,fonts:x,components:k}=W(),R=[Dt.card,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius??12,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],v=[...R,{opacity:.5}],S=l==="verified",_=l==="pending",u=l==="rejected",c=d==="verified",C=d==="pending",f=S&&c,L=!S,B=!c,D=S,P=(T||S)&&!f,A=U=>`$${U.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx($t,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Dt.content,children:[h!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[Dt.limitBadge,{backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth,borderRadius:k.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.limitLabel,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.limitValue,{color:w.foreground,fontFamily:x.semibold}],children:[A(h)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.subtitle,{color:w.foregroundMuted,fontFamily:x.regular}],children:i?"Checking your verification status...":f?"All verification levels have been completed. Your limits are at the maximum available.":T?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(rf,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth}),jsxRuntime.jsx(rf,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L&&(_?jsxRuntime.jsxs(reactNative.View,{style:R,children:[jsxRuntime.jsxs(reactNative.View,{style:Dt.pendingHeader,children:[jsxRuntime.jsx(mo,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardTitle,{color:w.foreground,fontFamily:x.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(of,{onRefresh:n,colors:w,fonts:x}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Dt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(wt,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[R,Dt.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(mo,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Dt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardTitle,{color:w.foreground,fontFamily:x.semibold}],children:u?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:u?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Ur,{size:18,color:w.foregroundMuted,strokeWidth:2})]})),B&&(C?jsxRuntime.jsxs(reactNative.View,{style:R,children:[jsxRuntime.jsxs(reactNative.View,{style:Dt.pendingHeader,children:[jsxRuntime.jsx(ac,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardTitle,{color:w.foreground,fontFamily:x.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(of,{onRefresh:n,colors:w,fonts:x}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Dt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(wt,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):D?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[R,Dt.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(ac,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Dt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardTitle,{color:w.foreground,fontFamily:x.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Ur,{size:18,color:w.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[v,Dt.cardRow],children:[jsxRuntime.jsx(ac,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Dt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardTitle,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Dt.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[m.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:Dt.loaderRow,children:[jsxRuntime.jsx(wt,{size:24,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[m.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):f?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Done"})}):P?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Dt=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var Ac={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function df({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=W(),a=[ln.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:ln.logoRow,children:jsxRuntime.jsx(mm,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:ln.scroll,contentContainerStyle:ln.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[ln.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[ln.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ln.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[ln.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Ac.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Ac.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Ac.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Ac.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var ln=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function uf({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:d}){let{colors:p}=W();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(wt,{size:56,strokeWidth:3}),jsxRuntime.jsx(fo,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(fo,{error:n,progress:s,loading:o})]})]})})}function mf({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(wt,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(fo,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function hf({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:d,onRetryStatusCheck:p}){let{colors:g}=W(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx($t,{onPress:d}):jsxRuntime.jsx(reactNative.View,{style:Sc}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(wt,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
- `,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(kc,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(fo,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function gf({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:d}){let{colors:p}=W(),g=t.transaction_details,T=wc(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:d??l,title:"Review your purchase",variant:d?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(oa,{currency:g.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(on,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(on,{quote:e.quote,label:"You receive",value:`${T} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(on,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(on,{quote:e.quote,label:"Transaction fee",value:`$${g.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(fo,{error:o,progress:n,loading:r})]})]})}function yf({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:d}){let p=W(),{colors:g,fonts:T,components:h}=p,[m,w]=qi.useState("");qi.useEffect(()=>{if(t)return;let R=m?`+1${m}`:"";a(R);},[m,a,t]);let x=qi.useCallback(R=>{w(R.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(wt,{size:56,strokeWidth:3}),jsxRuntime.jsx(fo,{error:o,progress:n,loading:r})]})]});let k=m.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:Tl.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Tl.countryPrefix,{backgroundColor:h.card.backgroundColor,borderColor:h.input.borderColor,borderRadius:h.input.borderRadius,borderWidth:h.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Tl.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Tl.dialCode,{color:g.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Tl.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:m,onChangeText:x,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>k&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!k&&e.form.continueBtnDisabled],onPress:l,disabled:!k,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!k&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(fo,{error:o,progress:n,loading:r})]})]})})}var Tl=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function zb({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=W(),n=e.toLowerCase(),s=Tc[n]??o.primary,i=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[vn.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[vn.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[vn.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(st,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function bf({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:d}=W(),p=t.transaction_details,g=wc(p.destination_amount,p.destination_currency),T=r||o||"";ra(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(St,{style:e.form.flex,contentContainerStyle:vn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:vn.iconSection,children:[jsxRuntime.jsx(zb,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:vn.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[vn.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[vn.statusText,{color:a.foreground,fontFamily:d.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[vn.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(kc,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},vn.detailCard],children:[jsxRuntime.jsx(on,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(on,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(on,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(on,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(ku,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(ku,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(on,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var vn=reactNative.StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function Cf({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:d,registerWallet:p,onClose:g}){let{colors:T,components:h}=W();if(t){let m=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!m&&jsxRuntime.jsx(wt,{size:56,strokeWidth:3}),jsxRuntime.jsx(fo,{error:o,progress:n,loading:r})]}),m&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx($t,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:h.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:bc.map(m=>{let w=i===m.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,w&&e.wallet.rowSelected],onPress:()=>{l(m.value),d(m.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(m.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,w&&e.wallet.rowTextSelected],children:m.label}),w&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(st,{size:14,color:h.container.buttonTitleColor,strokeWidth:2.5})})]},m.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(fo,{error:o,progress:n,loading:r})]})]})})}function Hc({config:e,onClose:t}){let r=W(),o=Cn(),{step:n,restoring:s,loading:i,status:a,error:l,email:d,phone:p,session:g,kycData:T,walletAddress:h,resolvedRecipientAddress:m,walletNetwork:w,sourceAmount:x,sourceCurrency:k,destinationCurrency:R,tokenIconUrl:v,networkIconUrl:S,applePaySupported:_,setStep:u,setEmail:c,setPhone:C,setWalletAddress:f,setWalletNetwork:L,setSourceAmount:B,setDestinationCurrency:D,checkEmail:P,register:A,attachKyc:U,verifyIdentity:q,registerWallet:Le,collectPaymentMethod:ie,addPaymentMethod:qe,confirmCheckout:J,reset:Z,emitComplete:K,resumeFulfillmentPolling:Y,amountFirst:ge,customerId:te,accessToken:fe,requestKYCUpgrade:De,kycUpgradeMode:ve,logout:it,clearError:Ue,switchingAccount:Ke}=Oc(e),He=!!e?.email&&!Ke,Qe=!!e?.phone,We=!!e?.publishableKey&&!!e?.externalUserId,[Ve,Ee]=qi.useState(void 0),[re,ye]=qi.useState(void 0),[Xe,Ye]=qi.useState([]),[bt,tr]=qi.useState(false),[Re,Se]=qi.useState(false),[ke,at]=qi.useState(null),[Me,Ce]=qi.useState(null),[Pe,Pt]=qi.useState(null),[Ot,Rt]=qi.useState(false),ft=qi.useCallback(async()=>{await it(),t?.();},[it,t]);qi.useEffect(()=>{n!=="kyc_offer"||!te||!fe||(Rt(true),Yn(te,fe).then(_e=>{let be=_e.kyc_tiers??[],z=be.find(b=>b.tier==="l0"),ae=be.find(b=>b.tier==="l1"),I=be.find(b=>b.tier==="l2");z?.verification_status&&at(z.verification_status),ae?.verification_status&&Ce(ae.verification_status),I?.verification_status&&Pt(I.verification_status);}).catch(_e=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",_e?.message);}).finally(()=>Rt(false)),h&&Iu({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:fe,cryptoCustomerId:te}).then(_e=>{let be=_e.limits?.usd;if(be?.card?.length){let z=Math.max(...be.card.map(ae=>ae.limit));Ee(z);}}).catch(_e=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",_e?.message);}));},[n,te,fe,h,w]),qi.useEffect(()=>{if(s||n!=="session_params"||!te||!fe)return;let _e=z=>{let ae=z?.message??"";return ae.includes("stripe_onramp_forbidden")||ae.includes("403")},be=z=>{_e(z)&&ft();};Yn(te,fe).then(z=>{let ae=z.kyc_tiers??[],I=ae.find(M=>M.tier==="l0"),b=ae.find(M=>M.tier==="l1"),V=ae.find(M=>M.tier==="l2"),O=!!b?.verification_status&&b.verification_status!=="not_started",Q=V?.verification_status==="verified";tr(O),Se(!!Q),I?.verification_status&&at(I.verification_status),b?.verification_status&&Ce(b.verification_status),V?.verification_status&&Pt(V.verification_status);}).catch(z=>{console.warn("[OnrampScreen] customer fetch error:",z?.message),be(z);}),vu(te,fe).then(z=>{Ye(z.data??[]);}).catch(z=>{console.warn("[OnrampScreen] payment_tokens error:",z?.message),be(z);}),h&&Iu({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:fe,cryptoCustomerId:te}).then(z=>{let ae=z.limits?.usd;if(ae?.card?.length){let I=Math.max(...ae.card.map(b=>b.limit));Ee(I);}}).catch(z=>{console.warn("[OnrampScreen] transaction_limits error:",z?.message),be(z);}),al(e?.publishableKey).then(z=>{let ae=z.data?.find(I=>I.currency_code==="usd");ae&&ye(ae.minimum_amount);}).catch(z=>{console.warn("[OnrampScreen] fiat_currencies error:",z?.message);});},[s,n,te,fe,h,w,Z,ft]);let dr=async()=>{if(!(!te||!fe))try{let _e=await vu(te,fe);Ye(_e.data??[]);}catch(_e){console.warn("[OnrampScreen] payment_tokens refresh error:",_e?.message);let be=_e?.message??"";(be.includes("stripe_onramp_forbidden")||be.includes("403"))&&ft();}},Be=async()=>{let _e=await qe();return _e&&await dr(),_e},Ct=e?.skipSuccessConfirmation===true;qi.useEffect(()=>{n==="success"&&Ct&&g&&(K(g),Z(),t?.());},[n,Ct,g,K,Z,t]),qi.useEffect(()=>{n==="register"&&Qe&&A();},[n,Qe,A]);let et=()=>{Z(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[Kb.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(wt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(df,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>u("register"),onClose:()=>u("email")});if(n==="email")return jsxRuntime.jsx(uf,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:He,loading:i,error:l,status:a,email:d,setEmail:c,checkEmail:P,onClose:et});if(n==="register")return jsxRuntime.jsx(yf,{styles:o,hasPrefilledPhone:Qe,loading:i,error:l,status:a,email:d,phone:p,setPhone:C,register:A,onClose:et});if(n==="kyc")return jsxRuntime.jsx(Vc,{initialData:T,loading:i,onComplete:U,onCancel:et});if(n==="kyc_offer"){let z=ke==="verified"||Me==="verified"||Pe==="verified",ae=()=>{ve.current&&(ve.current=false),u("session_params");};return jsxRuntime.jsx(lf,{onSelectL1:()=>u("kyc_l1"),onSelectL2:()=>{ve.current=true,u("identity");},onSkip:ae,onClose:()=>{ve.current?(ve.current=false,u("session_params")):z?ae():et();},onRefresh:()=>{!te||!fe||(Rt(true),Yn(te,fe).then(V=>{let O=V.kyc_tiers??[],Q=O.find(Ne=>Ne.tier==="l0"),M=O.find(Ne=>Ne.tier==="l1"),$e=O.find(Ne=>Ne.tier==="l2");Q?.verification_status&&at(Q.verification_status),M?.verification_status&&Ce(M.verification_status),$e?.verification_status&&Pt($e.verification_status);}).catch(V=>{console.warn("[OnrampScreen] refresh customer fetch error:",V?.message);}).finally(()=>Rt(false)));},loading:i,loadingTiers:Ot,error:l?.message,l1Status:Me??"not_started",l2Status:Pe??"not_started",l1Completed:bt,l2Completed:Re,canPurchase:z,currentLimit:z?Ve:void 0})}if(n==="kyc_l1"){let _e=ve.current?"session_params":"wallet";return jsxRuntime.jsx(tf,{initialData:T,loading:i,error:l?.message,onComplete:be=>{ve.current&&(ve.current=false),U(be,_e);},onCancel:()=>{Ue(),u("kyc_offer");},onClose:et})}return n==="identity"?jsxRuntime.jsx(mf,{styles:o,loading:i,status:a,error:l,verifyIdentity:q,onClose:()=>{ve.current?(ve.current=false,u("session_params")):et();}}):n==="wallet"?jsxRuntime.jsx(Cf,{styles:o,hasAutoWallet:We,loading:i,error:l,status:a,walletAddress:h,walletNetwork:w,setWalletAddress:f,setWalletNetwork:L,setDestinationCurrency:D,registerWallet:Le,onClose:et}):n==="session_params"?jsxRuntime.jsx(Dc,{initialAmount:x,currency:k,applePaySupported:_,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:re,maxAmount:Ve,paymentTokens:Xe,onAddPaymentMethod:Be,onCollectPayment:(_e,be)=>{ie(_e,be);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(_e,be)=>{if(ge&&!te)B(_e),u("email");else {let z=be==="apple_pay";ie(z,_e,!z&&be?be:void 0);}},onCancel:et,accessToken:fe,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:ft,onRequestKYC:De,showSwitchAccount:!He,inputDisabled:(ke!==null||Me!==null)&&ke!=="verified"&&Me!=="verified"&&Pe!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(gf,{styles:o,session:g,loading:i,error:l,status:a,confirmCheckout:J,tokenIconUrl:v,networkIconUrl:S,onClose:et,onBack:()=>u("session_params")}):n==="processing"?jsxRuntime.jsx(hf,{styles:o,error:l,status:a,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??R,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:v,networkIconUrl:S,onClose:et,onRetryStatusCheck:Y}):n==="success"&&g&&!Ct?jsxRuntime.jsx(bf,{styles:o,session:g,resolvedRecipientAddress:m,recipientFromConfig:e?.recipientAddress,tokenIconUrl:v,networkIconUrl:S,onDone:()=>{K(g),Z(),t?.();}}):null}var Kb=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function wf(){try{let e=Qb__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let s=n.trim();if(s.length>0)return s}}}catch{}}function Nc({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:d,onError:p,onStepChange:g,onClose:T,merchantIdentifier:h="",urlScheme:m="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:x=false,appName:k}){let{colors:R,fonts:v,components:S}=W(),_=e||pc(),u=qi.useMemo(()=>{let D=h.trim();return D.length>0?D:wf()??""},[h]),[c,C]=qi.useState("loading"),[f,L]=qi.useState(null);qi.useEffect(()=>{let D=false;async function P(){try{_&&(xc(_),Rc(sl()));let A=await _c();if(D)return;let U=u.trim();if(await stripeReactNative.initStripe({publishableKey:A,urlScheme:m,...U?{merchantIdentifier:U}:{}}),D)return;C("ready");}catch(A){if(D)return;console.error("[StripeOnramp] Init failed:",A),L(A?.message??"Failed to load Stripe configuration"),C("error");}}return P(),()=>{D=true;}},[_,u,m]);let B=qi.useMemo(()=>{let D={publishableKey:_,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:d,onError:p,onStepChange:g};return a&&(D.destinationTokenAddress=a),l&&(D.recipientAddress=l),t&&(D.email=t),r&&(D.phone=r),n&&(D.flowOrder=n),w&&(D.paymentSelectorPosition=w),D.skipSuccessConfirmation=x,D.merchantIdentifier=u,k&&(D.merchantDisplayName=k),D},[_,o,s,i,a,l,t,r,n,w,x,u,k,d,p,g]);return c==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ma.centered,{backgroundColor:R.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ma.errorText,{color:R.error,fontFamily:v.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ma.errorDetail,{color:R.foregroundMuted,fontFamily:v.regular}],children:f}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ma.retryBtn,{backgroundColor:S.button.primaryBackground,borderRadius:S.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[ma.retryBtnText,{color:S.button.primaryText,fontFamily:v.medium}],children:"Go Back"})})]}):c==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ma.centered,{backgroundColor:R.background}],children:jsxRuntime.jsx(wt,{size:56,strokeWidth:3,gradientFrom:R.primary,gradientTo:R.primary})}):jsxRuntime.jsx(Hc,{config:B,onClose:T})}var ma=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function xf(){let{configure:e}=stripeReactNative.useOnramp(),t=qi.useRef(false);return qi.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 Rf="__unifold_stripe_onramp__";function $c(e){globalThis[Rf]=e;}function _f(){return globalThis[Rf]}$c(Nc);var Pn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var gs,Ei,fa,If,oC=(If=class extends Pn{constructor(){super();ue(this,gs);ue(this,Ei);ue(this,fa);$(this,fa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Ei)||this.setEventListener(y(this,fa));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ei))==null||t.call(this),$(this,Ei,void 0));}setEventListener(t){var r;$(this,fa,t),(r=y(this,Ei))==null||r.call(this),$(this,Ei,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,gs)!==t&&($(this,gs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,gs)=="boolean"?y(this,gs):globalThis.document?.visibilityState!=="hidden"}},gs=new WeakMap,Ei=new WeakMap,fa=new WeakMap,If),ha=new oC;var nC={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Fn,ys,vf,iC=(vf=class{constructor(){ue(this,Fn,nC);ue(this,ys,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,ys)&&e!==y(this,Fn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,Fn),provider:e}),$(this,Fn,e),process.env.NODE_ENV!=="production"&&$(this,ys,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&$(this,ys,true),y(this,Fn).setTimeout(e,t)}clearTimeout(e){y(this,Fn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&$(this,ys,true),y(this,Fn).setInterval(e,t)}clearInterval(e){y(this,Fn).clearInterval(e);}},Fn=new WeakMap,ys=new WeakMap,vf),Dn=new iC;function Pf(e){setTimeout(e,0);}var Yu=typeof window>"u"||"Deno"in globalThis;function Or(){}function Vf(e,t){return typeof e=="function"?e(t):e}function kl(e){return typeof e=="number"&&e>=0&&e!==1/0}function qc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function cn(e,t){return typeof e=="function"?e(t):e}function ho(e,t){return typeof e=="function"?e(t):e}function Kc(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==xl(i,t.options))return false}else if(!ws(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function Qc(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(bs(t.options.mutationKey)!==bs(s))return false}else if(!ws(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function xl(e,t){return (t?.queryKeyHashFn||bs)(e)}function bs(e){return JSON.stringify(e,(t,r)=>Qu(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ws(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ws(e[r],t[r])):false}var sC=Object.prototype.hasOwnProperty;function jc(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Ff(e)&&Ff(t);if(!o&&!(Qu(e)&&Qu(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},d=0;for(let p=0;p<a;p++){let g=o?p:i[p],T=e[g],h=t[g];if(T===h){l[g]=T,(o?p<s:sC.call(e,g))&&d++;continue}if(T===null||h===null||typeof T!="object"||typeof h!="object"){l[g]=h;continue}let m=jc(T,h,r+1);l[g]=m,m===T&&d++;}return s===a&&d===s?e:l}function Yc(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 Ff(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qu(e){if(!Df(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Df(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Df(e){return Object.prototype.toString.call(e)==="[object Object]"}function Of(e){return new Promise(t=>{Dn.setTimeout(t,e);})}function Rl(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 jc(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 jc(e,t)}return t}function Lf(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Bf(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Cs=Symbol();function Gc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Cs&&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===Cs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Jc(e,t){return typeof e=="function"?e(...t):!!e}function Af(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 Vn=(()=>{let e=()=>Yu;return {isServer(){return e()},setIsServer(t){e=t;}}})();function _l(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Wf=Pf;function aC(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Wf,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var sr=aC();var ga,Mi,ya,Ef,lC=(Ef=class extends Pn{constructor(){super();ue(this,ga,true);ue(this,Mi);ue(this,ya);$(this,ya,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(){y(this,Mi)||this.setEventListener(y(this,ya));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Mi))==null||t.call(this),$(this,Mi,void 0));}setEventListener(t){var r;$(this,ya,t),(r=y(this,Mi))==null||r.call(this),$(this,Mi,t(this.setOnline.bind(this)));}setOnline(t){y(this,ga)!==t&&($(this,ga,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,ga)}},ga=new WeakMap,Mi=new WeakMap,ya=new WeakMap,Ef),ba=new lC;function cC(e){return Math.min(1e3*2**e,3e4)}function Gu(e){return (e??"online")==="online"?ba.isOnline():true}var Zc=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Xc(e){let t=false,r=0,o,n=_l(),s=()=>n.status!=="pending",i=w=>{if(!s()){let x=new Zc(w);T(x),e.onCancel?.(x);}},a=()=>{t=true;},l=()=>{t=false;},d=()=>ha.isFocused()&&(e.networkMode==="always"||ba.isOnline())&&e.canRun(),p=()=>Gu(e.networkMode)&&e.canRun(),g=w=>{s()||(o?.(),n.resolve(w));},T=w=>{s()||(o?.(),n.reject(w));},h=()=>new Promise(w=>{o=x=>{(s()||d())&&w(x);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),m=()=>{if(s())return;let w,x=r===0?e.initialPromise:void 0;try{w=x??e.fn();}catch(k){w=Promise.reject(k);}Promise.resolve(w).then(g).catch(k=>{if(s())return;let R=e.retry??(Vn.isServer()?0:3),v=e.retryDelay??cC,S=typeof v=="function"?v(r,k):v,_=R===true||typeof R=="number"&&r<R||typeof R=="function"&&R(r,k);if(t||!_){T(k);return}r++,e.onFail?.(r,k),Of(S).then(()=>d()?void 0:h()).then(()=>{t?T(k):m();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?m():h().then(m),n)}}var Ss,Mf,ed=(Mf=class{constructor(){ue(this,Ss);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),kl(this.gcTime)&&$(this,Ss,Dn.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vn.isServer()?1/0:300*1e3));}clearGcTimeout(){y(this,Ss)!==void 0&&(Dn.clearTimeout(y(this,Ss)),$(this,Ss,void 0));}},Ss=new WeakMap,Mf);function Uf(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,d=async()=>{let p=false,g=m=>{Af(m,()=>t.signal,()=>p=true);},T=Gc(t.options,t.fetchOptions),h=async(m,w,x)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&m.pages.length)return Promise.resolve(m);let R=(()=>{let u={client:t.client,queryKey:t.queryKey,pageParam:w,direction:x?"backward":"forward",meta:t.options.meta};return g(u),u})(),v=await T(R),{maxPages:S}=t.options,_=x?Bf:Lf;return {pages:_(m.pages,v,S),pageParams:_(m.pageParams,w,S)}};if(n&&s.length){let m=n==="backward",w=m?dC:zf,x={pages:s,pageParams:i},k=w(o,x);a=await h(x,k,m);}else {let m=e??s.length;do{let w=l===0?i[0]??o.initialPageParam:zf(o,a);if(l>0&&w==null)break;a=await h(a,w),l++;}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d;}}}function zf(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 dC(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ca,Ts,wa,qo,ks,qr,Il,xs,Lo,qf,ei,$f,jf=($f=class extends ed{constructor(t){super();ue(this,Lo);ue(this,Ca);ue(this,Ts);ue(this,wa);ue(this,qo);ue(this,ks);ue(this,qr);ue(this,Il);ue(this,xs);$(this,xs,false),$(this,Il,t.defaultOptions),this.setOptions(t.options),this.observers=[],$(this,ks,t.client),$(this,qo,y(this,ks).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,$(this,Ts,Nf(this.options)),this.state=t.state??y(this,Ts),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return y(this,Ca)}get promise(){return y(this,qr)?.promise}setOptions(t){if(this.options={...y(this,Il),...t},t?._type&&$(this,Ca,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Nf(this.options);r.data!==void 0&&(this.setState(Hf(r.data,r.dataUpdatedAt)),$(this,Ts,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,qo).remove(this);}setData(t,r){let o=Rl(this.state.data,t,this.options);return ct(this,Lo,ei).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){ct(this,Lo,ei).call(this,{type:"setState",state:t});}cancel(t){let r=y(this,qr)?.promise;return y(this,qr)?.cancel(t),r?r.then(Or).catch(Or):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return y(this,Ts)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>ho(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Cs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>cn(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:!qc(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),y(this,qr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),y(this,qr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,qo).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(y(this,qr)&&(y(this,xs)||ct(this,Lo,qf).call(this)?y(this,qr).cancel({revert:true}):y(this,qr).cancelRetry()),this.scheduleGc()),y(this,qo).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ct(this,Lo,ei).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&y(this,qr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(y(this,qr))return y(this,qr).continueRetry(),y(this,qr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let d=this.observers.find(p=>p.options.queryFn);d&&this.setOptions(d.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=d=>{Object.defineProperty(d,"signal",{enumerable:true,get:()=>($(this,xs,true),o.signal)});},s=()=>{let d=Gc(this.options,r),g=(()=>{let T={client:y(this,ks),queryKey:this.queryKey,meta:this.meta};return n(T),T})();return $(this,xs,false),this.options.persister?this.options.persister(d,g,this):d(g)},a=(()=>{let d={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:y(this,ks),state:this.state,fetchFn:s};return n(d),d})();(y(this,Ca)==="infinite"?Uf(this.options.pages):this.options.behavior)?.onFetch(a,this),$(this,wa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&ct(this,Lo,ei).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),$(this,qr,Xc({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:d=>{d instanceof Zc&&d.revert&&this.setState({...y(this,wa),fetchStatus:"idle"}),o.abort();},onFail:(d,p)=>{ct(this,Lo,ei).call(this,{type:"failed",failureCount:d,error:p});},onPause:()=>{ct(this,Lo,ei).call(this,{type:"pause"});},onContinue:()=>{ct(this,Lo,ei).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let d=await y(this,qr).start();if(d===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(d),y(this,qo).config.onSuccess?.(d,this),y(this,qo).config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Zc){if(d.silent)return y(this,qr).promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw ct(this,Lo,ei).call(this,{type:"error",error:d}),y(this,qo).config.onError?.(d,this),y(this,qo).config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc();}}},Ca=new WeakMap,Ts=new WeakMap,wa=new WeakMap,qo=new WeakMap,ks=new WeakMap,qr=new WeakMap,Il=new WeakMap,xs=new WeakMap,Lo=new WeakSet,qf=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ei=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,...Ju(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Hf(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return $(this,wa,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),sr.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),y(this,qo).notify({query:this,type:"updated",action:t});});},$f);function Ju(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Gu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Hf(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Nf(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 ko,Tt,Pl,go,Rs,Sa,ti,zi,Fl,Ta,ka,_s,Is,Ui,xa,Mt,vl,Zu,Xu,ep,tp,rp,op,np,Gf,Yf,sp=(Yf=class extends Pn{constructor(t,r){super();ue(this,Mt);ue(this,ko);ue(this,Tt);ue(this,Pl);ue(this,go);ue(this,Rs);ue(this,Sa);ue(this,ti);ue(this,zi);ue(this,Fl);ue(this,Ta);ue(this,ka);ue(this,_s);ue(this,Is);ue(this,Ui);ue(this,xa,new Set);this.options=r,$(this,ko,t),$(this,zi,null),$(this,ti,_l()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(y(this,Tt).addObserver(this),Kf(y(this,Tt),this.options)?ct(this,Mt,vl).call(this):this.updateResult(),ct(this,Mt,tp).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return ip(y(this,Tt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ip(y(this,Tt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ct(this,Mt,rp).call(this),ct(this,Mt,op).call(this),y(this,Tt).removeObserver(this);}setOptions(t){let r=this.options,o=y(this,Tt);if(this.options=y(this,ko).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ho(this.options.enabled,y(this,Tt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ct(this,Mt,np).call(this),y(this,Tt).setOptions(this.options),r._defaulted&&!Yc(this.options,r)&&y(this,ko).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,Tt),observer:this});let n=this.hasListeners();n&&Qf(y(this,Tt),o,this.options,r)&&ct(this,Mt,vl).call(this),this.updateResult(),n&&(y(this,Tt)!==o||ho(this.options.enabled,y(this,Tt))!==ho(r.enabled,y(this,Tt))||cn(this.options.staleTime,y(this,Tt))!==cn(r.staleTime,y(this,Tt)))&&ct(this,Mt,Zu).call(this);let s=ct(this,Mt,Xu).call(this);n&&(y(this,Tt)!==o||ho(this.options.enabled,y(this,Tt))!==ho(r.enabled,y(this,Tt))||s!==y(this,Ui))&&ct(this,Mt,ep).call(this,s);}getOptimisticResult(t){let r=y(this,ko).getQueryCache().build(y(this,ko),t),o=this.createResult(r,t);return pC(this,o)&&($(this,go,o),$(this,Sa,this.options),$(this,Rs,y(this,Tt).state)),o}getCurrentResult(){return y(this,go)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&y(this,ti).status==="pending"&&y(this,ti).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){y(this,xa).add(t);}getCurrentQuery(){return y(this,Tt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=y(this,ko).defaultQueryOptions(t),o=y(this,ko).getQueryCache().build(y(this,ko),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return ct(this,Mt,vl).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),y(this,go)))}createResult(t,r){let o=y(this,Tt),n=this.options,s=y(this,go),i=y(this,Rs),a=y(this,Sa),d=t!==o?t.state:y(this,Pl),{state:p}=t,g={...p},T=false,h;if(r._optimisticResults){let f=this.hasListeners(),L=!f&&Kf(t,r),B=f&&Qf(t,o,r,n);(L||B)&&(g={...g,...Ju(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:m,errorUpdatedAt:w,status:x}=g;h=g.data;let k=false;if(r.placeholderData!==void 0&&h===void 0&&x==="pending"){let f;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(f=s.data,k=true):f=typeof r.placeholderData=="function"?r.placeholderData(y(this,ka)?.state.data,y(this,ka)):r.placeholderData,f!==void 0&&(x="success",h=Rl(s?.data,f,r),T=true);}if(r.select&&h!==void 0&&!k)if(s&&h===i?.data&&r.select===y(this,Fl))h=y(this,Ta);else try{$(this,Fl,r.select),h=r.select(h),h=Rl(s?.data,h,r),$(this,Ta,h),$(this,zi,null);}catch(f){$(this,zi,f);}y(this,zi)&&(m=y(this,zi),h=y(this,Ta),w=Date.now(),x="error");let R=g.fetchStatus==="fetching",v=x==="pending",S=x==="error",_=v&&R,u=h!==void 0,C={status:x,fetchStatus:g.fetchStatus,isPending:v,isSuccess:x==="success",isError:S,isInitialLoading:_,isLoading:_,data:h,dataUpdatedAt:g.dataUpdatedAt,error:m,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:R,isRefetching:R&&!v,isLoadingError:S&&!u,isPaused:g.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:S&&u,isStale:ap(t,r),refetch:this.refetch,promise:y(this,ti),isEnabled:ho(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let f=C.data!==void 0,L=C.status==="error"&&!f,B=A=>{L?A.reject(C.error):f&&A.resolve(C.data);},D=()=>{let A=$(this,ti,C.promise=_l());B(A);},P=y(this,ti);switch(P.status){case "pending":t.queryHash===o.queryHash&&B(P);break;case "fulfilled":(L||C.data!==P.value)&&D();break;case "rejected":(!L||C.error!==P.reason)&&D();break}}return C}updateResult(){let t=y(this,go),r=this.createResult(y(this,Tt),this.options);if($(this,Rs,y(this,Tt).state),$(this,Sa,this.options),y(this,Rs).data!==void 0&&$(this,ka,y(this,Tt)),Yc(r,t))return;$(this,go,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!y(this,xa).size)return true;let i=new Set(s??y(this,xa));return this.options.throwOnError&&i.add("error"),Object.keys(y(this,go)).some(a=>{let l=a;return y(this,go)[l]!==t[l]&&i.has(l)})};ct(this,Mt,Gf).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ct(this,Mt,tp).call(this);}},ko=new WeakMap,Tt=new WeakMap,Pl=new WeakMap,go=new WeakMap,Rs=new WeakMap,Sa=new WeakMap,ti=new WeakMap,zi=new WeakMap,Fl=new WeakMap,Ta=new WeakMap,ka=new WeakMap,_s=new WeakMap,Is=new WeakMap,Ui=new WeakMap,xa=new WeakMap,Mt=new WeakSet,vl=function(t){ct(this,Mt,np).call(this);let r=y(this,Tt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Or)),r},Zu=function(){ct(this,Mt,rp).call(this);let t=cn(this.options.staleTime,y(this,Tt));if(Vn.isServer()||y(this,go).isStale||!kl(t))return;let o=qc(y(this,go).dataUpdatedAt,t)+1;$(this,_s,Dn.setTimeout(()=>{y(this,go).isStale||this.updateResult();},o));},Xu=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,Tt)):this.options.refetchInterval)??false},ep=function(t){ct(this,Mt,op).call(this),$(this,Ui,t),!(Vn.isServer()||ho(this.options.enabled,y(this,Tt))===false||!kl(y(this,Ui))||y(this,Ui)===0)&&$(this,Is,Dn.setInterval(()=>{(this.options.refetchIntervalInBackground||ha.isFocused())&&ct(this,Mt,vl).call(this);},y(this,Ui)));},tp=function(){ct(this,Mt,Zu).call(this),ct(this,Mt,ep).call(this,ct(this,Mt,Xu).call(this));},rp=function(){y(this,_s)!==void 0&&(Dn.clearTimeout(y(this,_s)),$(this,_s,void 0));},op=function(){y(this,Is)!==void 0&&(Dn.clearInterval(y(this,Is)),$(this,Is,void 0));},np=function(){let t=y(this,ko).getQueryCache().build(y(this,ko),this.options);if(t===y(this,Tt))return;let r=y(this,Tt);$(this,Tt,t),$(this,Pl,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Gf=function(t){sr.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(y(this,go));}),y(this,ko).getQueryCache().notify({query:y(this,Tt),type:"observerResultsUpdated"});});},Yf);function uC(e,t){return ho(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&ho(t.retryOnMount,e)===false)}function Kf(e,t){return uC(e,t)||e.state.data!==void 0&&ip(e,t,t.refetchOnMount)}function ip(e,t,r){if(ho(t.enabled,e)!==false&&cn(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&ap(e,t)}return false}function Qf(e,t,r,o){return (e!==t||ho(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&ap(e,r)}function ap(e,t){return ho(t.enabled,e)!==false&&e.isStaleByTime(cn(t.staleTime,e))}function pC(e,t){return !Yc(e.getCurrentResult(),t)}var Dl,On,io,vs,Ln,Hi,Jf,Zf=(Jf=class extends ed{constructor(t){super();ue(this,Ln);ue(this,Dl);ue(this,On);ue(this,io);ue(this,vs);$(this,Dl,t.client),this.mutationId=t.mutationId,$(this,io,t.mutationCache),$(this,On,[]),this.state=t.state||mC(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){y(this,On).includes(t)||(y(this,On).push(t),this.clearGcTimeout(),y(this,io).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){$(this,On,y(this,On).filter(r=>r!==t)),this.scheduleGc(),y(this,io).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){y(this,On).length||(this.state.status==="pending"?this.scheduleGc():y(this,io).remove(this));}continue(){return y(this,vs)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{ct(this,Ln,Hi).call(this,{type:"continue"});},o={client:y(this,Dl),meta:this.options.meta,mutationKey:this.options.mutationKey};$(this,vs,Xc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{ct(this,Ln,Hi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{ct(this,Ln,Hi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,io).canRun(this)}));let n=this.state.status==="pending",s=!y(this,vs).canStart();try{if(n)r();else {ct(this,Ln,Hi).call(this,{type:"pending",variables:t,isPaused:s}),y(this,io).config.onMutate&&await y(this,io).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&ct(this,Ln,Hi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await y(this,vs).start();return await y(this,io).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await y(this,io).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),ct(this,Ln,Hi).call(this,{type:"success",data:i}),i}catch(i){try{await y(this,io).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await y(this,io).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw ct(this,Ln,Hi).call(this,{type:"error",error:i}),i}finally{y(this,io).runNext(this);}}},Dl=new WeakMap,On=new WeakMap,io=new WeakMap,vs=new WeakMap,Ln=new WeakSet,Hi=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),sr.batch(()=>{y(this,On).forEach(o=>{o.onMutationUpdate(t);}),y(this,io).notify({mutation:this,type:"updated",action:t});});},Jf);function mC(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ri,dn,Vl,Xf,eh=(Xf=class extends Pn{constructor(t={}){super();ue(this,ri);ue(this,dn);ue(this,Vl);this.config=t,$(this,ri,new Set),$(this,dn,new Map),$(this,Vl,0);}build(t,r,o){let n=new Zf({client:t,mutationCache:this,mutationId:++Ga(this,Vl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){y(this,ri).add(t);let r=td(t);if(typeof r=="string"){let o=y(this,dn).get(r);o?o.push(t):y(this,dn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(y(this,ri).delete(t)){let r=td(t);if(typeof r=="string"){let o=y(this,dn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&y(this,dn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=td(t);if(typeof r=="string"){let n=y(this,dn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=td(t);return typeof r=="string"?y(this,dn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){sr.batch(()=>{y(this,ri).forEach(t=>{this.notify({type:"removed",mutation:t});}),y(this,ri).clear(),y(this,dn).clear();});}getAll(){return Array.from(y(this,ri))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Qc(r,o))}findAll(t={}){return this.getAll().filter(r=>Qc(t,r))}notify(t){sr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return sr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Or))))}},ri=new WeakMap,dn=new WeakMap,Vl=new WeakMap,Xf);function td(e){return e.options.scope?.id}var Bn,th,rh=(th=class extends Pn{constructor(t={}){super();ue(this,Bn);this.config=t,$(this,Bn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??xl(n,r),i=this.get(s);return i||(i=new jf({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){y(this,Bn).has(t.queryHash)||(y(this,Bn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=y(this,Bn).get(t.queryHash);r&&(t.destroy(),r===t&&y(this,Bn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){sr.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return y(this,Bn).get(t)}getAll(){return [...y(this,Bn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Kc(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Kc(t,o)):r}notify(t){sr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){sr.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){sr.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Bn=new WeakMap,th);var kr,Ni,$i,Ra,_a,ji,Ia,va,oh,lp=(oh=class{constructor(e={}){ue(this,kr);ue(this,Ni);ue(this,$i);ue(this,Ra);ue(this,_a);ue(this,ji);ue(this,Ia);ue(this,va);$(this,kr,e.queryCache||new rh),$(this,Ni,e.mutationCache||new eh),$(this,$i,e.defaultOptions||{}),$(this,Ra,new Map),$(this,_a,new Map),$(this,ji,0);}mount(){Ga(this,ji)._++,y(this,ji)===1&&($(this,Ia,ha.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,kr).onFocus());})),$(this,va,ba.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,kr).onOnline());})));}unmount(){var e,t;Ga(this,ji)._--,y(this,ji)===0&&((e=y(this,Ia))==null||e.call(this),$(this,Ia,void 0),(t=y(this,va))==null||t.call(this),$(this,va,void 0));}isFetching(e){return y(this,kr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Ni).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,kr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=y(this,kr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(cn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return y(this,kr).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=y(this,kr).get(o.queryHash)?.state.data,i=Vf(t,s);if(i!==void 0)return y(this,kr).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return sr.batch(()=>y(this,kr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,kr).get(t.queryHash)?.state}removeQueries(e){let t=y(this,kr);sr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=y(this,kr);return sr.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=sr.batch(()=>y(this,kr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Or).catch(Or)}invalidateQueries(e,t={}){return sr.batch(()=>(y(this,kr).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=sr.batch(()=>y(this,kr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Or)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Or)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=y(this,kr).build(this,t);return r.isStaleByTime(cn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Or).catch(Or)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Or).catch(Or)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ba.isOnline()?y(this,Ni).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,kr)}getMutationCache(){return y(this,Ni)}getDefaultOptions(){return y(this,$i)}setDefaultOptions(e){$(this,$i,e);}setQueryDefaults(e,t){y(this,Ra).set(bs(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...y(this,Ra).values()],r={};return t.forEach(o=>{ws(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){y(this,_a).set(bs(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...y(this,_a).values()],r={};return t.forEach(o=>{ws(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...y(this,$i).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=xl(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===Cs&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...y(this,$i).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){y(this,kr).clear(),y(this,Ni).clear();}},kr=new WeakMap,Ni=new WeakMap,$i=new WeakMap,Ra=new WeakMap,_a=new WeakMap,ji=new WeakMap,Ia=new WeakMap,va=new WeakMap,oh);var cp=qi__namespace.createContext(void 0),dp=e=>{let t=qi__namespace.useContext(cp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},up=({client:e,children:t})=>(qi__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(cp.Provider,{value:e,children:t}));var nh=qi__namespace.createContext(false),ih=()=>qi__namespace.useContext(nh);nh.Provider;function hC(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var gC=qi__namespace.createContext(hC()),sh=()=>qi__namespace.useContext(gC);var lh=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Jc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},ch=e=>{qi__namespace.useEffect(()=>{e.clearReset();},[e]);},dh=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Jc(r,[e.error,o]));var uh=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));}},ph=(e,t)=>e.isLoading&&e.isFetching&&!t,mh=(e,t)=>e?.suspense&&t.isPending,pp=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function fh(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=ih(),n=sh(),s=dp(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,uh(i),lh(i,n,a),ch(n);let d=!s.getQueryCache().get(i.queryHash),[p]=qi__namespace.useState(()=>new t(s,i)),g=p.getOptimisticResult(i),T=!o&&l;if(qi__namespace.useSyncExternalStore(qi__namespace.useCallback(h=>{let m=T?p.subscribe(sr.batchCalls(h)):Or;return p.updateResult(),m},[p,T]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),qi__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),mh(i,g))throw pp(i,p,n);if(dh({result:g,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw g.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,g),i.experimental_prefetchInRender&&!Vn.isServer()&&ph(g,o)&&(d?pp(i,p,n):a?.promise)?.catch(Or).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?g:p.trackResult(g)}function oi(e,t){return fh(e,sp)}var Da=new Map;function hh({width:e,height:t,borderRadius:r,color:o}){let n=qi.useRef(new reactNative.Animated.Value(.3)).current;return qi.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ni({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=W(),[d,p]=qi.useState(false),[g,T]=qi.useState(false),[h,m]=qi.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let _=Da.get(e);return _?{uri:e,xml:_}:null}),w=e?.toLowerCase().endsWith(".svg"),x=w&&e&&h?.uri===e?h.xml:null;qi.useEffect(()=>{p(false),T(false);},[e]),qi.useEffect(()=>{if(!w||!e)return;if(Da.has(e)){m({uri:e,xml:Da.get(e)});return}let _=false;return fetch(e).then(u=>{if(!u.ok)throw new Error(`HTTP ${u.status}`);return u.text()}).then(u=>{_||(Da.set(e,u),m({uri:e,xml:u}));}).catch(()=>{_||p(true);}),()=>{_=true;}},[e,w]);let k=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:k},a]});let R={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},v=t-n*2,S=r-n*2;return d?jsxRuntime.jsx(reactNative.View,{style:[R,{backgroundColor:i||k}]}):w?jsxRuntime.jsxs(reactNative.View,{style:R,children:[!!!x&&jsxRuntime.jsx(hh,{width:v,height:S,borderRadius:o,color:k}),x?jsxRuntime.jsx(Yt.SvgXml,{xml:x,width:v,height:S,onError:()=>p(true)}):jsxRuntime.jsx(Yt.SvgUri,{uri:e,width:v,height:S,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:R,children:[!g&&jsxRuntime.jsx(hh,{width:v,height:S,borderRadius:o,color:k}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:v,height:S},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function hp(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Da.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Da.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function eo({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:d,balanceChainId:p,balanceTokenAddress:g,publishableKey:T,projectName:h,leftIcon:m,onLeftAction:w}){let{colors:x,fonts:k,components:R}=W(),[v,S]=qi.useState(null),[_,u]=qi.useState(false),c=qi.useState(()=>new reactNative.Animated.Value(0))[0];qi.useEffect(()=>{if(!_)return;let f=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(c,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(c,{toValue:0,duration:700,useNativeDriver:true})]));return f.start(),()=>f.stop()},[_,c]),qi.useEffect(()=>{if(!a||!l||!d||!p||!g||!T){S(null),u(false);return}let f=false;return u(true),yc(l,d,p,g,T).then(L=>{if(f)return;let B=L.balance,D=null;B&&(B.amount_usd!=null&&B.amount_usd!==""?D=`$${B.amount_usd}`:D="$0.00"),S(D);}).catch(()=>{f||S(null);}).finally(()=>{f||u(false);}),()=>{f=true;}},[a,l,d,p,g,T]);let C=c.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:so.header,children:[jsxRuntime.jsx(reactNative.View,{style:so.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Za,{size:20,color:R.header.buttonColor,strokeWidth:2})}):m&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:m}):jsxRuntime.jsx(reactNative.View,{style:so.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:so.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:so.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[so.title,{color:R.header.titleColor,fontFamily:k.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[so.titleBadge,{backgroundColor:x.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[so.titleBadgeText,{color:x.foregroundMuted,fontFamily:k.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[so.balanceText,{color:x.foregroundMuted,fontFamily:k.regular}],children:t}):null,a&&(_?jsxRuntime.jsx(reactNative.Animated.View,{style:[so.balanceSkeleton,{backgroundColor:x.cardHover,opacity:C}]}):v!=null?jsxRuntime.jsxs(reactNative.Text,{style:[so.balanceText,{color:x.foregroundMuted,fontFamily:k.regular}],children:[h?`${h} `:"","Balance: ",v]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:so.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:R.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:so.spacer})})]})}var so=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Lr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=W(),a=s??i.card,l=a.backShadowColor!=="transparent",d={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Ch.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[d,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Ch.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:g,children:e}):jsxRuntime.jsx(reactNative.View,{style:g,children:e})]})}var Ch=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ll({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=W(),i=s.depositMenu.card,a=o?[...o].sort((l,d)=>l.position-d.position):[];return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:An.wrapper,contentStyle:An.container,children:[jsxRuntime.jsxs(reactNative.View,{style:An.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[An.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(nu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:An.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[An.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[An.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:An.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:An.networkIcons,children:a.map((l,d)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[An.networkIconWrapper,{marginLeft:d===0?0:-6,zIndex:a.length-d}],children:jsxRuntime.jsx(ni,{uri:se(p),width:20,height:20})},l.name)})})})]})}var An=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function Al({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=W(),i=s.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:ii.wrapper,contentStyle:ii.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ii.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ii.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ii.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ii.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ii.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:ii.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:ii.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(d=>d.format==="png")?.url||a.icon_urls.find(d=>d.format==="svg")?.url;return jsxRuntime.jsx(ni,{uri:se(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var ii=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function Wl({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=W(),i=s.depositMenu.card;return jsxRuntime.jsx(Lr,{cardTokens:i,onPress:e,style:si.wrapper,contentStyle:si.container,children:jsxRuntime.jsxs(reactNative.View,{style:si.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[si.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(oo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[si.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[si.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:si.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[si.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[si.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var si=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Ml({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=W(),s=n.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:e,style:Wn.wrapper,contentStyle:Wn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Wn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Wn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(lc,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Wn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Wn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Wn.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Wn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Wn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var DC="#00D632";function zl({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=W(),s=n.depositMenu.card,[i,a]=qi.useState(false),l=Nt("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Lr,{cardTokens:s,onPress:e,style:En.wrapper,contentStyle:En.container,children:jsxRuntime.jsxs(reactNative.View,{style:En.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[En.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[En.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:En.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[En.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:En.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[En.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[En.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var En=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:DC,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var Vs="#00D632",Ih=5,BC=[25,50,100,500],Ba=120,AC=5e3,WC=2e3,EC=300;function Ul(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function vh(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function MC(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function Ph(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function zC(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function Fh(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function UC(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function HC(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function ld({size:e,faded:t=false,withBackground:r=false}){let[o,n]=qi.useState(false),s=Nt("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Vs,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Vs}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function cd({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:d,fonts:p,components:g}=W();qi.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,h]=qi.useState("amountInput"),[m,w]=qi.useState("25"),[x,k]=qi.useState(null),[R,v]=qi.useState(null),[S,_]=qi.useState(true),[u,c]=qi.useState(null),[C,f]=qi.useState(false),[L,B]=qi.useState(null),[D,P]=qi.useState(Ba),[A,U]=qi.useState(null),[q,Le]=qi.useState(false),[ie,qe]=qi.useState("pending"),J=qi.useRef(null),Z=qi.useRef(null),K=qi.useRef(null),Y=qi.useRef("pending"),ge=qi.useRef(null),te=qi.useRef("amountInput"),fe=qi.useRef(Ba),De=qi.useRef(null),ve=qi.useRef(null),it=qi.useRef(false),Ue=qi.useRef(true),Ke=R?.minimum_amount??Ih,He=R?.maximum_amount,Qe=parseFloat(m)||0,We=!isNaN(Qe)&&Qe>=Ke&&(He==null||Qe<=He),Ve=He?`$${Ul(Ke)} \u2013 $${Ul(He)}`:`$${Ul(Ke)} minimum`,Ee=T==="amountInput"?"Pay with Cash App":`Pay $${vh(m)} via Cash App`,re=T==="waitingForPayment";qi.useEffect(()=>(Ue.current=true,_(true),gu("usd",t).then(b=>{Ue.current&&v(b);}).catch(()=>{}).finally(()=>{Ue.current&&_(false);}),()=>{Ue.current=false,Xe();}),[t]);function ye(b,V=R){if(B(null),!b){k(null);return}let O=parseFloat(b);if(isNaN(O)){k("Enter a valid number");return}let Q=V?.minimum_amount??Ih,M=V?.maximum_amount;O<Q?k(`$${Ul(Q)} minimum`):M!=null&&O>M?k(`$${Ul(M)} maximum`):k(null);}function Xe(){J.current&&clearInterval(J.current),Z.current&&clearInterval(Z.current),K.current&&clearInterval(K.current),J.current=null,Z.current=null,K.current=null;}function Ye(){Xe(),c(null),ge.current=null,U(null),Le(false),B(null),Y.current="pending",qe("pending"),P(Ba),fe.current=Ba,De.current=null,it.current=false,h("amountInput"),te.current="amountInput";}async function bt(){if(!(!We||C)){f(true),B(null),Xe(),De.current=null;try{let b=await hu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:m},t);ge.current=b,Y.current=b.status,c(b),f(!1),h("waitingForPayment"),te.current="waitingForPayment",tr(),Re(),reactNative.Linking.openURL(b.url).catch(()=>{});}catch(b){f(false),B(b instanceof Error?b.message:"Failed to create session");}}}function tr(){fe.current=Ba,P(Ba),K.current&&clearInterval(K.current),K.current=setInterval(()=>{fe.current-=1,P(fe.current),fe.current<=0&&(clearInterval(K.current),K.current=null,Y.current==="pending"&&(h("softExpired"),te.current="softExpired"));},1e3);}function Re(){J.current&&clearInterval(J.current),J.current=setInterval(()=>{Se();},AC);}async function Se(){if(!Ue.current)return;let b=ge.current;if(!b)return;let V=b.external_id??b.id;try{let O=await yu(V,t),Q=Y.current;switch(Y.current=O.status,qe(O.status),O.status){case "processing":(te.current==="amountInput"||te.current==="softExpired"||te.current==="waitingForPayment")&&(h("paymentReceived"),te.current="paymentReceived",K.current&&(clearInterval(K.current),K.current=null));break;case "completed":J.current&&(clearInterval(J.current),J.current=null),K.current&&(clearInterval(K.current),K.current=null),Q!=="completed"&&(h("paymentReceived"),te.current="paymentReceived",at());break;case "failed":J.current&&(clearInterval(J.current),J.current=null),K.current&&(clearInterval(K.current),K.current=null),te.current!=="amountInput"&&(h("failed"),te.current="failed");break;case "expired":J.current&&(clearInterval(J.current),J.current=null),K.current&&(clearInterval(K.current),K.current=null),te.current!=="amountInput"&&(h("softExpired"),te.current="softExpired");break;default:break}}catch{}}let ke=6e5;function at(){Z.current&&clearInterval(Z.current);let b=Date.now()+ke;Z.current=setInterval(()=>{if(Date.now()>b){clearInterval(Z.current),Z.current=null;let V=Y.current;V==="completed"||V==="processing"?(h("paymentReceived"),te.current="paymentReceived"):(h("failed"),te.current="failed");return}Me();},WC);}async function Me(){if(Ue.current)try{let b=await rn(e,t,"deposit"),V=Date.now(),O=[...b.data].sort(($e,Ne)=>{let Gr=$e.created_at?new Date($e.created_at).getTime():0;return (Ne.created_at?new Date(Ne.created_at).getTime():0)-Gr}),Q=De.current,M=Q?O.find($e=>$e.id===Q):O.find($e=>{if(!$e.created_at)return !1;let Ne=new Date($e.created_at).getTime();return V-Ne<EC*1e3});M&&(De.current||(De.current=M.id),M.status==="succeeded"?(Z.current&&(clearInterval(Z.current),Z.current=null),U(M),h("depositComplete"),te.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:M.id,transaction:M})):(M.status==="failed"||M.status==="refunded")&&(Z.current&&(clearInterval(Z.current),Z.current=null),U(M),h("failed"),te.current="failed"));}catch{}}function Ce(){if(T==="waitingForPayment"){K.current&&(clearInterval(K.current),K.current=null),h("amountInput"),te.current="amountInput";return}i();}function Pe(){Xe(),a();}function Pt(){let b=ge.current??u;b&&reactNative.Linking.openURL(b.url).catch(()=>{});}function Ot(b){let V=b.destination_amount_base_unit;if(!V)return "\u2014";let O=b.destination_token_metadata?.decimals??6;return MC(V,O)}function Rt(b){return zC(b.destination_currency)}function ft(b){let V=b.destination_token_metadata;return V?V.icon_urls&&V.icon_urls.length>0?_i(V.icon_urls,"png")??V.icon_url??null:V.icon_url??null:null}function dr(){return jsxRuntime.jsxs(reactNative.View,{style:N.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.poweredByText,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.poweredByBold,{color:d.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[N.poweredByBold,{color:d.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function Be(b,V){return jsxRuntime.jsxs(reactNative.View,{style:N.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:b}),jsxRuntime.jsx(reactNative.Text,{style:[N.detailValue,{color:d.foreground,fontFamily:p.medium}],children:V})]},b)}function Ct(b,V,O){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(O).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txLabel,{color:d.foreground,fontFamily:p.medium}],children:b}),jsxRuntime.jsxs(reactNative.View,{style:N.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txHash,{color:d.foregroundMuted}],children:V}),jsxRuntime.jsx(reactNative.Text,{style:[N.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]},b)}function et(){let b=Math.max(60-m.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:N.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:N.flex,contentContainerStyle:N.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{it.current||(it.current=true,setTimeout(()=>ve.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:N.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:N.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.amountDollar,{color:d.foreground,fontSize:b}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ve,value:m,onChangeText:V=>{w(V),ye(V);},keyboardType:"decimal-pad",style:[N.amountInput,{color:d.foreground,fontSize:b}],placeholderTextColor:d.foregroundMuted,placeholder:"0"})]}),x?jsxRuntime.jsx(reactNative.Text,{style:[N.amountError,{color:d.warning,fontFamily:p.regular}],children:x}):S?jsxRuntime.jsx(reactNative.View,{style:[N.limitsSkeleton,{backgroundColor:d.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[N.limitsSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:Ve})]}),jsxRuntime.jsx(reactNative.View,{style:N.quickAmountsRow,children:BC.map(V=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.quickAmountButton,{backgroundColor:d.card}],onPress:()=>{let O=String(V);w(O),ye(O);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[N.quickAmountText,{color:d.foreground,fontFamily:p.medium}],children:["$",V]})},V))}),L&&jsxRuntime.jsxs(reactNative.View,{style:[N.errorBanner,{backgroundColor:d.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:N.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[N.errorBannerText,{color:d.foreground,fontFamily:p.regular}],children:L})]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius,opacity:!We||C?.4:1}],onPress:bt,disabled:!We||C,activeOpacity:.8,children:[C&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:N.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:C?"Loading...":"Continue"})]})})]})}function _e(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(ld,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
- This page will update automatically.`}),D>0&&jsxRuntime.jsxs(reactNative.Text,{style:[N.expiryText,{color:D<=30?d.warning:d.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",HC(D)]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Pt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:N.cashAppButtonIcon,children:jsxRuntime.jsx(ld,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function be(){let b=ie==="processing",V=b?"Payment processing":"Payment received",O=b?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:N.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(wt,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(ld,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:V}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:O})]})})}function z(){if(!A)return be();let b=A,V=["pending","waiting","delayed"].includes(b.status),O=ft(b),Q=UC(b.created_at);return jsxRuntime.jsxs(reactNative.View,{style:N.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:N.flex,contentContainerStyle:N.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:N.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:O?jsxRuntime.jsx(reactNative.Image,{source:{uri:O,cache:"force-cache"},style:N.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[N.tokenIconFallback,{backgroundColor:d.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.tokenIconFallbackText,{color:d.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[N.statusBadge,{backgroundColor:V?d.warning:d.success}],children:jsxRuntime.jsx(reactNative.Text,{style:N.statusBadgeText,children:V?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:N.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[N.statusDot,{backgroundColor:V?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[N.statusText,{color:d.foreground,fontFamily:p.semibold}],children:V?"In Progress":"Completed"})]}),Q?jsxRuntime.jsx(reactNative.Text,{style:[N.dateText,{color:d.foregroundMuted,fontFamily:p.regular}],children:Q}):null,jsxRuntime.jsxs(reactNative.View,{style:[N.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[Be("Amount Sent",`$${vh(m)} USD`),Be("Amount Received",`${Ot(b)} ${Rt(b)}`),b.source_amount_usd?Be("USD Value",`$${parseFloat(b.source_amount_usd).toFixed(2)}`):null,b.source_chain_id?Be("Source Network",Ph(b.source_chain_type??"",b.source_chain_id)):null,b.destination_chain_id?Be("Destination Network",Ph(b.destination_chain_type??"",b.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:N.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),Le(M=>!M);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.seeMoreText,{color:d.foreground,fontFamily:p.medium}],children:q?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[N.seeMoreChevron,{color:d.foregroundMuted}],children:q?"\u25B2":"\u25BC"})]}),q&&jsxRuntime.jsxs(reactNative.View,{style:N.txHashSection,children:[b.explorer_url?Ct("Deposit Tx",Fh(b.transaction_hash),b.explorer_url):null,!V&&b.destination_explorer_url&&b.destination_transaction_hashes?.[0]?Ct("Completion Tx",Fh(b.destination_transaction_hashes[0]),b.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Pe,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function ae(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(ld,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
- `,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Ye,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function I(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[N.failedIconCircle,{backgroundColor:d.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.failedIconText,{color:d.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:N.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Ye,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),dr()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[N.root,{backgroundColor:d.background}],children:[jsxRuntime.jsx(eo,{title:Ee,showBack:re,onBack:Ce,onClose:Pe}),T==="amountInput"&&et(),T==="waitingForPayment"&&_e(),T==="paymentReceived"&&be(),T==="depositComplete"&&z(),T==="softExpired"&&ae(),T==="failed"&&I()]})}var N=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var Lh=5e3,Bh=2500,Ah=5e3,Wh=6e4;function li(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:d,trackedExecutions:p,setDepositExecutions:g,setTrackedExecutions:T,setLatestExecution:h,setShowStatusSheet:m,onDepositSuccess:w,onExecutionsChange:x,onDepositError:k}=e,[R,v]=qi.useState(false),[S,_]=qi.useState(false);return qi.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;v(false),t==="auto_ui"&&_(false);let c=setTimeout(()=>{v(true),t==="auto_ui"&&_(true);},Lh);return ()=>clearTimeout(c)},[r,t,o,n]),qi.useEffect(()=>{if(!r||!s||!a)return;let c=new Date(a.getTime()-Wh),C=setInterval(async()=>{try{let B=[...(await rn(s,i,"deposit")).data??[]].sort((P,A)=>{let U=P.created_at?new Date(P.created_at).getTime():0;return (A.created_at?new Date(A.created_at).getTime():0)-U}),D=null;for(let P of B){let A=P.created_at?new Date(P.created_at):null;if(!A||A<=c)continue;let U=p.get(P.id);if(!U){D=P;break}if(["pending","waiting","delayed"].includes(U)&&P.status==="succeeded"){D=P;break}}if(D){let P=D;g(A=>{let U=A.findIndex(q=>q.id===P.id);if(U>=0){let q=[...A];return q[U]=P,q}return [...A,P]}),T(A=>{let U=new Map(A);return U.set(P.id,P.status),U}),h(P),m(!0),P.status==="succeeded"&&w?.({message:"Deposit completed successfully",executionId:P.id}),x?.([...d,P]);}}catch(f){k?.({message:"Failed to check deposit status",error:f});}},Bh);return ()=>clearInterval(C)},[r,s,i,a,p,d,x,w,k]),qi.useEffect(()=>{if(!r||!R||!l)return;let c=async()=>{try{await mc(l,i);}catch{}};c();let C=setInterval(c,Ah);return ()=>clearInterval(C)},[r,R,l,i]),{pollingEnabled:R,showWaitingUi:S,handleIveDeposited:()=>{v(true),_(true);}}}var di=7,ci=4,Aa=4;function YC(e,t,r){return e<di&&t<di||e<di&&t>=r-di||e>=r-di&&t<di}function Zi({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=W(),l=a?"#1a1a1a":"#ffffff",d=a?"#ffffff":"#000000",p=n||l,g=qi.useMemo(()=>{try{return QC__default.default(e||"placeholder","H")}catch{return null}},[e]),T=g?g.length:0,h=T?(t-ci*2)/T:0,m=h*.38,w=o+12,x=w/2+4,k=t/2,R=t/2,v=T?[{x:ci,y:ci},{x:ci+(T-di)*h,y:ci},{x:ci,y:ci+(T-di)*h}]:[],S=di*h,_=5*h,u=h,c=3*h,C=2*h;return jsxRuntime.jsxs(reactNative.View,{style:[Fp.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Yt__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Yt.Rect,{x:0,y:0,width:t,height:t,fill:l}),g?.map((f,L)=>f.map((B,D)=>{if(!B||YC(L,D,T))return null;let P=ci+D*h+h/2,A=ci+L*h+h/2;if(r){let U=P-k,q=A-R;if(Math.sqrt(U*U+q*q)<x)return null}return jsxRuntime.jsx(Yt.Circle,{cx:P,cy:A,r:m,fill:d},`${L}-${D}`)})),v.map((f,L)=>jsxRuntime.jsxs(qi__namespace.default.Fragment,{children:[jsxRuntime.jsx(Yt.Rect,{x:f.x,y:f.y,width:S,height:S,rx:Aa,ry:Aa,fill:d}),jsxRuntime.jsx(Yt.Rect,{x:f.x+u,y:f.y+u,width:_,height:_,rx:Aa-1,ry:Aa-1,fill:l}),jsxRuntime.jsx(Yt.Rect,{x:f.x+C,y:f.y+C,width:c,height:c,rx:Aa-1.5,ry:Aa-1.5,fill:d})]},`finder-${L}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[Fp.logoContainer,{width:w,height:w,top:R-w/2,left:k-w/2,backgroundColor:p,borderRadius:w/2}],children:[jsxRuntime.jsx(ni,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[Fp.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(ni,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var Fp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});function Mh({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dp,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(Vp,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function Dp({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=W(),n=qi.useRef(new reactNative.Animated.Value(0)).current;qi.useEffect(()=>{if(e&&!t){n.setValue(0);let i=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:md.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:s}]},children:jsxRuntime.jsx(el,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[md.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function Vp({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=W();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[md.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[md.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var md=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});var sw=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ea=(e,t)=>`${t}:${e}`,aw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function hd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,onLatestExecution:m,onShowStatusSheet:w,onSelectedTokenIconUrl:x,borderTopLeftRadius:k,borderTopRightRadius:R,sheetBorderRadius:v}){let{colors:S,fonts:_,components:u}=W(),c=a&&l?`${a}:${l}`:"solana:mainnet",[C,f]=qi.useState("USDC"),[L,B]=qi.useState(c),[D,P]=qi.useState([]),[A,U]=qi.useState(true),[q,Le]=qi.useState([]),[ie,qe]=qi.useState(true),[J,Z]=qi.useState(false),[K,Y]=qi.useState(false),[ge,te]=qi.useState(false),[fe,De]=qi.useState(false),[ve,it]=qi.useState([]),[Ue,Ke]=qi.useState(new Map),[He]=qi.useState(()=>new Date),[Qe,We]=qi.useState(null),[Ve,Ee]=qi.useState(false),[re,ye]=qi.useState(null),[Xe,Ye]=qi.useState(false);qi.useEffect(()=>{re&&m?.(re);},[re]),qi.useEffect(()=>{Ve&&(w?.(true),Ee(false));},[Ve]);let bt=new Map;q.forEach(I=>{I.chains.forEach(b=>{let V=`${b.chain_type}:${b.chain_id}`;bt.has(V)||bt.set(V,b);});});let tr=Array.from(bt.values()),Re=aw(L),ke=tr.find(I=>I.chain_type===Re.chainType&&I.chain_id===Re.chainId)?.chain_type||"ethereum",at=Mo(D,ke),Me=at?.address||"",Ce=qi.useRef(false);qi.useEffect(()=>{async function I(){try{qe(!0),We(null);let V=await Qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Le(V.data),V.data.length>0&&!Ce.current){Ce.current=!0;let O,Q;if(a&&l)if(d)for(let M of V.data){let $e=M.chains.find(Ne=>Ne.chain_type===a&&Ne.chain_id===l&&Ne.token_address.toLowerCase()===d.toLowerCase());if($e){O=M,Q=$e;break}}else {let M=Ne=>Ne.chain_type===a&&Ne.chain_id===l,$e=V.data.find(Ne=>Ne.symbol==="USDC"&&Ne.chains.some(M));if($e)O=$e,Q=$e.chains.find(M);else for(let Ne of V.data){let Gr=Ne.chains.find(M);if(Gr){O=Ne,Q=Gr;break}}}if(!O&&s)for(let M of V.data){let $e=M.chains.find(Ne=>Ne.token_address.toLowerCase()===s.toLowerCase());if($e){O=M,Q=$e;break}}O||(O=V.data.find(M=>M.symbol==="USDC"),O&&O.chains.length>0&&(Q=O.chains[0])),O||(O=V.data.find(M=>M.symbol==="USDT"),O&&O.chains.length>0&&(Q=O.chains[0])),O||(O=V.data[0],O.chains.length>0&&(Q=O.chains[0])),O&&f(O.symbol),Q&&B(Ea(Q.chain_id,Q.chain_type));}}catch(b){console.error("Error fetching supported tokens:",b),We("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:b});}finally{qe(false);}}I();},[t,h,a,l,d,s,n,o]),qi.useEffect(()=>{async function I(){try{U(!0),We(null);let b=await tn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);P(b.data);}catch(b){console.error("Error fetching wallets:",b),We("Failed to load wallets"),h?.({message:"Failed to load wallets",error:b});}finally{U(false);}}I();},[e,r,o,n,s,t,h]);let Pe=at?.id??"",{showWaitingUi:Pt,handleIveDeposited:Ot}=li({depositConfirmationMode:p,depositAddress:Me,chain:L,externalUserId:e,publishableKey:t,modalOpenedAt:He,depositWalletId:Pe,depositExecutions:ve,trackedExecutions:Ue,setDepositExecutions:it,setTrackedExecutions:Ke,setLatestExecution:ye,setShowStatusSheet:Ee,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h});qi.useEffect(()=>{if(!q.length)return;let I=q.find(V=>V.symbol===C);if(!I||I.chains.length===0){let V=q.find(O=>O.symbol==="USDC")||q[0];V&&(f(V.symbol),V.chains.length>0&&B(Ea(V.chains[0].chain_id,V.chains[0].chain_type)));return}if(!I.chains.some(V=>Ea(V.chain_id,V.chain_type)===L)){let V=I.chains[0];B(Ea(V.chain_id,V.chain_type));}},[C,q,L]);let Rt=q.find(I=>I.symbol===C),ft=Ie(Rt,"png")||void 0;qi.useEffect(()=>{x?.(ft);},[ft]);let dr=Rt?.chains||[],Be=dr.find(I=>Ea(I.chain_id,I.chain_type)===L),Ct=async()=>{if(Me)try{reactNative.Clipboard.setString(Me),Z(!0),setTimeout(()=>Z(!1),2e3);}catch(I){console.error("Failed to copy:",I);}},et=Be?.estimated_price_impact_percent??0,_e=Be?.max_slippage_percent??.25,be=Be?.minimum_deposit_amount_usd??3;if(ie)return jsxRuntime.jsxs(reactNative.View,{style:H.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[H.loadingText,{color:S.foregroundMuted,fontFamily:_.regular}],children:"Loading currencies..."})]});if(Qe&&q.length===0)return jsxRuntime.jsxs(reactNative.View,{style:H.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.errorText,{color:S.error,fontFamily:_.regular}],children:Qe}),jsxRuntime.jsx(reactNative.Text,{style:[H.errorHint,{color:S.foregroundMuted,fontFamily:_.regular}],children:"Please check your network connection and try again."})]});let z=()=>jsxRuntime.jsxs(_t,{visible:ge,onClose:()=>te(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[H.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:H.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[H.sheetTitle,{color:u.header.titleColor,fontFamily:_.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(false),style:H.sheetCloseButton,children:jsxRuntime.jsx(pt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(St,{style:H.sheetList,contentContainerStyle:H.sheetListContent,showsVerticalScrollIndicator:false,children:q.map(I=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{f(I.symbol),te(false);},activeOpacity:.7,style:[H.sheetItem,{backgroundColor:C===I.symbol?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(I,"png"))},style:H.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:H.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.sheetItemTitle,{color:u.card.titleColor,fontFamily:_.medium}],children:I.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[H.sheetItemSubtitle,{color:u.card.subtitleColor,fontFamily:_.regular}],children:[I.chains.length," network",I.chains.length!==1?"s":""," available"]})]}),C===I.symbol&&jsxRuntime.jsx(st,{size:20,color:S.primary,strokeWidth:2})]},I.symbol))})]}),ae=()=>jsxRuntime.jsxs(_t,{visible:fe,onClose:()=>De(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.chainSelector?.borderTopLeftRadius??k,borderTopRightRadius:v?.chainSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[H.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:H.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[H.sheetTitle,{color:u.header.titleColor,fontFamily:_.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>De(false),style:H.sheetCloseButton,children:jsxRuntime.jsx(pt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(St,{style:H.sheetList,contentContainerStyle:H.sheetListContent,showsVerticalScrollIndicator:false,children:dr.map(I=>{let b=Ea(I.chain_id,I.chain_type),V=L===b;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{B(b),De(false);},activeOpacity:.7,style:[H.sheetItem,{backgroundColor:V?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(I,"png"))},style:H.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:H.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.sheetItemTitle,{color:u.card.titleColor,fontFamily:_.medium}],children:I.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[H.sheetItemSubtitle,{fontFamily:_.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:u.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:S.warning},children:["$",I.minimum_deposit_amount_usd]})]})]}),V&&jsxRuntime.jsx(st,{size:20,color:S.primary,strokeWidth:2})]},b)})})]});return jsxRuntime.jsxs(reactNative.View,{style:H.container,children:[jsxRuntime.jsxs(reactNative.View,{style:H.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.selectorLabel,{color:u.card.labelColor,fontFamily:_.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(true),style:[H.selector,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[Rt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Rt,"png"))},style:H.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[H.selectorText,{color:u.card.titleColor,fontFamily:_.medium}],children:C}),jsxRuntime.jsx(Gt,{size:16,color:u.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:H.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[H.selectorLabel,{color:u.card.labelColor,fontFamily:_.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[H.minDeposit,{color:S.warning,fontFamily:_.regular}],children:["($",be," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>De(true),style:[H.selector,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[Be&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Be,"png"))},style:H.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[H.selectorText,{color:u.card.titleColor,fontFamily:_.medium}],numberOfLines:1,children:Be?.chain_name||"Select network"}),jsxRuntime.jsx(Gt,{size:16,color:u.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.intentAddressLabel,{color:S.foregroundMuted,fontFamily:_.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:H.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[H.qrWrapper,{backgroundColor:S.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:A?jsxRuntime.jsxs(reactNative.View,{style:H.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[H.loadingText,{color:S.foregroundMuted,fontFamily:_.regular}],children:"Loading..."})]}):Me?jsxRuntime.jsx(Zi,{value:Me,size:160,logoUri:se(Ie(Be,"png")||Nt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:H.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[H.errorText,{color:S.error,fontFamily:_.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:Ct,disabled:A||!Me,style:H.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.addressTruncated,{color:S.foregroundMuted,fontFamily:_.regular}],numberOfLines:1,children:A?"Loading...":Me?sw(Me):"No address"}),J?jsxRuntime.jsx(st,{size:16,color:S.success,strokeWidth:2}):jsxRuntime.jsx(Zo,{size:16,color:S.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(Dp,{showWaitingUi:Pt,latestExecution:re}),jsxRuntime.jsxs(reactNative.View,{style:[H.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Y(!K),style:H.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.detailsLabel,{color:u.card.titleColor,fontFamily:_.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:H.chevronContainer,children:K?jsxRuntime.jsx(gn,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),K&&jsxRuntime.jsxs(reactNative.View,{style:H.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[H.detailsLabel,{color:u.card.titleColor,fontFamily:_.regular}],children:["Price impact: ",et.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(en,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[H.detailsLabel,{color:u.card.titleColor,fontFamily:_.regular}],children:["Slippage: Auto \u2022 ",_e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(en,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gs,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[H.detailsLabel,{color:u.card.titleColor,fontFamily:_.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(en,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.detailsLabel,{color:S.primary,fontFamily:_.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(Vp,{depositConfirmationMode:p,depositAddress:Me,showWaitingUi:Pt,onIveDeposited:Ot}),z(),ae(),jsxRuntime.jsxs(_t,{visible:Xe,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[H.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:H.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[H.sheetTitle,{color:u.header.titleColor,fontFamily:_.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(false),style:H.sheetCloseButton,children:jsxRuntime.jsx(pt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:H.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[H.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:H.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[H.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xo,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardTitle,{color:u.card.titleColor,fontFamily:_.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[H.infoCardValue,{color:u.card.titleColor,fontFamily:_.medium}],children:[et.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardDescription,{color:u.card.descriptionColor,fontFamily:_.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[H.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:H.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[H.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardTitle,{color:u.card.titleColor,fontFamily:_.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[H.infoCardValue,{color:u.card.titleColor,fontFamily:_.medium}],children:[_e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardDescription,{color:u.card.descriptionColor,fontFamily:_.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var H=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function gd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=W();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Os.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Os.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Os.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(e,"png"))},style:Os.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Os.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Os.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Os.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(st,{size:16,color:o.primary,strokeWidth:2})]})}var Os=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function $l({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=W();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:jh.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[jh.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(gd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var jh=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function bd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:d,components:p}=W(),[g,T]=qi.useState(""),h=o.map(S=>r.find(_=>_.currency_code.toLowerCase()===S.toLowerCase())).filter(S=>S!==void 0),m=r.filter(S=>!o.includes(S.currency_code.toLowerCase())),w=S=>{if(!g)return S;let _=g.toLowerCase();return S.filter(u=>u.name.toLowerCase().includes(_)||u.currency_code.toLowerCase().includes(_))},x=w(h),k=w(m),R=S=>{s(S),t(false),T("");},v=()=>{t(false),T("");};return jsxRuntime.jsxs(_t,{visible:e,onClose:v,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(eo,{title:"Currency",showBack:false,onClose:v}),jsxRuntime.jsx(reactNative.View,{style:Ls.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ls.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:d.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(St,{style:Ls.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Ls.listContent,children:[jsxRuntime.jsx($l,{title:"Popular currencies",currencies:x,selectedCurrency:n,onSelect:R}),x.length>0&&k.length>0&&jsxRuntime.jsx(reactNative.View,{style:Ls.sectionSpacer}),jsxRuntime.jsx($l,{title:"All currencies",currencies:k,selectedCurrency:n,onSelect:R}),x.length===0&&k.length===0&&jsxRuntime.jsx(reactNative.View,{style:Ls.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Ls.noResultsText,{color:p.container.subtitleColor,fontFamily:d.regular}],children:"No currencies found"})})]})})]})}var Ls=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Wp(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 Sd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:d,onDepositError:p,onExecutionsChange:g,onLatestExecution:T,onShowStatusSheet:h,onSelectedTokenIconUrl:m,borderTopLeftRadius:w,borderTopRightRadius:x,sheetBorderRadius:k}){let{colors:R,fonts:v,components:S}=W(),[_,u]=qi.useState(""),[c,C]=qi.useState("usd"),[f,L]=qi.useState(false),[B,D]=qi.useState(false),[P,A]=qi.useState([]),[U,q]=qi.useState(false),[Le,ie]=qi.useState(null),[qe,J]=qi.useState(null),[Z,K]=qi.useState("amount"),[Y,ge]=qi.useState(null),[te,fe]=qi.useState(true),[De,ve]=qi.useState(null),[it,Ue]=qi.useState(false),Ke=qi.useRef(null),He=qi.useRef(false);qi.useEffect(()=>{Ke.current=Y;},[Y]),qi.useEffect(()=>{He.current=it;},[it]);let[Qe,We]=qi.useState([]),[Ve,Ee]=qi.useState(true),[re,ye]=qi.useState(60),[Xe,Ye]=qi.useState([]),[bt,tr]=qi.useState([]),[Re,Se]=qi.useState(null),[ke,at]=qi.useState(null),[Me,Ce]=qi.useState(true),[Pe,Pt]=qi.useState(null),[Ot,Rt]=qi.useState(false),[ft,dr]=qi.useState(null),[Be,Ct]=qi.useState(false),[et,_e]=qi.useState(false),[be,z]=qi.useState(false),[ae,I]=qi.useState(null),b=r??Z,V=qi.useRef(null),O=Xe.find(de=>de.currency_code.toLowerCase()===c.toLowerCase()),Q=qi.useCallback(de=>{K(de),de==="quotes"?o?.(de,P.length):o?.(de);},[P.length,o]);qi.useEffect(()=>{async function de(){try{let ze=await cl();at(ze);}catch(ze){console.error("Error fetching user IP:",ze);}finally{Ce(false);}}de();},[]),qi.useEffect(()=>{async function de(){try{let ze=await tn({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);We(ze.data);}catch(ze){console.error("Error fetching wallets:",ze),ie("Failed to load wallet addresses");}finally{Ee(false);}}de();},[e,s,i,a,l,t]);let M=n||Re?.symbol.toUpperCase()||"USDC",$e=_i(Re?.icon_urls,"png")||Re?.icon_url,Ne=_i(Re?.chain_icon_urls,"png")||Re?.chain_icon_url,[Gr,X]=qi.useState([]),[$s,Lt]=qi.useState(new Map),[Fe]=qi.useState(()=>new Date),[Ft,tt]=qi.useState(null),[Ge,ro]=qi.useState(false),[qt,Mr]=qi.useState(null);qi.useEffect(()=>{b==="onramp"&&!qt&&Mr(new Date);},[b,qt]);let Br=Pe?.destination_token_metadata?.chain_type||i||"ethereum",js=Pe?.destination_token_metadata?.chain_id||a||"",$n=`${Br}:${js}`,ec=Mo(Qe,Br),as=ec?.address||"",tc=ec?.id??"";qi.useEffect(()=>{Ft&&T?.(Ft);},[Ft]),qi.useEffect(()=>{Ge&&(h?.(true),ro(false));},[Ge]),qi.useEffect(()=>{m?.($e||void 0);},[$e]),qi.useEffect(()=>{g?.(Gr);},[Gr]),li({depositConfirmationMode:"auto_silent",enabled:b==="onramp",depositAddress:as,chain:$n,externalUserId:e,publishableKey:t,modalOpenedAt:qt??Fe,depositWalletId:tc,depositExecutions:Gr,trackedExecutions:$s,setDepositExecutions:X,setTrackedExecutions:Lt,setLatestExecution:tt,setShowStatusSheet:ro,onDepositSuccess:d,onExecutionsChange:g,onDepositError:p}),qi.useEffect(()=>{async function de(){try{let ze=await al(t);Ye(ze.data),tr(ze.preferred||[]);}catch(ze){console.error("Error fetching fiat currencies:",ze);}}de();},[t]),qi.useEffect(()=>{if(f||Xe.length===0||!ke?.alpha2)return;let de=ke.alpha2.toUpperCase(),ze=Xe.find(mr=>mr.country_codes.includes(de));if(ze)C(ze.currency_code.toLowerCase()),!_&&!B&&u(String(ze.default_amount??100));else if(!_&&!B){let mr=Xe.find(fn=>fn.currency_code.toLowerCase()==="usd");mr&&u(String(mr.default_amount??100));}},[Xe,ke,f,_,B]),qi.useEffect(()=>{if(Xe.length!==0){if(V.current!==null&&V.current!==c){let de=Xe.find(ze=>ze.currency_code.toLowerCase()===c.toLowerCase());de&&u(String(de.default_amount??100));}V.current=c;}},[c,Xe]),qi.useEffect(()=>{async function de(){try{let ze=await lu({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Se(ze);}catch(ze){console.error("Error fetching supported tokens:",ze);}}de();},[i,a,l,t]),qi.useEffect(()=>{async function de(){if(!(!l||!a||!i)&&!Me){Rt(true);try{let ze=await uu({country_code:ke?.alpha2?.toUpperCase()||"US",subdivision_code:ke?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Pt(ze);}catch(ze){console.error("Error fetching default onramp token:",ze);}finally{Rt(false);}}}de();},[l,a,i,ke,Me,t]),qi.useEffect(()=>{let de=parseFloat(_);if(isNaN(de)||de<=0){A([]),J(null);return}if(!Pe||Ot){A([]),ge(null);return}let ze=Xe.find(fn=>fn.currency_code.toLowerCase()===c.toLowerCase());if(ze){if(de<ze.minimum_amount){A([]),ge(null),J(`Minimum amount is ${Wp(c)}${ze.minimum_amount.toLocaleString()}`);return}if(de>ze.maximum_amount){A([]),ge(null),J(`Maximum amount is ${Wp(c)}${ze.maximum_amount.toLocaleString()}`);return}}J(null);let mr=setTimeout(()=>{ls(de);},500);return ()=>clearTimeout(mr)},[_,c,t,Pe,Ot,Xe]);let ls=async de=>{if(!Pe){ie("Loading token information...");return}q(true),ie(null);try{let ze={country_code:ke?.alpha2?.toUpperCase()||"US",source_amount:de.toString(),source_currency:c.toLowerCase(),destination_currency:Pe.destination_currency,destination_network:Pe.destination_network,subdivision_code:ke?.state||void 0},mr=await cu(ze,t);A(mr.data);let fn=He.current,oc=Ke.current;if(fn&&oc){let ki=mr.data.find(F=>F.service_provider===oc.service_provider);if(ki){if(ge(ki),mr.data.length>0){let F=mr.data[0];De||ve(F.service_provider),fe(ki.service_provider===De);}}else if(mr.data.length>0){let F=mr.data[0];ge(F),ve(F.service_provider),fe(!0),Ue(!1);}}else if(mr.data.length>0){let ki=mr.data[0];ge(ki),ve(ki.service_provider),fe(!0);}ye(60);}catch(ze){console.error("Failed to fetch quotes:",ze),ie("Failed to fetch quotes. Please try again."),A([]);}finally{q(false);}};qi.useEffect(()=>{if(P.length===0)return;let de=setInterval(()=>{ye(ze=>{if(ze<=1){let mr=parseFloat(_);return !isNaN(mr)&&mr>0&&ls(mr),60}return ze-1});},1e3);return ()=>clearInterval(de)},[P.length,_]);let rc=de=>{(/^\d*\.?\d{0,2}$/.test(de)||de==="")&&(u(de),D(true));},qs=de=>{u(de.toString()),D(true);},Yd=async()=>{if(Y&&Pe)try{let de=Pe.destination_token_metadata.chain_type,ze=Mo(Qe,de);if(!ze?.address){ie("Wallet address not available");return}let mr={service_provider:Y.service_provider,country_code:Y.country_code?.toUpperCase()||ke?.alpha2?.toUpperCase()||"US",source_currency:Y.source_currency,source_amount:_,destination_currency:Y.destination_currency,destination_network:Y.destination_network,wallet_address:ze.address,subdivision_code:ke?.state||void 0},fn=await du(mr,t);dr({provider:Y,sourceCurrency:c,sourceAmount:_,sessionUrl:fn.url}),I(fn.url),z(!0);}catch(de){console.error("Failed to create session:",de),ie("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:de});}},Ti=Wp(c),Ya=()=>{z(false),Q("onramp"),d?.({message:"Payment flow completed"});},Gd=()=>jsxRuntime.jsx(Sw,{visible:be,onClose:Ya,url:ae,providerName:Y?.service_provider_display_name||"Complete Payment",colors:R,fonts:v,borderTopLeftRadius:k?.webView?.borderTopLeftRadius??w,borderTopRightRadius:k?.webView?.borderTopRightRadius??x});return b==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:oe.amountViewContainer,children:[jsxRuntime.jsxs(St,{style:oe.scrollContainer,contentContainerStyle:oe.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:oe.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ct(true),style:[oe.currencyButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.input.borderRadius,borderWidth:S.input.borderWidth,borderColor:S.input.borderColor}],children:[O&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(O,"png"))},style:oe.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[oe.currencyText,{color:S.card.titleColor,fontFamily:v.medium}],children:c.toUpperCase()}),jsxRuntime.jsx(Gt,{size:16,color:S.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(bd,{open:Be,onOpenChange:Ct,currencies:Xe,preferredCurrencyCodes:bt,selectedCurrency:c,onSelectCurrency:de=>{C(de.toLowerCase()),L(true);},borderTopLeftRadius:k?.currencyModal?.borderTopLeftRadius??w,borderTopRightRadius:k?.currencyModal?.borderTopRightRadius??x}),jsxRuntime.jsx(reactNative.View,{style:oe.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:oe.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.currencySymbol,{color:S.container.titleColor,fontFamily:v.medium}],children:Ti}),jsxRuntime.jsx(reactNative.TextInput,{style:[oe.amountInput,{color:S.container.titleColor,fontFamily:v.medium}],value:_,onChangeText:rc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:R.foregroundMuted})]})}),O?.suggested_amounts&&O.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:oe.quickAmounts,children:O.suggested_amounts.map(de=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qs(de),style:[oe.quickAmountButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.button.borderRadius,borderWidth:parseFloat(_)===de?2:S.button.borderWidth,borderColor:parseFloat(_)===de?R.primary:S.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[oe.quickAmountText,{color:S.card.titleColor,fontFamily:v.medium}],children:[Ti,de.toLocaleString()]})},de))}),qe&&jsxRuntime.jsx(reactNative.Text,{style:[oe.validationError,{color:R.error,fontFamily:v.regular}],children:qe}),jsxRuntime.jsxs(reactNative.View,{style:oe.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.providerLabel,{color:S.card.labelColor,fontFamily:v.medium}],children:"Provider"}),P.length>0&&!U&&jsxRuntime.jsxs(reactNative.Text,{style:[oe.refreshText,{color:S.card.labelRightColor,fontFamily:v.regular}],children:["Refreshing in ",re,"s"]})]}),jsxRuntime.jsx(Lr,{cardTokens:S.depositCard.quoteProvider.card,onPress:U||P.length===0?void 0:()=>_e(true),contentStyle:reactNative.StyleSheet.flatten([oe.providerButton,(U||P.length===0)&&oe.disabled]),children:U?jsxRuntime.jsxs(reactNative.View,{style:oe.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:R.primary}),jsxRuntime.jsx(reactNative.Text,{style:[oe.loadingText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"Finding best rates..."})]}):Y?jsxRuntime.jsxs(reactNative.View,{style:oe.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.providerInfo,children:[te&&jsxRuntime.jsx(reactNative.Text,{style:[oe.autoPickedText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:oe.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(fc(Y.icon_urls,"png",Y.icon_url))},style:oe.providerIconImage},`provider-${Y.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.providerName,{color:S.card.titleColor,fontFamily:v.medium}],children:Y.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.bestPriceText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:[Y.destination_amount.toFixed(2)," ",M]})]})]})]}),jsxRuntime.jsx(Ur,{size:20,color:S.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[oe.noProviderText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:parseFloat(_)>0?"No providers available":"Enter an amount to see providers"})}),Le&&jsxRuntime.jsx(reactNative.Text,{style:[oe.errorText,{color:R.error,fontFamily:v.regular}],children:Le})]}),jsxRuntime.jsxs(_t,{visible:et,onClose:()=>_e(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:k?.providerModal?.borderTopLeftRadius??w,borderTopRightRadius:k?.providerModal?.borderTopRightRadius??x,children:[jsxRuntime.jsx(eo,{title:"Select Provider",showBack:false,onClose:()=>_e(false)}),jsxRuntime.jsx(St,{style:oe.providerModalList,contentContainerStyle:oe.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:oe.quotesList,children:P.map(de=>{let ze=Y?.service_provider===de.service_provider;return jsxRuntime.jsxs(Lr,{cardTokens:S.depositCard.quoteProvider.card,onPress:()=>{ge(de),Ue(true),fe(de.service_provider===De),_e(false);},contentStyle:reactNative.StyleSheet.flatten([oe.quoteItem,ze&&{borderWidth:2,borderColor:R.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:oe.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(fc(de.icon_urls,"png",de.icon_url))},style:oe.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[oe.quoteName,{color:S.card.titleColor,fontFamily:v.medium}],children:de.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:oe.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[oe.quoteAmount,{color:S.card.textRightColor,fontFamily:v.medium}],children:[de.destination_amount.toFixed(2)," ",M]}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.quoteSource,{color:S.card.subtextRightColor,fontFamily:v.regular}],children:["Fee: ",Ti,de.total_fee.toFixed(2)]})]})]},de.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[oe.continueButtonContainer,{backgroundColor:R.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:U||Ve||!Y||parseFloat(_)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Yd,disabled:U||Ve||!Y||parseFloat(_)<=0,style:[oe.continueButton,{backgroundColor:S.container.buttonColor,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.continueButtonText,{color:S.container.buttonTitleColor,fontFamily:v.medium}],children:Ve?"Loading...":"Continue"})})})})]}),Gd()]}):b==="onramp"&&ft?jsxRuntime.jsxs(reactNative.View,{style:oe.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(fc(ft.provider.icon_urls,"png",ft.provider.icon_url))},style:oe.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.onrampTitle,{color:S.container.titleColor,fontFamily:v.medium}],children:["Complete transaction with ",ft.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[oe.onrampSubtitle,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[oe.flowDiagram,{backgroundColor:S.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:oe.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Nt(`/icons/currencies/png/${ft.sourceCurrency.toLowerCase()}.png`)},style:oe.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[oe.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:ft.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ur,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:oe.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:_i(Pe?.destination_token_metadata?.icon_urls,"png")||Pe?.destination_token_metadata?.icon_url||Nt("/icons/tokens/png/usdc.png")},style:oe.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:_i(Pe?.destination_token_metadata?.chain?.icon_urls,"png")||Pe?.destination_token_metadata?.chain?.icon_url||Nt("/icons/networks/png/polygon.png")},style:[oe.flowNetworkBadge,{borderColor:R.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[oe.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:"USDC"})]}),jsxRuntime.jsx(Ur,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:oe.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$e||Nt("/icons/tokens/png/usdc.png")},style:oe.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Ne||Nt("/icons/networks/png/polygon.png")},style:[oe.flowNetworkBadge,{borderColor:R.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[oe.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:M})]})]}),jsxRuntime.jsx(reactNative.View,{style:[oe.onrampInfoBox,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.onrampInfoText,{color:S.card.descriptionColor,fontFamily:v.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 Sw({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Bs.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Bs.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Bs.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Bs.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Bs.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Bs.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Bs.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Bs=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),oe=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Rw(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 _w(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function xd({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=W(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=se(Ie(e.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),d=i?"Deposit Processing":"Deposit Completed",p=Rw(e.created_at||new Date().toISOString()),g=_w(e.source_amount_usd);return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:mi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:mi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:mi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[mi.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(Js,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(st,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:mi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[mi.title,{color:s.titleColor,fontFamily:o.medium}],children:d}),jsxRuntime.jsx(reactNative.Text,{style:[mi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:mi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[mi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(Ur,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var mi=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Yh(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 Gh(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 vw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Jh=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Zh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Pw(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 Fw({count:e=4}){let{colors:t,components:r}=W(),o=qi.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:As.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[As.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[As.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:As.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[As.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[As.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[As.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var As=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function zp({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=W(),[l,d]=qi.useState(r),[p,g]=qi.useState(false),[T,h]=qi.useState(null),[m,w]=qi.useState(false),x=qi.useRef(null);qi.useEffect(()=>{if(!e||!o)return;let c=async()=>{g(true);try{let L=[...(await rn(o,n,"deposit")).data].sort((B,D)=>{let P=B.created_at?new Date(B.created_at).getTime():0;return (D.created_at?new Date(D.created_at).getTime():0)-P});d(L);}catch(f){console.error("Failed to fetch executions:",f),d(r);}finally{g(false);}};c();let C=setInterval(c,1e4);return ()=>clearInterval(C)},[e,o,n,r]),qi.useEffect(()=>{r.length>0&&d(c=>{let C=new Set(c.map(L=>L.id)),f=r.filter(L=>!C.has(L.id));return f.length>0?[...f,...c]:c});},[r]),qi.useEffect(()=>{e||h(null);},[e]);let k=c=>{h(c);},R=()=>{h(null),w(false);},v=()=>{h(null),t();},S=()=>{if(!T)return null;let c=T,C=c.status==="pending"||c.status==="waiting"||c.status==="delayed",f=c.status==="succeeded",L=se(Ie(c.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),B=c.provider_metadata?.details,D=B?.currencyIn,P=B?.currencyOut;D?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let q=Gh(c.source_amount_base_unit,c.source_token_metadata?.decimals),Le=Gh(c.destination_amount_base_unit,c.destination_token_metadata?.decimals),ie=vw(c.source_amount_usd),qe=Yh(c.source_chain_type,c.source_chain_id),J=Yh(c.destination_chain_type,c.destination_chain_id),Z=()=>{c.explorer_url&&reactNative.Linking.openURL(c.explorer_url);},K=()=>{c.destination_explorer_url&&reactNative.Linking.openURL(c.destination_explorer_url);};return jsxRuntime.jsxs(St,{ref:x,style:Ae.scrollContainer,contentContainerStyle:Ae.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ae.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Ae.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L},style:Ae.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ae.statusBadge,{backgroundColor:C?s.warning:s.success,borderColor:s.background}],children:C?jsxRuntime.jsx(Gt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(st,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ae.statusDot,{backgroundColor:C?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:Pw(c.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ae.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[q," ",Zh(c.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ae.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Le," ",Zh(c.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ae.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ie})]}),jsxRuntime.jsx(reactNative.View,{style:[Ae.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:qe})]}),jsxRuntime.jsx(reactNative.View,{style:[Ae.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:J})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Y=!m;w(Y),Y?setTimeout(()=>{x.current?.scrollToEnd({animated:true});},100):x.current?.scrollTo({y:0,animated:true});},style:Ae.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:m?"See less":"See more details"}),m?jsxRuntime.jsx(gn,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:14,color:a.container.actionColor,strokeWidth:2})]}),m&&jsxRuntime.jsxs(reactNative.View,{style:[Ae.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[c.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Z,style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Jh(c.transaction_hash)}),jsxRuntime.jsx(hn,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ae.cardDivider,{backgroundColor:s.border}]})]}),c.destination_explorer_url&&f&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:K,style:Ae.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ae.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Jh(c.destination_transaction_hashes[0])}),jsxRuntime.jsx(hn,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},_=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:T?"Deposit Details":"Deposit Tracker",onClose:v,showClose:!T,showBack:!!T,onBack:R}),T?S():_?jsxRuntime.jsx(Fw,{}):jsxRuntime.jsx(St,{style:Ae.scrollContainer,contentContainerStyle:Ae.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ae.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:Ae.executionsList,children:l.map(c=>jsxRuntime.jsx(xd,{execution:c,onPress:()=>k(c)},c.id))})})]})}var Ae=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function jl(e,t=true){let[r,o]=qi.useState(null),[n,s]=qi.useState(null),[i,a]=qi.useState(false),[l,d]=qi.useState(false),[p,g]=qi.useState(null),[T,h]=qi.useState(null);qi.useEffect(()=>{!t||r||(a(true),cl().then(k=>{o(k),g(null);}).catch(k=>{g(k instanceof Error?k:new Error(String(k)));}).finally(()=>{a(false);}));},[t,r]),qi.useEffect(()=>{!t||!e||n||(d(true),ll(e).then(k=>{s(k),h(null);}).catch(k=>{h(k instanceof Error?k:new Error(String(k)));}).finally(()=>{d(false);}));},[t,e,n]);let m=i||l,w=p||T||null,x=null;if(r&&n){let k=n.blocked_country_codes||[],R=r.alpha2.toUpperCase();x=!k.some(v=>v.toUpperCase()===R);}return {isAllowed:x,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:m,error:w}}var Np="unifold_recent_tokens",Bw=5,ng=[{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 Pd(){try{let e=await zu__default.default.getItem(Np);return e?JSON.parse(e):[]}catch{return []}}async function Aw(e){try{let r=(await Pd()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Bw);await zu__default.default.setItem(Np,JSON.stringify(o));}catch{}}async function Ww(e){try{let r=(await Pd()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await zu__default.default.setItem(Np,JSON.stringify(r)),r}catch{return []}}function $p({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:d,heightPercent:p=.9,showHandle:g=true}){let{colors:T,fonts:h,components:m}=W(),[w,x]=qi.useState(""),[k,R]=qi.useState([]);qi.useEffect(()=>{e&&Pd().then(R);},[e]),qi.useEffect(()=>{e||x("");},[e]);let v=qi.useMemo(()=>{let f=[];return r.forEach(L=>{L.chains.forEach(B=>{f.push({token:L,chain:B});});}),f},[r]),S=qi.useMemo(()=>{let f=[],L=new Set,B=(D,P,A,U)=>{let q=`${D}-${P}:${A}`;if(L.has(q))return;let Le=r.find(qe=>qe.symbol===D);if(!Le)return;let ie=Le.chains.find(qe=>qe.chain_type===P&&qe.chain_id===A);ie&&(L.add(q),f.push({token:Le,chain:ie,isRecent:U}));};return k.forEach(D=>{B(D.symbol,D.chainType,D.chainId,true);}),ng.forEach(D=>{B(D.symbol,D.chainType,D.chainId,false);}),f},[r,k]),_=qi.useMemo(()=>{if(!w.trim())return v;let f=w.toLowerCase();return v.filter(({token:L,chain:B})=>L.symbol.toLowerCase().includes(f)||L.name.toLowerCase().includes(f)||B.chain_name.toLowerCase().includes(f))},[v,w]),u=(f,L,B)=>ng.some(D=>D.symbol===f&&D.chainType===L&&D.chainId===B),c=async(f,L)=>{let B=`${L.chain_type}:${L.chain_id}`;if(!u(f.symbol,L.chain_type,L.chain_id)){await Aw({symbol:f.symbol,chainType:L.chain_type,chainId:L.chain_id});let D=await Pd();R(D);}x(""),s(f.symbol,B),t();},C=async(f,L)=>{let B=await Ww({symbol:f.symbol,chainType:L.chain_type,chainId:L.chain_id});R(B);};return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:g,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:d,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ut.header,!g&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:Ut.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.headerTitle,{color:m.header.titleColor,fontFamily:h.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ut.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(pt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Ut.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ut.searchInput,{backgroundColor:m.search.backgroundColor,color:m.search.inputColor,fontFamily:h.regular,borderRadius:m.input.borderRadius,borderWidth:m.input.borderWidth,borderColor:m.input.borderColor}],placeholder:"Search",placeholderTextColor:m.search.placeholderColor,value:w,onChangeText:x,autoCapitalize:"none",autoCorrect:false})}),!l&&S.length>0&&!w&&jsxRuntime.jsxs(reactNative.View,{style:Ut.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.sectionLabel,{color:m.list.titleSectionColor,fontFamily:h.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ut.quickSelectScroll,children:S.map(({token:f,chain:L,isRecent:B})=>{let D=`${L.chain_type}:${L.chain_id}`;f.symbol===o&&D===n;return jsxRuntime.jsxs(reactNative.View,{children:[B&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>C(f,L),style:Ut.removeButton,children:jsxRuntime.jsx(pt,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>c(f,L),activeOpacity:.7,style:[Ut.quickSelectItem,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(f,"png"))},style:Ut.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(L,"png"))},style:[Ut.quickSelectChainBadge,{borderColor:m.card.backgroundColor,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.quickSelectSymbol,{color:m.card.titleColor,fontFamily:h.medium}],children:f.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.quickSelectChain,{color:m.card.subtitleColor,fontFamily:h.regular}],children:L.chain_name})]})]})]},`quick-${f.symbol}-${D}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.sectionLabel,{color:m.list.titleSectionColor,fontFamily:h.regular}],children:"All supported tokens"}),jsxRuntime.jsx(St,{style:Ut.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ut.tokenListContent,children:_.length===0?jsxRuntime.jsx(reactNative.View,{style:Ut.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ut.emptyText,{color:T.foregroundMuted,fontFamily:h.regular}],children:"No tokens found"})}):_.map(({token:f,chain:L})=>{let B=`${L.chain_type}:${L.chain_id}`,D=f.symbol===o&&B===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>c(f,L),activeOpacity:.7,style:[Ut.tokenItem,{backgroundColor:D?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(f,"png"))},style:Ut.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(L,"png"))},style:[Ut.tokenChainBadge,{borderColor:m.card.backgroundColor,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.tokenSymbol,{color:m.card.titleColor,fontFamily:h.medium}],children:f.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.tokenChainName,{color:m.card.subtitleColor,fontFamily:h.regular}],children:L.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Ut.minDeposit,{color:m.card.labelColor,fontFamily:h.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:m.card.labelHighlightRightColor,fontFamily:h.regular},children:["$",L.minimum_deposit_amount_usd]})]})]},`${f.symbol}-${B}`)})})]})}var Ut=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var ql=(e,t)=>`${t}:${e}`,Hw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function jp({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,onLatestExecution:m,onShowStatusSheet:w,onSelectedTokenIconUrl:x,wallets:k,borderTopLeftRadius:R,borderTopRightRadius:v,sheetBorderRadius:S}){let{colors:_,fonts:u,components:c}=W(),C=a&&l?`${a}:${l}`:"solana:mainnet",[f,L]=qi.useState("USDC"),[B,D]=qi.useState(C),[P,A]=qi.useState([]),[U,q]=qi.useState(!k?.length),Le=k?.length?k:P,[ie,qe]=qi.useState([]),[J,Z]=qi.useState(true),[K,Y]=qi.useState(false),[ge,te]=qi.useState(false),[fe,De]=qi.useState(false),[ve,it]=qi.useState([]),[Ue,Ke]=qi.useState(new Map),[He]=qi.useState(()=>new Date),[Qe,We]=qi.useState(null),[Ve,Ee]=qi.useState(false),[re,ye]=qi.useState(null),[Xe,Ye]=qi.useState(false);qi.useEffect(()=>{re&&m?.(re);},[re]),qi.useEffect(()=>{Ve&&(w?.(true),Ee(false));},[Ve]);let bt=new Map;ie.forEach(z=>{z.chains.forEach(ae=>{let I=`${ae.chain_type}:${ae.chain_id}`;bt.has(I)||bt.set(I,ae);});});let tr=Array.from(bt.values()),Re=Hw(B),Se=tr.find(z=>z.chain_type===Re.chainType&&z.chain_id===Re.chainId),ke=Se?.chain_type||"ethereum",at=Mo(Le,ke),Me=at?.address||"",Ce=qi.useRef(false);qi.useEffect(()=>{async function z(){try{Z(!0),We(null);let I=await Qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(qe(I.data),I.data.length>0&&!Ce.current){Ce.current=!0;let b,V;if(a&&l)if(d)for(let O of I.data){let Q=O.chains.find(M=>M.chain_type===a&&M.chain_id===l&&M.token_address.toLowerCase()===d.toLowerCase());if(Q){b=O,V=Q;break}}else {let O=M=>M.chain_type===a&&M.chain_id===l,Q=I.data.find(M=>M.symbol==="USDC"&&M.chains.some(O));if(Q)b=Q,V=Q.chains.find(O);else for(let M of I.data){let $e=M.chains.find(O);if($e){b=M,V=$e;break}}}if(!b&&s)for(let O of I.data){let Q=O.chains.find(M=>M.token_address.toLowerCase()===s.toLowerCase());if(Q){b=O,V=Q;break}}b||(b=I.data.find(O=>O.symbol==="USDC"),b&&b.chains.length>0&&(V=b.chains[0])),b||(b=I.data.find(O=>O.symbol==="USDT"),b&&b.chains.length>0&&(V=b.chains[0])),b||(b=I.data[0],b.chains.length>0&&(V=b.chains[0])),b&&L(b.symbol),V&&D(ql(V.chain_id,V.chain_type));}}catch(ae){console.error("Error fetching supported tokens:",ae),We("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:ae});}finally{Z(false);}}z();},[t,s,n,o,a,l,d,h]),qi.useEffect(()=>{g&&g(ve);},[ve,g]),qi.useEffect(()=>{if(k?.length){q(false);return}if(P.length>0){q(false);return}let z=null,ae=false,I=async()=>{if(!ae){q(true);try{let b=await tn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);ae||(A(b.data),We(null),q(!1));}catch(b){console.error("Error fetching wallets, retrying in 5s:",b),ae||(We(b instanceof Error?b.message:"Failed to load wallets"),q(false),z=setTimeout(I,5e3));}}};return I(),()=>{ae=true,z&&clearTimeout(z);}},[e,r,o,n,s,t,k,P.length]);let Pe=at?.id??"",{showWaitingUi:Pt,handleIveDeposited:Ot}=li({depositConfirmationMode:p,depositAddress:Me,chain:B,externalUserId:e,publishableKey:t,modalOpenedAt:He,depositWalletId:Pe,depositExecutions:ve,trackedExecutions:Ue,setDepositExecutions:it,setTrackedExecutions:Ke,setLatestExecution:ye,setShowStatusSheet:Ee,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h});qi.useEffect(()=>{if(!ie.length)return;let z=ie.find(I=>I.symbol===f);if(!z||z.chains.length===0){let I=ie.find(b=>b.symbol==="USDC")||ie[0];I&&(L(I.symbol),I.chains.length>0&&D(ql(I.chains[0].chain_id,I.chains[0].chain_type)));return}if(!z.chains.some(I=>ql(I.chain_id,I.chain_type)===B)){let I=z.chains[0];D(ql(I.chain_id,I.chain_type));}},[f,ie,B]);let Rt=ie.find(z=>z.symbol===f),ft=Ie(Rt,"png")||void 0;qi.useEffect(()=>{x?.(ft);},[ft]);let Be=(Rt?.chains||[]).find(z=>ql(z.chain_id,z.chain_type)===B),Ct=async()=>{if(Me)try{reactNative.Clipboard.setString(Me),Y(!0),setTimeout(()=>Y(!1),2e3);}catch(z){console.error("Failed to copy:",z);}},et=Be?.estimated_price_impact_percent??0,_e=Be?.max_slippage_percent??.25,be=Be?.minimum_deposit_amount_usd??3;return J?jsxRuntime.jsxs(reactNative.View,{style:ee.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ee.loadingText,{color:_.foregroundMuted,fontFamily:u.regular}],children:"Loading currencies..."})]}):Qe&&ie.length===0?jsxRuntime.jsxs(reactNative.View,{style:ee.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.errorText,{color:_.error,fontFamily:u.regular}],children:Qe}),jsxRuntime.jsx(reactNative.Text,{style:[ee.errorHint,{color:_.foregroundMuted,fontFamily:u.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ee.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.selectorLabel,{color:c.card.labelColor,fontFamily:u.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>De(true),disabled:J||ie.length===0,style:[ee.tokenSelectorButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],activeOpacity:.7,children:J?jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.loadingIcon,{backgroundColor:_.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.loadingLine,{backgroundColor:_.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[ee.loadingLine,{backgroundColor:_.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ee.tokenIconWrapper,children:[Rt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Rt,"png"))},style:ee.tokenMainIcon}),(Be||Se)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Be||Se,"png"))},style:[ee.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSelectorSymbol,{color:c.card.titleColor,fontFamily:u.semibold}],children:Rt?.symbol||f}),jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSelectorNetwork,{color:c.card.subtitleColor,fontFamily:u.regular}],numberOfLines:1,children:Be?.chain_name||Se?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ee.minDepositText,{color:_.warning,fontFamily:u.medium}],children:["$",be," minimum"]}),jsxRuntime.jsx(Ur,{size:16,color:c.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx($p,{visible:fe,onClose:()=>De(false),tokens:ie,selectedToken:f,selectedChainKey:B,onSelect:(z,ae)=>{L(z),D(ae);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??R,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:ee.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ee.qrWrapper,{backgroundColor:_.background,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth>0?c.card.borderWidth:1,borderColor:c.card.borderColor}],children:U?jsxRuntime.jsxs(reactNative.View,{style:ee.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ee.loadingText,{color:_.foregroundMuted,fontFamily:u.regular}],children:"Loading..."})]}):Me?jsxRuntime.jsx(Zi,{value:Me,size:180,logoUri:se(Ie(Be,"png")||Nt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:ee.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ee.errorText,{color:_.error,fontFamily:u.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:ee.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.addressLabel,{color:c.card.labelColor,fontFamily:u.medium}],children:"Deposit Address"}),K&&jsxRuntime.jsxs(reactNative.View,{style:ee.copiedIndicator,children:[jsxRuntime.jsx(st,{size:14,color:_.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ee.copiedText,{color:_.success,fontFamily:u.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Lr,{cardTokens:c.transferCrypto.depositAddress.card,onPress:!U&&Me?Ct:void 0,contentStyle:ee.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.addressText,{color:c.card.titleColor,fontFamily:u.regular}],numberOfLines:2,children:U?"Loading...":Me||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:ee.addressCopyIcon,children:jsxRuntime.jsx(Zo,{size:16,color:c.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ee.detailsCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(!ge),style:ee.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:u.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ee.chevronContainer,children:ge?jsxRuntime.jsx(gn,{size:16,color:c.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:16,color:c.card.actionColor,strokeWidth:2})})]}),ge&&jsxRuntime.jsxs(reactNative.View,{style:ee.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:u.regular}],children:["Price impact: ",et.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(en,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:u.regular}],children:["Slippage: Auto \u2022 ",_e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(en,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gs,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:u.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Mh,{depositConfirmationMode:p,depositAddress:Me,showWaitingUi:Pt,latestExecution:re,onIveDeposited:Ot}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:ee.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[ee.termsText,{color:_.primary,fontFamily:u.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(_t,{visible:Xe,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??R,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[ee.sheetHeader,{borderBottomColor:_.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ee.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ee.sheetTitle,{color:c.header.titleColor,fontFamily:u.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(false),style:ee.sheetCloseButton,children:jsxRuntime.jsx(pt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ee.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardTitle,{color:c.card.titleColor,fontFamily:u.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.infoCardValue,{color:c.card.titleColor,fontFamily:u.medium}],children:[et.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardDescription,{color:c.card.descriptionColor,fontFamily:u.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[ee.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardTitle,{color:c.card.titleColor,fontFamily:u.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.infoCardValue,{color:c.card.titleColor,fontFamily:u.medium}],children:[_e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardDescription,{color:c.card.descriptionColor,fontFamily:u.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var ee=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Ua=(e,t)=>`${t}:${e}`,Kw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},Qw=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function Vd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,onLatestExecution:m,onShowStatusSheet:w,onSelectedTokenIconUrl:x,onShowInfoSheet:k,onInfoSheetData:R,wallets:v,borderTopLeftRadius:S,borderTopRightRadius:_,sheetBorderRadius:u}){let{colors:c,fonts:C,components:f}=W(),L=a&&l?`${a}:${l}`:"solana:mainnet",[B,D]=qi.useState("USDC"),[P,A]=qi.useState(L),[U,q]=qi.useState([]),[Le,ie]=qi.useState(!v?.length),qe=v?.length?v:U,[J,Z]=qi.useState([]),[K,Y]=qi.useState(true),[ge,te]=qi.useState(false),[fe,De]=qi.useState(false),[ve,it]=qi.useState(false),[Ue,Ke]=qi.useState([]),[He,Qe]=qi.useState(new Map),[We]=qi.useState(()=>new Date),[Ve,Ee]=qi.useState(null),[re,ye]=qi.useState(false),[Xe,Ye]=qi.useState(null),[bt,tr]=qi.useState(false),[Re,Se]=qi.useState(false),[ke,at]=qi.useState(""),[Me,Ce]=qi.useState(""),Pe=qi.useRef(new reactNative.Animated.Value(0)).current;qi.useEffect(()=>{let Fe=reactNative.Animated.loop(reactNative.Animated.timing(Pe,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Fe.start(),()=>Fe.stop()},[Pe]);let Pt=Pe.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});qi.useEffect(()=>{Xe&&m?.(Xe);},[Xe]),qi.useEffect(()=>{re&&(w?.(true),ye(false));},[re]);let Ot=new Map;J.forEach(Fe=>{Fe.chains.forEach(Ft=>{let tt=`${Ft.chain_type}:${Ft.chain_id}`;Ot.has(tt)||Ot.set(tt,Ft);});});let Rt=Array.from(Ot.values()),ft=Kw(P),dr=Rt.find(Fe=>Fe.chain_type===ft.chainType&&Fe.chain_id===ft.chainId),Be=dr?.chain_type||"ethereum",Ct=Mo(qe,Be),et=Ct?.address||"",_e=qi.useRef(false);qi.useEffect(()=>{async function Fe(){try{Y(!0),Ee(null);let tt=await Qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Z(tt.data),tt.data.length>0&&!_e.current){_e.current=!0;let Ge,ro;if(a&&l)if(d)for(let qt of tt.data){let Mr=qt.chains.find(Br=>Br.chain_type===a&&Br.chain_id===l&&Br.token_address.toLowerCase()===d.toLowerCase());if(Mr){Ge=qt,ro=Mr;break}}else {let qt=Br=>Br.chain_type===a&&Br.chain_id===l,Mr=tt.data.find(Br=>Br.symbol==="USDC"&&Br.chains.some(qt));if(Mr)Ge=Mr,ro=Mr.chains.find(qt);else for(let Br of tt.data){let js=Br.chains.find(qt);if(js){Ge=Br,ro=js;break}}}if(!Ge&&s)for(let qt of tt.data){let Mr=qt.chains.find(Br=>Br.token_address.toLowerCase()===s.toLowerCase());if(Mr){Ge=qt,ro=Mr;break}}Ge||(Ge=tt.data.find(qt=>qt.symbol==="USDC"),Ge&&Ge.chains.length>0&&(ro=Ge.chains[0])),Ge||(Ge=tt.data.find(qt=>qt.symbol==="USDT"),Ge&&Ge.chains.length>0&&(ro=Ge.chains[0])),Ge||(Ge=tt.data[0],Ge.chains.length>0&&(ro=Ge.chains[0])),Ge&&D(Ge.symbol),ro&&A(Ua(ro.chain_id,ro.chain_type));}}catch(Ft){console.error("Error fetching supported tokens:",Ft),Ee("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:Ft});}finally{Y(false);}}Fe();},[t,s,n,o,a,l,d,h]),qi.useEffect(()=>{g&&g(Ue);},[Ue,g]),qi.useEffect(()=>{if(v?.length){ie(false);return}if(U.length>0){ie(false);return}let Fe=null,Ft=false,tt=async()=>{if(!Ft){ie(true);try{let Ge=await tn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Ft||(q(Ge.data),Ee(null),ie(!1));}catch(Ge){console.error("Error fetching wallets, retrying in 5s:",Ge),Ft||(Ee(Ge instanceof Error?Ge.message:"Failed to load wallets"),ie(false),Fe=setTimeout(tt,5e3));}}};return tt(),()=>{Ft=true,Fe&&clearTimeout(Fe);}},[e,r,o,n,s,t,v,U.length]);let be=Ct?.id??"",{showWaitingUi:z,handleIveDeposited:ae}=li({depositConfirmationMode:p,depositAddress:et,chain:P,externalUserId:e,publishableKey:t,modalOpenedAt:We,depositWalletId:be,depositExecutions:Ue,trackedExecutions:He,setDepositExecutions:Ke,setTrackedExecutions:Qe,setLatestExecution:Ye,setShowStatusSheet:ye,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h}),I=p==="manual"&&et&&!z;qi.useEffect(()=>{if(!J.length)return;let Fe=J.find(tt=>tt.symbol===B);if(!Fe||Fe.chains.length===0){let tt=J.find(Ge=>Ge.symbol==="USDC")||J[0];tt&&(D(tt.symbol),tt.chains.length>0&&A(Ua(tt.chains[0].chain_id,tt.chains[0].chain_type)));return}if(!Fe.chains.some(tt=>Ua(tt.chain_id,tt.chain_type)===P)){let tt=Fe.chains[0];A(Ua(tt.chain_id,tt.chain_type));}},[B,J,P]);let b=J.find(Fe=>Fe.symbol===B),V=Ie(b,"png")||void 0;qi.useEffect(()=>{x?.(V);},[V]);let O=b?.chains||[],Q=O.find(Fe=>Ua(Fe.chain_id,Fe.chain_type)===P),M=async()=>{if(et)try{reactNative.Clipboard.setString(et),te(!0),setTimeout(()=>te(!1),2e3);}catch(Fe){console.error("Failed to copy:",Fe);}},$e=Q?.estimated_price_impact_percent??0,Ne=Q?.max_slippage_percent??.25,Gr=Q?.minimum_deposit_amount_usd??3,X=Q?.chain_name||dr?.chain_name||"Network",$s=qi.useMemo(()=>{if(!ke.trim())return O;let Fe=ke.toLowerCase();return O.filter(Ft=>Ft.chain_name.toLowerCase().includes(Fe))},[O,ke]),Lt=qi.useMemo(()=>{if(!Me.trim())return J;let Fe=Me.toLowerCase();return J.filter(Ft=>Ft.symbol.toLowerCase().includes(Fe)||Ft.name?.toLowerCase().includes(Fe)||Ft.chains.some(tt=>tt.chain_name.toLowerCase().includes(Fe)))},[J,Me]);return K?jsxRuntime.jsxs(reactNative.View,{style:ne.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ne.loadingText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Loading currencies..."})]}):Ve&&J.length===0?jsxRuntime.jsxs(reactNative.View,{style:ne.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.errorText,{color:c.error,fontFamily:C.regular}],children:Ve}),jsxRuntime.jsx(reactNative.Text,{style:[ne.errorHint,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ne.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ne.content,children:[jsxRuntime.jsxs(reactNative.View,{style:ne.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.intentAddressLabel,{color:c.foregroundMuted,fontFamily:C.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[ne.qrCard,{backgroundColor:c.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:Le?jsxRuntime.jsxs(reactNative.View,{style:ne.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ne.loadingText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Loading..."})]}):et?jsxRuntime.jsx(reactNative.View,{style:ne.qrWrapper,children:jsxRuntime.jsx(Zi,{value:et,size:200,logoUri:se(Ie(b,"png")||Nt("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:se(Ie(Q,"png")||Nt("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:ne.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ne.errorText,{color:c.error,fontFamily:C.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:ne.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{at(""),Se(true);},style:[ne.selectorPill,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:[(Q||dr)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Q||dr,"png"))},style:ne.selectorPillIcon}),jsxRuntime.jsx(Gt,{size:14,color:f.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Ce(""),it(true);},disabled:K||J.length===0,style:[ne.selectorPill,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:[b&&jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(b,"png"))},style:ne.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ne.selectorPillText,{color:f.card.titleColor,fontFamily:C.semibold}],children:b?.symbol||B}),jsxRuntime.jsx(Gt,{size:14,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:ne.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:M,style:[ne.addressPill,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.addressPillText,{color:f.card.titleColor,fontFamily:C.regular}],numberOfLines:1,children:Le?"Loading...":et?Qw(et):"No address"}),ge?jsxRuntime.jsx(st,{size:14,color:c.success,strokeWidth:2}):jsxRuntime.jsx(Zo,{size:14,color:f.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:z&&!Xe?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:Pt}]},children:jsxRuntime.jsx(el,{size:16,color:c.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:c.foregroundMuted,fontFamily:C.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{R?.({priceImpact:$e,maxSlippage:Ne,minDepositUsd:Gr,chainName:X}),k?.(true);},style:ne.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(en,{size:14,color:f.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.infoFooterText,{color:f.card.subtitleColor,fontFamily:C.regular}],numberOfLines:1,children:["$",Gr," ",X," Minimum and ","<","1 min Processing"]})]}),I?jsxRuntime.jsxs(reactNative.View,{style:ne.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:ne.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:ae,activeOpacity:.8,style:[ne.ctaButton,{backgroundColor:c.primary,borderRadius:f.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ne.ctaText,{color:c.primaryForeground??"#FFF",fontFamily:C.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:ne.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[ne.ctaButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.button.borderRadius,borderWidth:1,borderColor:c.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[ne.ctaText,{color:c.foreground,fontFamily:C.semibold}],children:ge?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[ne.ctaButton,{backgroundColor:c.primary,borderRadius:f.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[ne.ctaText,{color:"#FFFFFF",fontFamily:C.semibold}],children:ge?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(_t,{visible:ve,onClose:()=>{it(false),Ce("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:u?.tokenSelector?.borderTopLeftRadius??S,borderTopRightRadius:u?.tokenSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[ne.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ne.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetTitle,{color:f.header.titleColor,fontFamily:C.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{it(false),Ce("");},style:ne.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(pt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ne.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ne.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:C.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:f.search.placeholderColor,value:Me,onChangeText:Ce,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(St,{style:ne.sheetList,contentContainerStyle:ne.sheetListContent,showsVerticalScrollIndicator:false,children:Lt.length===0?jsxRuntime.jsx(reactNative.View,{style:ne.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ne.emptyText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"No tokens found"})}):Lt.map(Fe=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{D(Fe.symbol),it(false),Ce("");},activeOpacity:.7,style:[ne.sheetItem,{backgroundColor:B===Fe.symbol?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Fe,"png"))},style:ne.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetItemTitle,{color:f.card.titleColor,fontFamily:C.medium}],children:Fe.symbol}),jsxRuntime.jsx(reactNative.View,{style:ne.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[ne.sheetItemBadge,{borderWidth:1,borderColor:c.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ne.sheetItemBadgeText,{color:f.card.subtitleColor,fontFamily:C.medium}],children:[Fe.chains.length," chain",Fe.chains.length!==1?"s":""]})})]},Fe.symbol))})]}),jsxRuntime.jsxs(_t,{visible:Re,onClose:()=>{Se(false),at("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:u?.chainSelector?.borderTopLeftRadius??S,borderTopRightRadius:u?.chainSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[ne.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ne.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetTitle,{color:f.header.titleColor,fontFamily:C.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Se(false),at("");},style:ne.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(pt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ne.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ne.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:C.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search networks",placeholderTextColor:f.search.placeholderColor,value:ke,onChangeText:at,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(St,{style:ne.sheetList,contentContainerStyle:ne.sheetListContent,showsVerticalScrollIndicator:false,children:$s.length===0?jsxRuntime.jsx(reactNative.View,{style:ne.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ne.emptyText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"No networks found"})}):$s.map(Fe=>{let Ft=Ua(Fe.chain_id,Fe.chain_type),tt=P===Ft;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{A(Ft),Se(false),at("");},activeOpacity:.7,style:[ne.chainItem,{backgroundColor:tt?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(Fe,"png"))},style:ne.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:ne.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[ne.chainItemName,{color:f.card.titleColor,fontFamily:C.medium}],children:Fe.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[ne.chainMinBadge,{backgroundColor:`${c.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ne.chainMinBadgeText,{color:c.warning,fontFamily:C.medium}],children:["$",Fe.minimum_deposit_amount_usd," Minimum"]})})]},Ft)})})]})]})}var ne=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function mg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Zw(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function Ld({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:d,useModal:p,heightProcessing:g,heightCompleted:T,heightCompletedExpanded:h}){let {colors:m,fonts:w,components:x}=W(),[k,R]=qi.useState(false),v=t==="pending"||t==="waiting"||t==="delayed",S=t==="succeeded",u=()=>{o&&reactNative.Linking.openURL(o);},c=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(_t,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:S?k?h??T??.55:T??.55:g??.4,borderTopLeftRadius:l,borderTopRightRadius:d,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:cr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:cr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:x.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:cr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:cr.container,children:[jsxRuntime.jsx(reactNative.View,{style:cr.iconContainer,children:v?jsxRuntime.jsx(wt,{size:80,strokeWidth:4,iconSize:56,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:se(r)},style:cr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[cr.tokenIconFill,{backgroundColor:m.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:se(r)},style:cr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[cr.tokenIconLarge,{backgroundColor:m.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[cr.statusBadge,{backgroundColor:x.container.iconBackgroundColor}],children:jsxRuntime.jsx(st,{size:16,color:x.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[cr.title,{color:x.container.titleColor,fontFamily:w.semibold}],children:v?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[cr.amount,{color:x.container.titleColor,fontFamily:w.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[cr.date,{color:x.container.subtitleColor,fontFamily:w.regular}],children:Zw(s)}),jsxRuntime.jsx(reactNative.Text,{style:[cr.subtitle,{color:x.container.subtitleColor,fontFamily:w.regular}],children:v?"This usually takes less than a minute.":"Your account has been credited successfully!"}),S&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:cr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[cr.divider,{backgroundColor:m.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:cr.detailsToggle,onPress:()=>R(!k),children:[jsxRuntime.jsx(reactNative.Text,{style:[cr.detailsToggleText,{color:x.container.actionTitle,fontFamily:w.medium}],children:k?"See less":"See more details"}),k?jsxRuntime.jsx(gn,{size:18,color:x.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:18,color:x.container.actionColor,strokeWidth:2})]}),k&&jsxRuntime.jsxs(reactNative.View,{style:cr.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[cr.txButton,{backgroundColor:x.card.backgroundColor,borderColor:m.border}],onPress:u,children:[jsxRuntime.jsx(reactNative.Text,{style:[cr.txLabel,{color:x.card.titleColor,fontFamily:w.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[cr.txHash,{color:x.card.subtitleColor,fontFamily:w.regular}],children:mg(o)}),jsxRuntime.jsx(hn,{size:16,color:x.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[cr.txButton,{backgroundColor:x.card.backgroundColor,borderColor:m.border}],onPress:c,children:[jsxRuntime.jsx(reactNative.Text,{style:[cr.txLabel,{color:x.card.titleColor,fontFamily:w.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[cr.txHash,{color:x.card.subtitleColor,fontFamily:w.regular}],children:mg(n)}),jsxRuntime.jsx(hn,{size:16,color:x.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var cr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function qp({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:d,fonts:p,components:g}=W(),T=[{icon:jsxRuntime.jsx(oo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(Xo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(Xo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(mo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:Yo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Yo.header,children:[jsxRuntime.jsxs(reactNative.View,{style:Yo.titleRow,children:[jsxRuntime.jsx(en,{size:16,color:g.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Yo.title,{color:g.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:Yo.closeButton,children:jsxRuntime.jsx(pt,{size:18,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Yo.rows,children:[T.map((h,m)=>jsxRuntime.jsxs(reactNative.View,{style:Yo.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Yo.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:h.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Yo.label,{color:g.card.titleColor,fontFamily:p.regular}],children:h.label})]},m)),jsxRuntime.jsxs(reactNative.View,{style:Yo.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Yo.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gs,{size:14,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Yo.label,{color:g.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var Yo=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var mn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function sS(){let{colors:e,components:t}=W(),r=qi.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[ns.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ns.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:ns.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ns.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ns.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:ns.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[ns.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:ns.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var ns=reactNative.StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function aS({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=W(),s=({tab:i,label:a,glyph:l})=>{let d=e===i,p=d?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Kl.item,activeOpacity:.8,onPress:()=>t(i),children:[d&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[Kl.badge,{backgroundColor:p}],children:jsxRuntime.jsx(reactNative.Text,{style:[Kl.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[Kl.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[Kl.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(s,{tab:"crypto",label:mn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(s,{tab:"cash",label:mn.tabs.cash,glyph:"$"})]})}var Kl=reactNative.StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function lS({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,showBalance:h=false,hideDepositTracker:m=false,enableCashApp:w=false,enableStripeLinkPay:x=false,StripeOnrampComponent:k,stripeOnrampEmail:R,stripeOnrampPhone:v,stripeMerchantIdentifier:S,stripePaymentSelectorPosition:_,stripeSkipSuccessConfirmation:u,stripeTheme:c,depositConfirmationMode:C="auto_ui",transferInputVariant:f="double_input",depositMenuDisplay:L="stacked",initialScreen:B="main",onDepositSuccess:D,onDepositError:P,sheetBorderRadius:A}){let U=A?.globalBorderTopLeftRadius,q=A?.globalBorderTopRightRadius,{colors:Le,fonts:ie}=W(),[qe,J]=qi.useState([]),[Z,K]=qi.useState(null),[Y,ge]=qi.useState("amount"),[te,fe]=qi.useState(false),[De,ve]=qi.useState(null),[it,Ue]=qi.useState(void 0),[Ke,He]=qi.useState(false),[Qe,We]=qi.useState(null),Ve=B==="tracker"&&!m?"tracker":B==="transfer"?"transfer":B==="card"?"card":B==="cashapp"&&w?"cashapp":"main",Ee=Ve==="main",[re,ye]=qi.useState(Ve),[Xe,Ye]=qi.useState("crypto"),{isAllowed:bt,isLoading:tr}=jl(o,e);qi.useEffect(()=>{if(!e||Z)return;let be=false;return ll(o).then(async z=>{if(be)return;let ae=[];for(let I of z?.transfer_crypto?.networks??[]){let b=I.icon_urls.find(V=>V.format==="png")?.url||I.icon_urls.find(V=>V.format==="svg")?.url;b&&ae.push(se(b));}for(let I of z?.payment_networks?.networks??[]){let b=I.icon_urls.find(V=>V.format==="png")?.url||I.icon_urls.find(V=>V.format==="svg")?.url;b&&ae.push(se(b));}ae.length>0&&await hp(ae),be||K(z);}).catch(console.error),()=>{be=true;}},[e,Z,o]);let Re=()=>{t();};qi.useEffect(()=>{e&&(ye(Ve),ge("amount"),He(false),We(null),Ye("crypto"));},[e,Ve]);let Se=qi.useCallback(be=>{be.length!==0&&J(z=>{let ae=new Map(z.map(I=>[I.id,I]));for(let I of be)ae.set(I.id,I);return Array.from(ae.values())});},[]),ke=qi.useCallback(()=>{He(false),We(null),Ee?(ye("main"),ge("amount")):Re();},[Ee,Re]),at=qe.filter(be=>be.status==="pending"||be.status==="waiting").length,Ce=!!(i&&a&&l&&d&&o)&&h!==false&&!!Z,Pe=tr||e&&!Z,Pt=bt===false,Ot=null;if(re==="stripe"&&k){let be=jsxRuntime.jsx(k,{publishableKey:o,email:R,phone:v,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,merchantIdentifier:S,paymentSelectorPosition:_,skipSuccessConfirmation:u,appName:Z?.project_name??"",onClose:ke});Ot=c?jsxRuntime.jsx(Zs,{...c,children:be}):be;}let Rt=re==="stripe"||re==="transfer"||re==="card"||re==="cashapp"?.9:re==="tracker"?.6:re==="main"?w?.6:.5:void 0,ft=re==="main"?.9:void 0,Be={main:A?.main,transfer:A?.transferCrypto,card:A?.buyWithCard,stripe:A?.stripeLinkPay,cashapp:A?.cashApp,tracker:A?.depositsTracker}[re],Ct=Be?.borderTopLeftRadius??U,et=Be?.borderTopRightRadius??q,_e=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De&&jsxRuntime.jsx(Ld,{visible:te,useModal:false,status:De.status,tokenIconUrl:De.destination_token_metadata?.icon_urls?.find(be=>be.format==="png")?.url||De.destination_token_metadata?.icon_url||it,explorerUrl:De.explorer_url,completionExplorerUrl:De.destination_explorer_url,date:De.created_at?new Date(De.created_at):void 0,amountUsd:De.source_amount_usd?parseFloat(De.source_amount_usd):void 0,onClose:()=>fe(false),heightProcessing:re==="card"?.35:void 0,heightCompleted:re==="card"?.41:void 0,heightCompletedExpanded:re==="card"?.53:void 0,borderTopLeftRadius:A?.depositStatus?.borderTopLeftRadius??U,borderTopRightRadius:A?.depositStatus?.borderTopRightRadius??q}),Qe&&jsxRuntime.jsx(qp,{visible:Ke,useModal:false,onClose:()=>He(false),priceImpact:Qe.priceImpact,maxSlippage:Qe.maxSlippage,minDepositUsd:Qe.minDepositUsd,chainName:Qe.chainName,borderTopLeftRadius:A?.infoSheet?.borderTopLeftRadius??U,borderTopRightRadius:A?.infoSheet?.borderTopRightRadius??q})]});return jsxRuntime.jsxs(_t,{visible:e,onClose:re==="main"?Re:ke,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:Rt,maxHeightPercent:ft,borderTopLeftRadius:Ct,borderTopRightRadius:et,overlay:_e,children:[re==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:n,showBack:false,onClose:Re,showBalance:Ce,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Z?.project_name}),Pe&&jsxRuntime.jsx(sS,{}),!Pe&&Pt&&jsxRuntime.jsxs(reactNative.View,{style:Kr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Kr.iconContainer,{backgroundColor:Le.cardHover}],children:jsxRuntime.jsx(tl,{size:32,color:Le.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedTitle,{color:Le.foreground,fontFamily:ie.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedDescription,{color:Le.foreground,opacity:.7,fontFamily:ie.regular}],children:"There are no supported tokens available from your current location."})]}),!Pe&&!Pt&&(()=>{let be=jsxRuntime.jsx(Ll,{onPress:()=>ye("transfer"),title:mn.transferCrypto.title,subtitle:mn.transferCrypto.subtitle,featuredTokens:Z?.transfer_crypto?.networks}),z=jsxRuntime.jsx(Al,{onPress:()=>ye("card"),title:mn.depositWithCard.title,subtitle:mn.depositWithCard.subtitle,paymentNetworks:Z?.payment_networks?.networks}),ae=w?jsxRuntime.jsx(zl,{onPress:()=>ye("cashapp")}):null,I=x&&k?jsxRuntime.jsx(Ml,{onPress:()=>ye("stripe"),title:mn.stripeLinkPay.title,subtitle:mn.stripeLinkPay.subtitle}):null,b=m?null:jsxRuntime.jsx(Wl,{onPress:()=>ye("tracker"),title:mn.depositTracker.title,subtitle:mn.depositTracker.subtitle,badge:at>0?at:void 0});return jsxRuntime.jsxs(reactNative.View,{style:Kr.optionsContainer,children:[L==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(aS,{selected:Xe,onSelect:Ye}),Xe==="crypto"?be:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[z,ae,I]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[be,z,ae,I]}),b]})})()]}),re==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:mn.transferCrypto.title,showBack:false,onClose:ke,showBalance:Ce,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Z?.project_name}),tr&&jsxRuntime.jsx(reactNative.View,{style:[Kr.centeredContainer,Kr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:Le.primary})}),!tr&&Pt&&jsxRuntime.jsxs(reactNative.View,{style:[Kr.centeredContainer,Kr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Kr.iconContainer,{backgroundColor:Le.cardHover}],children:jsxRuntime.jsx(tl,{size:32,color:Le.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedTitle,{color:Le.foreground,fontFamily:ie.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedDescription,{color:Le.foreground,opacity:.7,fontFamily:ie.regular}],children:"There are no supported tokens available from your current location."})]}),!tr&&!Pt&&jsxRuntime.jsx(St,{style:Kr.transferScrollContainer,contentContainerStyle:f==="compact"?Kr.scrollContentCompact:Kr.scrollContent,showsVerticalScrollIndicator:false,children:f==="compact"?jsxRuntime.jsx(Vd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:C,onExecutionsChange:Se,onDepositSuccess:D,onDepositError:P,onLatestExecution:ve,onShowStatusSheet:fe,onSelectedTokenIconUrl:Ue,onShowInfoSheet:He,onInfoSheetData:We,borderTopLeftRadius:U,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:A?.tokenSelector,chainSelector:A?.chainSelector,infoSheet:A?.infoSheet,depositStatus:A?.depositStatus}}):f==="single_input"?jsxRuntime.jsx(jp,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:C,onExecutionsChange:Se,onDepositSuccess:D,onDepositError:P,onLatestExecution:ve,onShowStatusSheet:fe,onSelectedTokenIconUrl:Ue,borderTopLeftRadius:U,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:A?.tokenSelector,infoSheet:A?.infoSheet,depositStatus:A?.depositStatus}}):jsxRuntime.jsx(hd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:C,onExecutionsChange:Se,onDepositSuccess:D,onDepositError:P,onLatestExecution:ve,onShowStatusSheet:fe,onSelectedTokenIconUrl:Ue,borderTopLeftRadius:U,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:A?.tokenSelector,chainSelector:A?.chainSelector,infoSheet:A?.infoSheet,depositStatus:A?.depositStatus}})})]}),re==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:`Deposit ${s||"USDC"}`,showBack:Y==="onramp",onBack:()=>ge("amount"),onClose:ke,showBalance:Ce,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Z?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Kr.buyWithCardContainer,children:jsxRuntime.jsx(Sd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onDepositSuccess:D,onDepositError:P,onExecutionsChange:Se,onLatestExecution:ve,onShowStatusSheet:fe,onSelectedTokenIconUrl:Ue,view:Y,onViewChange:be=>ge(be),borderTopLeftRadius:U,borderTopRightRadius:q,sheetBorderRadius:{providerModal:A?.providerModal,webView:A?.webView,currencyModal:A?.currencyModal}})})]}),re==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:Kr.cashAppContainer,children:jsxRuntime.jsx(cd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onBack:ke,onClose:ke,onDepositSuccess:D})}),re==="stripe"&&Ot&&jsxRuntime.jsx(reactNative.View,{style:Kr.stripeLinkPayContainer,children:Ot}),re==="tracker"&&jsxRuntime.jsx(zp,{active:re==="tracker",onClose:ke,executions:qe,externalUserId:r,publishableKey:o})]})}function Wd({theme:e="auto",...t}){return jsxRuntime.jsx(lS,{...t})}var Kr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},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 Ed(e,t=true){return oi({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>gc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Qp(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return oi({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await Qn(s),d=null,p=null,g=null,T=null,h,m,w,x=l.data.some(k=>k.chains.some(R=>{let v=R.chain_type===t&&R.chain_id===r&&R.token_address.toLowerCase()===o.toLowerCase();return v&&(d=R.minimum_deposit_amount_usd,p=R.estimated_processing_time,g=R.max_slippage_percent,T=R.estimated_price_impact_percent,w=R.chain_name,m=k),v}));if(m){let k=Ie(m,"png");k&&(h=se(k));}return {isSupported:x,minimumAmountUsd:d,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:T,errorMessage:x?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 Yp(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return oi({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await yc(t,r,o,n,s);if(l.balance){let d=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,T=BigInt(g),h=BigInt(10**d),m=T/h,x=(T%h).toString().padStart(d,"0").replace(/0+$/,""),k=x?`${m}.${x}`:m.toString();return {balanceBaseUnit:g,balanceHuman:k,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:d,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var dS=2500,uS=3e3,pS=6e4;function Gp({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=qi.useState([]),[l,d]=qi.useState(false),p=qi.useRef(new Date),g=qi.useRef(new Map),T=qi.useRef(false),h=qi.useRef(n),m=qi.useRef(s);return qi.useEffect(()=>{h.current=n;},[n]),qi.useEffect(()=>{m.current=s;},[s]),qi.useEffect(()=>{o&&!T.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),T.current=o;},[o]),qi.useEffect(()=>{if(!e||!o)return;let w=p.current,x=async()=>{try{let R=await rn(e,t,"withdraw"),v=new Date(w.getTime()-pS),S=[...R.data].sort((C,f)=>{let L=C.created_at?new Date(C.created_at).getTime():0;return (f.created_at?new Date(f.created_at).getTime():0)-L}),_=["pending","waiting","delayed"],u=["succeeded","failed"],c=null;for(let C of S){let f=C.created_at?new Date(C.created_at):null;if(!f||f<v)continue;let L=g.current.get(C.id);if(!L){c=C;break}if(_.includes(L)&&u.includes(C.status)){c=C;break}}if(c){let C=c,f=C.created_at?new Date(C.created_at):null;if(!f||f<p.current)return;let L=g.current.get(C.id);g.current.set(C.id,C.status),a(B=>{let D=B.findIndex(P=>P.id===C.id);if(D>=0){let P=[...B];return P[D]=C,P}return [...B,C]}),C.status==="succeeded"&&(!L||_.includes(L))?h.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&L!=="failed"&&m.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(R){console.error("Failed to fetch withdraw executions:",R),m.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:R});}};x();let k=setInterval(x,dS);return d(true),()=>{clearInterval(k),d(false);}},[e,t,o]),qi.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await fu({deposit_wallet_id:r},t);}catch{}};w();let x=setInterval(w,uS);return ()=>clearInterval(x)},[o,r,t]),{executions:i,isPolling:l}}var Jp=(e,t)=>`${t}:${e}`;function Gl({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:d,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:T,fonts:h,components:m}=W(),[w,x]=qi.useState(false),[k,R]=qi.useState(false),v=m.card,S=t?e.find(C=>C.symbol===t):void 0,_=S?.chains||[],u=r?_.find(C=>Jp(C.chain_id,C.chain_type)===r):void 0,c={backgroundColor:v.backgroundColor,borderRadius:v.borderRadius,borderWidth:v.borderWidth||1,borderColor:v.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:vt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:vt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.label,{color:v.labelColor,fontFamily:h.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[vt.selectButton,c],onPress:()=>!s&&e.length>0&&x(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[vt.placeholder,{color:v.subtitleColor,fontFamily:h.regular}],children:"Loading..."}):S?jsxRuntime.jsxs(reactNative.View,{style:vt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(S,"png"))},style:vt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[vt.selectedText,{color:v.titleColor,fontFamily:h.medium}],numberOfLines:1,children:S.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[vt.placeholder,{color:v.subtitleColor,fontFamily:h.regular}],children:"Select receive token"}),jsxRuntime.jsx(Gt,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:vt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.label,{color:v.labelColor,fontFamily:h.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[vt.selectButton,c,(!S||_.length===0)&&vt.disabled],onPress:()=>!s&&S&&_.length>0&&R(true),activeOpacity:.7,disabled:s||!S||_.length===0,children:[u?jsxRuntime.jsxs(reactNative.View,{style:vt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(u,"png"))},style:vt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[vt.selectedText,{color:v.titleColor,fontFamily:h.medium}],numberOfLines:1,children:u.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[vt.placeholder,{color:v.subtitleColor,fontFamily:h.regular}],children:"Chain"}),jsxRuntime.jsx(Gt,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(_t,{visible:w,onClose:()=>x(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:vt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:vt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[vt.pickerTitle,{color:T.foreground,fontFamily:h.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:vt.pickerHeaderClose,onPress:()=>x(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Xs,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:vt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[vt.pickerItem,{backgroundColor:C.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(C.symbol),x(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(C,"png"))},style:vt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[vt.pickerItemText,{color:T.foreground,fontFamily:h.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[vt.pickerItemSub,{color:T.foregroundMuted,fontFamily:h.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(st,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(_t,{visible:k,onClose:()=>R(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:vt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:vt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[vt.pickerTitle,{color:T.foreground,fontFamily:h.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:vt.pickerHeaderClose,onPress:()=>R(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Xs,{data:_,keyExtractor:C=>Jp(C.chain_id,C.chain_type),contentContainerStyle:vt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let f=Jp(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[vt.pickerItem,{backgroundColor:f===r?T.cardHover:"transparent"}],onPress:()=>{n(f),R(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:se(Ie(C,"png"))},style:vt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[vt.pickerItemText,{color:T.foreground,fontFamily:h.medium}],children:C.chain_name}),f===r&&jsxRuntime.jsx(st,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var vt=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function Zp(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return oi({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>mu({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function gS(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function yS(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function bS(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function zd({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:d,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:T,estimatedProcessingTime:h,maxSlippagePercent:m,priceImpactPercent:w,canWithdraw:x,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:v,onWithdrawSubmitted:S,onViewTracker:_}){let u="https://unifold.io/terms",c="https://unifold.io/support",{colors:C,fonts:f,components:L}=W(),[B,D]=qi.useState(a||""),[P,A]=qi.useState(""),[U,q]=qi.useState(false),[Le,ie]=qi.useState(null),[qe,J]=qi.useState(false),[Z,K]=qi.useState(""),Y=qi.useRef(null);qi.useEffect(()=>{D(a||""),A(""),ie(null);},[a]);let ge=B.trim();qi.useEffect(()=>{let Ce=setTimeout(()=>K(ge),500);return ()=>clearTimeout(Ce)},[ge]);let{data:te,isLoading:fe,error:De}=Zp({chainType:d?.chain_type,chainId:d?.chain_id,tokenAddress:d?.token_address,recipientAddress:Z,publishableKey:e,enabled:Z.length>5&&!!d}),ve=ge!==Z,it=qi.useMemo(()=>!ge||ge.length<=5||ve||fe?null:De?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${d?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${d?.chain_name}`:"Invalid address":null,[ge,ve,fe,De,te,d,l]),Ue=!ve&&!!te?.valid&&!it,Ke=qi.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),He=qi.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),Qe=n||p?.symbol||"TOKEN",We=p?.decimals??6,Ve=qi.useMemo(()=>{let Ce=parseFloat(P);return !Ce||Ce<=0?0:Ce},[P]),Ee=qi.useMemo(()=>{let Ce=parseFloat(P);return !Ce||Ce<=0?0:Ce*Ke},[P,Ke]),re=qi.useCallback(async()=>{try{let Pe=await Lg("expo-clipboard").getStringAsync();Pe&&(D(Pe.trim()),ie(null));}catch{}},[]),ye=qi.useCallback(()=>{He<=0||A(p?.balanceHuman??"0");},[He,p]),Xe=T!==null&&Ee>0&&Ee<T,Ye=Ve>0&&He>0&&Ve>He,bt=ge.length>0&&P.trim().length>0&&Ve>0&&Ue&&!Xe&&!Ye&&!!p,tr=qi.useCallback(async()=>{if(!(!l||!d||!bt||!x)){q(true),ie(null);try{let Ce=await k({destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,recipientAddress:ge}),Pe=yS(Ve,We),Pt=bS(Ve,We),Ot={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:Qe,sourceTokenIconUrl:i,destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,destinationTokenSymbol:l.symbol,destinationChainName:d.chain_name,destinationTokenIconUrl:l?se(Ie(l,"png")):void 0,amount:Pt,amountBaseUnit:Pe,submittedAt:new Date,withdrawIntentAddress:Ce.address,recipientAddress:ge};await R(Ot),S(Ot);}catch(Ce){let Pe=Ce instanceof Error?Ce.message:"Withdrawal failed. Please try again.",Pt=Pe.length>120?"Withdrawal failed. Please try again.":Pe;ie(Pt),v?.({message:Pe,error:Ce,code:"WITHDRAW_FAILED"});}finally{q(false);}}},[l,d,bt,x,ge,t,r,o,Qe,i,P,He,p,Ve,We,Ee,k,R,v,S]),Re=L.input,Se=L.card,ke=L.button,at=it?C.error:Re.borderColor,Me=qi.useMemo(()=>U?"Processing...":Ye?"Insufficient balance":Xe?`Minimum $${T?.toFixed(2)}`:Le?"Withdrawal failed \u2014 try again":"Withdraw",[U,Ye,Xe,T,Le]);return jsxRuntime.jsxs(reactNative.View,{style:xt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:xt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xt.label,{color:Se.labelColor,fontFamily:f.medium}],children:"Recipient address"}),(ve||fe)&&ge.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:re,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(dm,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[xt.inputRow,{backgroundColor:Re.backgroundColor,borderRadius:Re.borderRadius,borderWidth:Re.borderWidth,borderColor:at}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[xt.textInput,{color:Re.textColor,fontFamily:f.regular}],placeholder:"Enter wallet address",placeholderTextColor:Re.placeholderColor,value:B,onChangeText:Ce=>{D(Ce),ie(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Y.current?.focus()})}),it?jsxRuntime.jsx(reactNative.Text,{style:[xt.errorText,{color:C.error,fontFamily:f.regular}],children:it}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[xt.label,{color:Se.labelColor,fontFamily:f.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:f.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[xt.amountRow,{backgroundColor:Re.backgroundColor,borderRadius:Re.borderRadius,borderWidth:Re.borderWidth,borderColor:Re.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[xt.amountInput,{color:Re.textColor,fontFamily:f.regular}],placeholder:"0.00",placeholderTextColor:Re.placeholderColor,value:P,onChangeText:Ce=>{(Ce===""||/^\d*\.?\d*$/.test(Ce))&&(A(Ce),ie(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[xt.unitLabel,{color:C.foregroundMuted,fontFamily:f.medium}],children:Qe}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[xt.maxButton,{backgroundColor:`${C.primary}20`}],onPress:ye,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[xt.maxText,{color:C.primary,fontFamily:f.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[xt.detailsCard,{marginTop:24,backgroundColor:Se.backgroundColor,borderRadius:Se.borderRadius,borderWidth:Se.borderWidth||1,borderColor:Se.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:xt.detailsToggle,onPress:()=>J(!qe),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xt.detailIcon,{backgroundColor:Se.iconBackgroundColor,borderRadius:Se.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:Se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[xt.detailsLabel,{color:Se.titleColor,fontFamily:f.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:f.medium},children:gS(h)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:qe?"180deg":"0deg"}]},children:jsxRuntime.jsx(Gt,{size:16,color:Se.actionColor,strokeWidth:2})})]})}),qe&&jsxRuntime.jsxs(reactNative.View,{style:xt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xt.detailIcon,{backgroundColor:Se.iconBackgroundColor,borderRadius:Se.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:12,color:Se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[xt.detailsLabel,{color:Se.titleColor,fontFamily:f.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:f.medium},children:["Auto \u2022 ",(m??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xt.detailIcon,{backgroundColor:Se.iconBackgroundColor,borderRadius:Se.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xo,{size:12,color:Se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[xt.detailsLabel,{color:Se.titleColor,fontFamily:f.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:f.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Le&&jsxRuntime.jsx(reactNative.Text,{style:[xt.errorText,{color:C.error,fontFamily:f.regular,textAlign:"center"}],children:Le}),jsxRuntime.jsxs(reactNative.View,{style:xt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[xt.withdrawButton,{backgroundColor:ke.primaryBackground,borderRadius:ke.borderRadius,borderWidth:ke.borderWidth,borderColor:ke.borderColor,opacity:!bt||!x||U?.5:1}],onPress:tr,disabled:!bt||!x||U,activeOpacity:.8,children:[U&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:ke.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[xt.withdrawButtonText,{color:ke.primaryText,fontFamily:f.medium}],children:Me})]}),jsxRuntime.jsxs(reactNative.View,{style:xt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:xt.historyLink,onPress:_,activeOpacity:.7,children:[jsxRuntime.jsx(oo,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[xt.historyText,{color:C.foregroundMuted,fontFamily:f.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:xt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[xt.legalText,{color:C.foregroundMuted,fontFamily:f.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[xt.legalSeparator,{color:C.foregroundMuted,fontFamily:f.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(c),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[xt.legalText,{color:C.foregroundMuted,fontFamily:f.regular}],children:"Help"})})]})]})]})]})}var xt=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function SS(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 TS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Nd({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=W(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,d=se(Ie(e.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=SS(e.created_at||new Date().toISOString()),T=TS(e.source_amount_usd);return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Ci.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ci.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:Ci.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ci.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Xa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(Js,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(st,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Ci.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(Ur,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Ci=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function tm(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let d=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${d} ${l}`}catch{return e}}function Rg(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function xS(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 _g(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Ig(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Jl({label:e,value:t,isLast:r}){let{fonts:o,components:n}=W(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ut.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[ut.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[ut.divider,{backgroundColor:s.borderColor}]})]})}function om({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=W(),[d,p]=qi.useState([]),[g,T]=qi.useState(!!n),h=l.card,m=l.button,w=l.header,x=l.container;qi.useEffect(()=>{pu().then(q=>p(q.data)).catch(()=>{});},[]),qi.useEffect(()=>{T(!!n);},[e?.id]);let k=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,R=e?e.status==="failed"||e.status==="refunded":false,v=R?i.error:k?i.warning:i.success,S=R?"Failed":k?"Processing":"Completed",_=e?.destination_token_metadata?se(Ie(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?se(t.destinationTokenIconUrl):se(Nt("/icons/tokens/png/usdc.png")),u=e?.created_at?tm(e.created_at):t.submittedAt?tm(t.submittedAt.toISOString()):tm(new Date().toISOString()),c=e?`${Rg(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${_g(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${Rg(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${_g(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,f=e?xS(e.source_amount_usd,e.source_amount_base_unit):"$0.00",L=e?hc(d,e.source_chain_type,e.source_chain_id):t.sourceChainId,B=e?hc(d,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,D=e?.transaction_hash,P=e?.explorer_url,A=e?.destination_transaction_hashes?.[0],U=e?.destination_explorer_url;return jsxRuntime.jsxs(St,{style:ut.scroll,contentContainerStyle:ut.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ut.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ys,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ut.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ut.headerTitle,{color:w.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:ut.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(pt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ut.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:_},style:ut.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ut.statusBadge,{backgroundColor:v}],children:R?jsxRuntime.jsx(Xa,{size:10,color:"#FFFFFF",strokeWidth:3}):k?jsxRuntime.jsx(reactNative.View,{style:ut.spinnerDot}):jsxRuntime.jsx(st,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ut.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ut.statusDot,{backgroundColor:v}]}),jsxRuntime.jsx(reactNative.Text,{style:[ut.statusText,{color:v,fontFamily:a.medium}],children:S})]}),jsxRuntime.jsx(reactNative.Text,{style:[ut.dateText,{color:x.subtitleColor,fontFamily:a.regular}],children:u}),jsxRuntime.jsxs(reactNative.View,{style:[ut.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:[jsxRuntime.jsx(Jl,{label:"Amount Sent",value:c}),jsxRuntime.jsx(Jl,{label:"Amount Received",value:C}),jsxRuntime.jsx(Jl,{label:"USD Value",value:f}),jsxRuntime.jsx(Jl,{label:"Source Network",value:L}),jsxRuntime.jsx(Jl,{label:"Destination Network",value:B,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ut.moreDetailsRow,onPress:()=>T(q=>!q),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.moreDetailsText,{color:x.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(gn,{size:16,color:x.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:16,color:x.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[ut.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:D&&P?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ut.txRow,onPress:()=>reactNative.Linking.openURL(P),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.txLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.txHash,{color:h.titleColor,fontFamily:a.regular}],children:Ig(D)}),jsxRuntime.jsx(hn,{size:14,color:h.actionColor,strokeWidth:2})]}),!k&&A&&U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[ut.divider,{backgroundColor:h.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ut.txRow,onPress:()=>reactNative.Linking.openURL(U),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.txLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.txHash,{color:h.titleColor,fontFamily:a.regular}],children:Ig(A)}),jsxRuntime.jsx(hn,{size:14,color:h.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:ut.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[ut.detailLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:ut.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ut.button,ut.halfButton,{backgroundColor:m.secondaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ut.buttonText,{color:m.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ut.button,ut.halfButton,{backgroundColor:m.primaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ut.buttonText,{color:m.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var ut=reactNative.StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:reactNative.StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function vg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function $d({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=W(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",d=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:er.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.closeButton,onPress:r,children:jsxRuntime.jsx(pt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[er.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(st,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[er.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[er.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",vg(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:er.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[er.button,er.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[er.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[er.button,er.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[er.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):d?jsxRuntime.jsxs(reactNative.View,{style:er.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.closeButton,onPress:r,children:jsxRuntime.jsx(pt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[er.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(pt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[er.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[er.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[er.button,er.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[er.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:er.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.closeButton,onPress:r,children:jsxRuntime.jsx(pt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(wt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:se(e.sourceTokenIconUrl)},style:er.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[er.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[er.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[er.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",vg(e.recipientAddress)]})]})}var er=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function FS(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:se(Ie(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:se(Ie(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 Pg=(e,t)=>`${t}:${e}`;function DS(){let{colors:e}=W(),t=qi.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return qi.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function Kd({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:d="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:T,heightPercent:h=.94,sheetBorderRadius:m,sourceChainType:w,sourceChainId:x,sourceTokenAddress:k,sourceTokenSymbol:R,sourceChainName:v,sourceTokenIconUrl:S}){let{colors:_,fonts:u}=W(),[c,C]=qi.useState("form"),[f,L]=qi.useState(w),[B,D]=qi.useState(x),[P,A]=qi.useState(k),[U,q]=qi.useState(R),[Le,ie]=qi.useState(v),[qe,J]=qi.useState(S),[Z,K]=qi.useState(null),[Y,ge]=qi.useState(null),[te,fe]=qi.useState(null),[De,ve]=qi.useState(),[it,Ue]=qi.useState([]),[Ke,He]=qi.useState(null),[Qe,We]=qi.useState("form"),Ve=qi.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Ee=qi.useRef(null),re=!!f&&!!B&&!!P,{data:ye,isLoading:Xe}=Ed(r,e&&c==="form"),Ye=ye?.data??[],{data:bt,isLoading:tr}=Qp({sourceChainType:f,sourceChainId:B,sourceTokenAddress:P,sourceTokenSymbol:U,publishableKey:r,enabled:e&&re&&c==="form"}),{data:Re,isLoading:Se}=Yp({address:n,chainType:f,chainId:B,tokenAddress:P,publishableKey:r,enabled:e&&re}),{executions:ke}=Gp({userId:o,publishableKey:r,depositWalletId:De,enabled:!!De&&e,onWithdrawSuccess:g,onWithdrawError:T});qi.useEffect(()=>{if(!e||c!=="tracker")return;let O=false;return rn(o,r,"withdraw").then(Q=>{O||Ue(Q.data);}).catch(console.error),()=>{O=true;}},[e,c,o,r]),qi.useEffect(()=>{e&&(Ee.current&&(clearTimeout(Ee.current),Ee.current=null),C("form"),L(w),D(x),A(k),q(R),ie(v),J(S),K(null),ge(null),fe(null),ve(void 0),Ue([]),He(null),We("form"),Ve.setValue(reactNative.Dimensions.get("window").width));},[e]),qi.useEffect(()=>()=>{Ee.current&&clearTimeout(Ee.current);},[]),qi.useEffect(()=>{qe||bt?.iconUrl&&J(bt.iconUrl);},[bt?.iconUrl,qe]),qi.useEffect(()=>{Le||bt?.chainName&&ie(bt.chainName);},[bt?.chainName,Le]),qi.useEffect(()=>{if(!Ye.length||Z)return;let O,Q;if(i&&a)if(l)for(let M of Ye){let $e=M.chains.find(Ne=>Ne.chain_type===i&&Ne.chain_id===a&&Ne.token_address.toLowerCase()===l.toLowerCase());if($e){O=M,Q=$e;break}}else for(let M of Ye){let $e=M.chains.find(Ne=>Ne.chain_type===i&&Ne.chain_id===a);if($e){O=M,Q=$e;break}}O||(O=Ye[0]),O&&(K(O),ge(Q??O.chains[0]??null));},[Ye,Z,i,a,l]),qi.useEffect(()=>{c==="confirming"&&ke.length>0&&C("details");},[c,ke]);let at=qi.useCallback(()=>{t(),Ee.current=setTimeout(()=>{C("form"),L(w),D(x),A(k),q(R),ie(v),J(S),K(null),ge(null),fe(null),ve(void 0),Ue([]),He(null),We("form"),Ee.current=null;},300);},[t,w,x,k,R,v,S]),Me=qi.useCallback(O=>{let Q=Ye.find(M=>M.symbol===O);Q&&(K(Q),Q.chains.length>0&&ge(Q.chains[0]));},[Ye]),Ce=qi.useCallback(O=>{if(!Z)return;let Q=Z.chains.find(M=>Pg(M.chain_id,M.chain_type)===O);Q&&ge(Q);},[Z]),Pe=qi.useCallback(async O=>{let Q=await tn({external_user_id:o,destination_chain_type:O.destinationChainType,destination_chain_id:O.destinationChainId,destination_token_address:O.destinationTokenAddress,recipient_address:O.recipientAddress,action_type:"withdraw"},r),M=Mo(Q.data,f??"");if(!M)throw new Error(`No deposit wallet found for chain type: ${f}`);return ve(M.id),{id:M.id,address:M.address}},[o,r,f]),Pt=qi.useCallback(O=>{fe(O),C("confirming");},[]),Ot=qi.useCallback(O=>{He(O),Ve.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ve,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ve]),Rt=qi.useCallback(()=>{reactNative.Animated.timing(Ve,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>He(null));},[Ve]),ft=Xe||tr,dr=bt?.isSupported??null,Be=c==="confirming"?"Withdrawal Status":d,Ct=m?.globalBorderTopLeftRadius,et=m?.globalBorderTopRightRadius,_e=m?.main?.borderTopLeftRadius??Ct,be=m?.main?.borderTopRightRadius??et,z=m?.tokenSelector?.borderTopLeftRadius??Ct,ae=m?.tokenSelector?.borderTopRightRadius??et,I=m?.chainSelector?.borderTopLeftRadius??Ct,b=m?.chainSelector?.borderTopRightRadius??et,V=(()=>{if(c!=="form"||!re||Se||!Re)return;let O=U||Re.symbol,Q=Re.balanceUsd;if(Q!=null){let Ne=`$${parseFloat(Q).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return O?`Balance: ${Ne} ${O}`:`Balance: ${Ne}`}let M=Re.balanceHuman;if(!(!M||M==="0"))return O?`Balance: ${M} ${O}`:`Balance: ${M}`})();return jsxRuntime.jsx(_t,{visible:e,onClose:at,closeOnBackdropPress:false,enablePanDownToClose:c==="tracker"||c==="form",showHandle:c==="tracker"||c==="form",heightPercent:c==="confirming"?.3:c==="details"?.7:c==="tracker"?.9:h,borderTopLeftRadius:_e,borderTopRightRadius:be,children:c==="confirming"&&te?jsxRuntime.jsx($d,{txInfo:te,executions:ke,onClose:at,onViewTracker:()=>{We("confirming"),C("tracker");}}):c==="details"&&te?jsxRuntime.jsx(om,{execution:ke.length>0?ke[ke.length-1]:null,txInfo:te,onClose:at,onViewHistory:()=>{We("details"),C("tracker");},onHeaderClose:()=>C("form")}):c==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Hn.trackerContainer,children:[jsxRuntime.jsx(eo,{title:"Withdrawal History",onClose:()=>C(Qe)}),it.length===0?jsxRuntime.jsx(reactNative.View,{style:Hn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Hn.emptyText,{color:_.foregroundMuted,fontFamily:u.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Xs,{data:it,keyExtractor:O=>O.id,contentContainerStyle:Hn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:O})=>jsxRuntime.jsx(Nd,{execution:O,onPress:()=>Ot(O)})}),Ke&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Hn.historyDetailOverlay,{backgroundColor:_.background,transform:[{translateX:Ve}]}],children:jsxRuntime.jsx(om,{execution:Ke,txInfo:FS(Ke),onClose:at,onBack:Rt,onViewHistory:Rt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:Be,subtitle:V,onClose:at}),ft?jsxRuntime.jsx(DS,{}):dr===false?jsxRuntime.jsxs(reactNative.View,{style:Hn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Hn.unsupportedTitle,{color:_.foreground,fontFamily:u.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Hn.unsupportedMessage,{color:_.foregroundMuted,fontFamily:u.regular}],children:bt?.errorMessage})]}):jsxRuntime.jsx(VS,{publishableKey:r,sourceChainType:f??"",sourceChainId:B??"",sourceTokenAddress:P??"",sourceTokenSymbol:U,sourceChainName:Le,sourceTokenIconUrl:qe,recipientAddressProp:s,destinationTokens:Ye,selectedToken:Z,selectedChain:Y,selectedChainKey:Y?Pg(Y.chain_id,Y.chain_type):null,onTokenChange:Me,onChainChange:Ce,tokensLoading:Xe,balanceData:Re??null,isLoadingBalance:Se,sourceValidation:bt??null,onDepositWalletCreation:Pe,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:Pt,onViewTracker:()=>{We("form"),C("tracker");},tokenSelectorLeft:z,tokenSelectorRight:ae,chainSelectorLeft:I,chainSelectorRight:b})]})})}function VS({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:d,selectedChain:p,selectedChainKey:g,onTokenChange:T,onChainChange:h,tokensLoading:m,balanceData:w,isLoadingBalance:x,sourceValidation:k,onDepositWalletCreation:R,onWithdraw:v,onWithdrawError:S,onWithdrawSubmitted:_,onViewTracker:u,tokenSelectorLeft:c,tokenSelectorRight:C,chainSelectorLeft:f,chainSelectorRight:L}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(St,{style:{flex:1,paddingTop:16},contentContainerStyle:Hn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Hn.doubleInputWrapper,children:jsxRuntime.jsx(Gl,{tokens:l,selectedTokenSymbol:d?.symbol??null,selectedChainKey:g,onTokenChange:T,onChainChange:h,isLoading:m,tokenPickerBorderTopLeftRadius:c,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:f,chainPickerBorderTopRightRadius:L})}),jsxRuntime.jsx(zd,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:d,selectedChain:p,balanceData:w,isLoadingBalance:x,minimumWithdrawAmountUsd:k?.minimumAmountUsd??null,estimatedProcessingTime:k?.estimatedProcessingTime??null,maxSlippagePercent:k?.maxSlippagePercent??null,priceImpactPercent:k?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:R,onWithdraw:v,onWithdrawError:S,onWithdrawSubmitted:_,onViewTracker:u})]})})}var Hn=reactNative.StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});reactNative.StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Vg=qi.createContext(null);function HS({children:e,publishableKey:t,config:r}){let[o]=qi.useState(()=>new lp({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=qi.useState(false),[i,a]=qi.useState(null),[l,d]=qi.useState(false),[p,g]=qi.useState(null),T=reactNative.useColorScheme(),h=qi.useRef(false);h.current||(uc({publishableKey:t}),h.current=true);let m=qi.useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?T==="dark"?"dark":"light":P},[r?.appearance,T]);qi.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.'),uc({publishableKey:t});},[t]),qi.useEffect(()=>()=>{x.current&&clearTimeout(x.current),u.current&&clearTimeout(u.current);},[]);let w=qi.useRef(null),x=qi.useRef(null),k=qi.useCallback(P=>{x.current&&(clearTimeout(x.current),x.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 A=new Promise((U,q)=>{w.current={resolve:U,reject:q};});return a(P),s(true),A},[]),R=qi.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),s(false),x.current=setTimeout(()=>{a(null),x.current=null;},200);},[]),v=qi.useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),S=qi.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),_=qi.useRef(null),u=qi.useRef(null),c=qi.useRef(void 0),C=qi.useCallback(P=>{u.current&&(clearTimeout(u.current),u.current=null),_.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),_.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),_.current=null);let A=new Promise((U,q)=>{_.current={resolve:U,reject:q};});return c.current=P.onClose,g(P),d(true),A},[]),f=qi.useCallback(()=>{_.current&&(_.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),_.current=null),c.current?.(),c.current=void 0,d(false),u.current=setTimeout(()=>{g(null),u.current=null;},200);},[]),L=qi.useCallback(P=>{p?.onSuccess&&p.onSuccess(P),_.current&&(_.current.resolve(P),_.current=null);},[p]),B=qi.useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),p?.onError&&p.onError(P),_.current&&(_.current.reject(P),_.current=null);},[p]),D=qi.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:R,beginWithdraw:C,closeWithdraw:f}),[t,k,R,C,f]);return jsxRuntime.jsx(up,{client:o,children:jsxRuntime.jsx(Vg.Provider,{value:D,children:jsxRuntime.jsxs(Zs,{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Wd,{visible:n,onClose:R,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:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLinkPay:r?.enableStripeLinkPay,enableCashApp:r?.enableCashApp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?_f():void 0,onDepositSuccess:v,onDepositError:S,theme:m,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(Kd,{visible:l,onClose:f,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:L,onWithdrawError:B,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function NS(){let e=qi.useContext(Vg);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
- exports.AmountScreen=Dc;exports.BottomSheet=_t;exports.KYCWizardScreen=Vc;exports.OnrampScreen=Hc;exports.StripeOnramp=Nc;exports.StripeOnrampPreconfigure=xf;exports.UnifoldProvider=HS;exports.getPreferredIcon=Ie;exports.getStripePublishableKey=_c;exports.getSupportedDestinationTokens=gc;exports.normalizeIconUrl=se;exports.registerStripeOnramp=$c;exports.setDevApiUrl=Cm;exports.setStripeOnrampApiUrl=Rc;exports.setStripeOnrampPublishableKey=xc;exports.useAllowedCountry=jl;exports.useStripeOnramp=Oc;exports.useTheme=W;exports.useUnifold=NS;
1
+ 'use strict';var ws=require('react'),reactNative=require('react-native'),or=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),im=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),kp=require('@react-native-async-storage/async-storage'),pC=require('expo-constants'),CS=require('react-native-qrcode-svg/src/genMatrix'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ws__namespace=/*#__PURE__*/_interopNamespace(ws);var or__default=/*#__PURE__*/_interopDefault(or);var im__default=/*#__PURE__*/_interopDefault(im);var kp__default=/*#__PURE__*/_interopDefault(kp);var pC__default=/*#__PURE__*/_interopDefault(pC);var CS__default=/*#__PURE__*/_interopDefault(CS);var Gf=e=>{throw TypeError(e)};var Zy=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ou=(e,t,r)=>t.has(e)||Gf("Cannot "+r);var g=(e,t,r)=>(Ou(e,t,"read from private field"),r?r.call(e):t.get(e)),re=(e,t,r)=>t.has(e)?Gf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),j=(e,t,r,o)=>(Ou(e,t,"write to private field"),t.set(e,r),r),yt=(e,t,r)=>(Ou(e,t,"access private method"),r);var wl=(e,t,r,o)=>({set _(n){j(e,t,n);},get _(){return g(e,t,o)}});var Lu={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)"}},Bu=Lu;function Lc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Cl(e,t,r){let o=r?t?.[r]:void 0,n=(m,h,b)=>{let d=o?.[m]?.[h];if(d!==void 0)return d;let p=t?.[m]?.[h];return p!==void 0?p:b},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Lc(s,i)},transferCrypto:{depositAddress:{card:Lc(s,a)}},depositCard:{quoteProvider:{card:Lc(s,l)}},depositTracker:{executionRow:{card:Lc(s,c)}}}}function Au(e,t,r){let n={...Lu[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Wu=ws.createContext(null);function B(){let e=ws.useContext(Wu);if(!e){let t=Bu.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Cl(t,void 0,"dark"),isDark:true}}return e}function wt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=B(),l=s??a.primary,c=i??a.primary,m=ws.useRef(new reactNative.Animated.Value(0)).current,h=ws.useId(),b=ws.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),d=(e-t)/2,p=2*Math.PI*d,w=e/2,R=o??Math.max(0,Math.round(e-t*2-8)),x=(e-R)/2;ws.useEffect(()=>{let v=reactNative.Animated.loop(reactNative.Animated.timing(m,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),T=requestAnimationFrame(()=>v.start());return ()=>{cancelAnimationFrame(T),v.stop();}},[m]);let k=m.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:k}]},children:jsxRuntime.jsxs(or__default.default,{width:e,height:e,children:[jsxRuntime.jsx(or.Defs,{children:jsxRuntime.jsxs(or.LinearGradient,{id:b,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(or.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(or.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(or.Circle,{cx:w,cy:w,r:d,stroke:`url(#${b})`,strokeWidth:t,fill:"none",strokeDasharray:`${p*.75} ${p*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:x+1.5,left:x,width:R,height:R,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Mu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(or.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Sl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.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 jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Br({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(or.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(or.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ar({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(or.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function dn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.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 lt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(or.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function un({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function la({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _n({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(or.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.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 pn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ac({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.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 kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function em({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(or.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(or.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function tm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(or.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function om({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(or__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(or.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(or.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(or.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function da({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=ws.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=ws.useMemo(()=>{let d=o?.[l];return Au(l,d,r)},[l,o,r]),m=ws.useMemo(()=>Cl(c,i,l),[c,i,l]),h=ws.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),b=ws.useMemo(()=>({mode:l,colors:c,fonts:h,components:m,isDark:l==="dark"}),[l,c,h,m]);return jsxRuntime.jsx(Wu.Provider,{value:b,children:e})}var Il={damping:28,stiffness:300,mass:.8},Ib=80,_b=500;function Wt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:c=false,borderTopLeftRadius:m=24,borderTopRightRadius:h=24,marginHorizontal:b,marginBottom:d,overlay:p,useModal:w=true}){let{colors:R}=B(),{height:x}=reactNative.useWindowDimensions(),k=ws.useRef(x);x>k.current&&(k.current=x);let v=reactNative.Platform.OS==="android"?k.current:x,[T,I]=ws.useState(false),f=ws.useRef(e);f.current=e;let u=ws.useRef(0),S=i!=null&&i>=1,y=S||c?0:reactNative.Platform.OS==="ios"?34:24,D=a!=null&&i!=null&&a>i,E=i!=null?(D?a:i)*v:void 0,V=D?(a-i)*v:0,P=l?0:V,M=im.useSharedValue(v),W=ws.useRef(null),G=ws.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null),f.current||I(false);},[]);ws.useEffect(()=>{e?(W.current&&(clearTimeout(W.current),W.current=null),I(true),M.value=im.withSpring(P,Il)):T&&(M.value=im.withTiming(v,{duration:250},$=>{$&&im.runOnJS(G)();}),W.current=setTimeout(()=>{W.current=null,G();},350));},[e]),ws.useEffect(()=>()=>{W.current&&clearTimeout(W.current);},[]),ws.useEffect(()=>{T&&e&&(M.value=im.withSpring(P,Il));},[P,D]);let Ne=ws.useCallback(()=>{o&&t();},[o,t]),te=ws.useMemo(()=>{if(!(!n&&!D))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{u.current=M.value;},onPanResponderMove:($,Q)=>{if(Math.abs(Q.dy)<4)return;let ue=u.current+Q.dy;M.value=Math.max(0,ue);},onPanResponderRelease:($,Q)=>{if(!(Math.abs(Q.dy)<4)){if(n&&(Q.dy>Ib||Q.vy>_b)){t();return}if(D){let ue=V/2,Z=M.value<ue?0:V;M.value=im.withSpring(Z,Il);}else M.value=im.withSpring(P,Il);}},onPanResponderTerminate:()=>{M.value=im.withSpring(P,Il);}}).panHandlers},[n,D,V,P,M,t]),$e=im.useAnimatedStyle(()=>({transform:[{translateY:M.value}]})),X=im.useAnimatedStyle(()=>({opacity:im.interpolate(M.value,[0,v*.5,v],[.5,.25,0],im.Extrapolation.CLAMP)}));if(!T)return null;let de=jsxRuntime.jsxs(reactNative.View,{style:[si.root,!w&&si.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(im__default.default.View,{style:[si.backdrop,X],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:Ne})}),jsxRuntime.jsxs(im__default.default.View,{style:[si.sheet,$e,{height:E,backgroundColor:R.background,borderTopLeftRadius:S?0:m,borderTopRightRadius:S?0:h,...b?{marginHorizontal:b,marginBottom:d??b+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:m,borderBottomRightRadius:h}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:E!=null?si.gestureRoot:si.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:si.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[si.handle,{backgroundColor:R.foreground+"33"}]})}),r,y>0&&jsxRuntime.jsx(reactNative.View,{style:{height:y}})]}),te&&jsxRuntime.jsx(reactNative.View,{...te,style:si.dragOverlay})]})]});return w?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[de,p]}):de}var am={position:"absolute",left:0,right:0,top:0,bottom:0},si=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...am,zIndex:9999},backdrop:{...am,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),Dt=ws__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Dt.displayName="BottomSheetScrollView";function ua(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Pb="https://api.unifold.io",Nu="__UnifoldDevApiBaseUrl__",Hr="pk_test_123",zc={};function Fb(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Nu];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function hr(){return Fb()??Pb}function Uc(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.'),Hr=e.publishableKey;}e.defaultConfig&&(zc=e.defaultConfig);}function cm(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[Nu]=t:delete globalThis[Nu];}function _l(){return hr()}function Nc(){return Hr}function eo(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 er(e){let t=e.startsWith("/")?e:`/${e}`;return `${hr()}/api/public${t}`}function ne(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,hr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${hr()}${e}`:`${hr()}/api/public${e}`:""}async function Eo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||zc.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||zc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||zc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Hr;eo(n);let s=await fetch(`${hr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function vo(e,t){return e.find(r=>r.chain_type===t)}async function fn(e,t,r){let o=t||Hr;eo(o);let n=await fetch(`${hr()}/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 Hc(e,t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/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 We(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 ai(e,t){let r=e||Hr;eo(r);let o=`${hr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Hu(e,t){let r=t||Hr;eo(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${hr()}/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 jc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function ju(e,t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/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 $u(e,t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function qu(e,t){let r=t||Hr;eo(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(`${hr()}/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 Pl(e){let t=e||Hr;eo(t);let r=await fetch(`${hr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function Pn(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function Fl(e){let t=e||Hr;eo(t);let r=await fetch(`${hr()}/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 Qu(){let e=await fetch(`${hr()}/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 $c(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Dl(){let e=await fetch(`${hr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function qc(e){let t=e||Hr;eo(t);let r=await fetch(`${hr()}/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 Ku(e,t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/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 Gu(e,t){return Hc(e.deposit_wallet_id,t)}async function Qc(e,t,r,o,n){let s=n||Hr;eo(s);let i=await fetch(`${hr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function Yu(e,t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Ju(e="usd",t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Zu(e,t){let r=t||Hr;eo(r);let o=await fetch(`${hr()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function Xu(e){let t=e||Hr;eo(t);let r=await fetch(`${hr()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function ep(e,t,r){let o=r||Hr;eo(o);let n=await fetch(`${hr()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}function um({size:e=28}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(or.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(or.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(or.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function pa({size:e=28}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(or.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(or.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(or.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(or.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(or.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(or.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(or.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(or.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(or.Defs,{children:jsxRuntime.jsx(or.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(or.Rect,{width:28,height:28,fill:"white"})})})]})}function hm({size:e=28}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(or.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(or.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(or.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(or.Defs,{children:jsxRuntime.jsx(or.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(or.Rect,{width:28,height:28,fill:"white"})})})]})}function ha({size:e=28}){return jsxRuntime.jsxs(or__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(or.Defs,{children:[jsxRuntime.jsxs(or.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(or.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(or.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(or.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(or.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(or.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(or.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(or.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(or.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(or.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(or.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(or.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(or.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(or.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 gm({size:e=28}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(or.G,{children:[jsxRuntime.jsx(or.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(or.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 Kc=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:um},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:pa},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:hm},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ha},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:gm}];function Gc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Yc(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ga(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Kc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Kc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function tr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=B(),i=r==="back",a=i?jsxRuntime.jsx(aa,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(Tt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wi.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:Wi.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Wi.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Wi.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Wi.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Wi.headerWithTitle:Wi.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Wi.headerSpacer}),!i&&l]})}var Jc={paddingTop:8,paddingBottom:8},Wi=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Jc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Jc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function So({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=B();return e?jsxRuntime.jsx(reactNative.Text,{style:[ym.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[ym.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var ym=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function mn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ws.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function sp({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=ws.useState(false),{colors:a,components:l}=B(),c=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},m=Gc(r);return jsxRuntime.jsxs(ws.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:m}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(lt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(dn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Zc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ya({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=B(),s=e.toLowerCase(),i=Zc[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function Xc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=B(),c=er(`/icons/currencies/png/${e.toLowerCase()}.png`),m=ga(r);return jsxRuntime.jsxs(reactNative.View,{style:[Jo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:Jo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Jo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Br,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Jo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Jo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Jo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Jo.tokenIcon,{backgroundColor:Zc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Jo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Jo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",m]})]})]})}var Jo=reactNative.StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function Vn(){let{colors:e,fonts:t,components:r}=B(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return ws.useMemo(()=>{let l=i.borderRadius,c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},m={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},b=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:b,borderTopRightRadius:b,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:b,borderBottomRightRadius:b,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},p={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:h,pm:d,wallet:p,flow:w,amount:m}},[e,t,o,n,s,i,a])}var Cm="",Sm;function ed(e){Cm=e;}function td(e){Sm=e;}function Ro(){let e=Cm||Nc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Io(){return Sm??_l()}async function rd(){let e=`${Io()}/v1/public/onramps/headless/stripe/config`,t=Ro(),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 ap(e){let t=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Ro(),"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 Tm(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Ro(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function lp(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Ro(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function km(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(`${Io()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Ro(),"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 xm(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Ro(),"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 li(e,t){let r=`${Io()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Ro(),"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 vm(e){let t=`${Io()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":Ro(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function Rm(e,t){let r=`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Ro(),"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 cp(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Ro(),"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 dp(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(`${Io()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Ro(),"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 up(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Ro(),"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 Im(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(`${Io()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Ro(),"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 Ei(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 _m(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Ro()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function ow({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(or__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(or.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(or.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(or.Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsxRuntime.jsx(or.Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsxRuntime.jsx(or.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 nw({size:e=24}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(or.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(or.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(or.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function iw({size:e=24}){return jsxRuntime.jsx(or__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(or.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(or.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(or.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(or.Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsxRuntime.jsx(or.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(or.Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsxRuntime.jsx(or.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(or.Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsxRuntime.jsx(or.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(or.Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsxRuntime.jsx(or.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(or.Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsxRuntime.jsx(or.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(or.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 fp({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(sa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(ow,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(nw,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(iw,{size:t}):jsxRuntime.jsx(sa,{size:t*.75,color:r,strokeWidth:1.75})}function od(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var hp={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function gp(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function Om({status:e,colors:t,fontFamily:r}){let o=gp(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:hp[e]??e})})}function Lm({count:e=4}){let{colors:t,components:r}=B(),o=ws.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return ws.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ba.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ba.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ba.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ba=reactNative.StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Bm({active:e,interval:t=15e3,color:r}){let o=ws.useRef(new reactNative.Animated.Value(0)).current;return ws.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Am({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=B(),[s,i]=ws.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",m=gp(e.status,r),h=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",b=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),p=e.destination_token_metadata,w=Ei(p?.icon_urls,p?.icon_url),R=ga(l?.destination_network??""),x=l?.wallet_address?Gc(l.wallet_address):null,k=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,v=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,T=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,f=>f.toUpperCase()):null,I=[{label:"Amount",value:h},{label:"Received",value:`${b} ${d}`},...T?[{label:"Payment",value:T}]:[],{label:"Network",value:R},...x?[{label:"Wallet",value:x}]:[],...k?[{label:"Network Fee",value:k}]:[],...v?[{label:"Transaction Fee",value:v}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(tr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Dt,{style:qr.scroll,contentContainerStyle:qr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:qr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ya,{currency:d||"USD",tokenIconUrl:w,size:64}),jsxRuntime.jsx(reactNative.View,{style:[qr.statusBadge,{backgroundColor:m,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx(mo,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(Tt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:qr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[qr.statusDot,{backgroundColor:m}]}),jsxRuntime.jsx(reactNative.Text,{style:[qr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:hp[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[qr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:od(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[qr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:qr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[qr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(lt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(dn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),I.map(f=>jsxRuntime.jsx(ws__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:qr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:f.label}),jsxRuntime.jsx(reactNative.Text,{style:[qr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:f.value})]})},f.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[qr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:qr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[qr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var qr=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function Em({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=B(),[i,a]=ws.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:Ln.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ln.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(em,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Ln.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Ln.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(mo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(Co,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(tm,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Ln=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var ww=[50,100,500],Cw=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function zm(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Sw(e){return e.card?`${zm(e.card.brand)} ${zm(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function ad({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:m,paymentTokens:h=[],onAddPaymentMethod:b,onConfirm:d,onCancel:p,sheetBorderTopLeftRadius:w,sheetBorderTopRightRadius:R,accessToken:x,showHistoryProgressBar:k=true,onLogout:v,onRequestKYC:T,showSwitchAccount:I=true,inputDisabled:f=false}){let u=Vn(),{colors:S,components:y,fonts:D}=B(),E=w??y.card.borderRadius,V=R??y.card.borderRadius,[P,M]=ws.useState(e),[W,G]=ws.useState(r?"apple_pay":h.length>0?h[0].id:null),Ne=ws.useRef(false),te=_=>{Ne.current=true,G(_);};ws.useEffect(()=>{Ne.current||r||h.length>0&&G(h[0].id);},[h,r]);let[$e,X]=ws.useState(false),[de,$]=ws.useState("select"),[Q,ue]=ws.useState(null),Z=ws.useRef(false);ws.useEffect(()=>{l&&c&&/saving/i.test(c)&&$("card");},[l,c]);let ke=s,qe=ke!=null&&ke>0,Ce=ws.useMemo(()=>{if(o)return [];let _=ww.map(C=>({label:`$${C}`,amount:String(C),disabled:false}));return _.push({label:"MAX",amount:qe?String(ke):"0",disabled:!qe}),_},[o,qe,ke]),se=_=>{if(_==="\u232B"){M(C=>C.slice(0,-1));return}if(_==="."){if(P.includes("."))return;M(C=>C===""?"0.":C+".");return}M(C=>{let L=C.indexOf(".");return L!==-1&&C.length-L>2?C:C==="0"&&_!=="."?_:C+_});},Ye=P===""?"0":P,He=parseFloat(P),Je=n!=null&&!isNaN(He)&&He>0&&He<n,tt=ke!=null&&ke>0&&!isNaN(He)&&He>ke,Be=P!==""&&!isNaN(He)&&He>0&&!Je&&!tt,Ue=r||h.length>0,De=i==="header",xe=ws.useMemo(()=>{let _=[];r&&_.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let C of h)_.push({id:C.id,label:Sw(C),hint:C.card?`Expires ${C.card.exp_month}/${C.card.exp_year}`:C.type,brand:C.card?.brand,isApplePay:false});return _},[r,h]),Ie=xe.find(_=>_.id===W),le=W!=null&&W!=="apple_pay",Ze=Ie?Ie.label:le&&Q?Q:le?"Card":"Pay With",pr=Ie?!Ie.isApplePay:le,Ve=Ie?.brand??Q??void 0,[Oe,Ae]=ws.useState(false),[rt,Me]=ws.useState([]),[ge,ye]=ws.useState(false),[Bt,zt]=ws.useState(null),[Rt,ht]=ws.useState(null),sr=ws.useRef(null);sr.current=Rt;let ze=ws.useRef(false);ze.current=Oe;let gt=ws.useCallback(async(_=false)=>{if(x){_||(ye(true),zt(null));try{let C=await vm(x);if(!ze.current)return;let L=Array.isArray(C.data)?C.data:Array.isArray(C)?C:[];Me(L),_||zt(null);let O=sr.current?.id;if(O){let H=L.find(U=>U.id===O);H&&ht(H);}}catch(C){if(!ze.current)return;_||zt(C?.message??"Failed to load history");}finally{!_&&ze.current&&ye(false);}}},[x]),Ke=ws.useCallback(()=>{Ae(true),gt();},[gt]);ws.useEffect(()=>{if(!Oe||!x)return;let _=setInterval(()=>gt(true),15e3);return ()=>clearInterval(_)},[Oe,x,gt]);let _e=ws.useCallback(_=>{switch(_){case "history":Ke();break;case "kyc":T?.();break;case "logout":v?.();break}},[Ke,T,v]),Y=!!x||!!T||!!v?jsxRuntime.jsx(Em,{onSelect:_e,showKycOption:!!T,showSwitchAccount:I&&!!v}):void 0,Pe=Ue?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[De?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||($("select"),X(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[Ie?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):pr?jsxRuntime.jsx(fp,{sublabel:Ve,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:Ze}),jsxRuntime.jsx(ar,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:u.form.screen,children:[jsxRuntime.jsx(tr,{onPress:p,title:"Enter amount",leftAction:Y}),De&&Pe,jsxRuntime.jsxs(reactNative.View,{style:u.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.amountText,Ye==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ye]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),Je&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),tt&&ke!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Maximum amount is $",ke.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!De&&Pe,Ce.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Ce.map(_=>{let C=!_.disabled&&P===_.amount&&P!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,C&&{backgroundColor:S.primary},_.disabled&&{opacity:.4}],activeOpacity:.7,disabled:_.disabled||l,onPress:()=>M(_.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,C&&{color:S.primaryForeground}],children:_.label})},_.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:Cw.map((_,C)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:_.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||f)&&{opacity:.3}],onPress:()=>se(L),activeOpacity:.6,disabled:l||f,children:jsxRuntime.jsx(reactNative.Text,{style:L==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:L})},L))},C))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!Be||l||f)&&u.form.continueBtnDisabled],onPress:()=>Be&&!l&&!f&&d(P,W),disabled:!Be||l||f,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!Be||f)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!$e&&m?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:m}):!$e&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(Wt,{visible:$e,onClose:()=>{l||(X(false),$("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:E,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:de==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>X(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx(Tt,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Dt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[xe.map(_=>{let C=W===_.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,C&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{te(_.id),ue(_.isApplePay?null:_.label),X(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetOptionIcon,children:_.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(fp,{sublabel:_.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:_.label}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:_.hint})]})]}),C&&jsxRuntime.jsx(lt,{size:18,color:S.primary,strokeWidth:2.5})]},_.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Z.current){Z.current=true;try{let _=await b?.();_&&(te(_.token),ue(_.sublabel),X(!1));}finally{Z.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||$("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(aa,{size:20,color:S.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:m})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&Be&&a(false,P);},children:jsxRuntime.jsx(reactNative.Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(Wt,{visible:Oe,onClose:()=>{Ae(false),ht(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:E,borderTopRightRadius:V,children:Rt?jsxRuntime.jsx(Am,{session:Rt,onBack:()=>ht(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(tr,{onPress:()=>Ae(false),title:"Purchase History"}),k&&jsxRuntime.jsx(Bm,{active:Oe&&!ge&&rt.length>0,color:S.primary}),ge?jsxRuntime.jsx(Lm,{}):Bt?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:Bt})}):rt.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:S.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Dt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:rt.map(_=>{let C=_.transaction_details,L=C?.source_amount?`$${parseFloat(C.source_amount).toFixed(2)}`:"\u2014",O=(C?.destination_currency??"").toUpperCase(),H=C?.destination_amount?`${parseFloat(C.destination_amount).toFixed(2)} ${O}`:"",U=od(_.created),ve=_.destination_token_metadata,me=Ei(ve?.icon_urls,ve?.icon_url),z=Ei(ve?.chain?.icon_urls,ve?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>ht(_),children:[jsxRuntime.jsx(ya,{currency:O||"USD",tokenIconUrl:me,networkIconUrl:z,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:L}),H?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:H}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(Om,{status:_.status,colors:S,fontFamily:D.regular}),U?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:S.foregroundMuted,fontFamily:D.regular},children:U}):null]}),jsxRuntime.jsx(Br,{size:14,color:S.foregroundMuted,strokeWidth:2})]})]},_.id)})})]})})]})}function ld({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Vn(),{colors:i,fonts:a,components:l}=B(),c=l.input.placeholderColor,m=r==="L0"?["name","address"]:["name","dob","address","ssn"],h=m.length,[b,d]=ws.useState(1),[p,w]=ws.useState(e.firstName??""),[R,x]=ws.useState(e.lastName??""),[k,v]=ws.useState(e.dobMonth??""),[T,I]=ws.useState(e.dobDay??""),[f,u]=ws.useState(e.dobYear??""),[S,y]=ws.useState(e.addressLine1??""),[D,E]=ws.useState(e.addressLine2??""),[V,P]=ws.useState(e.city??""),[M,W]=ws.useState(e.state??""),[G,Ne]=ws.useState(e.postalCode??""),[te,$e]=ws.useState(e.country??"US"),[X,de]=ws.useState(e.idNumber??""),$=ws.useRef(null),Q=ws.useRef(null),ue=ws.useRef(null),Z=ws.useRef(null),ke=ws.useRef(null),qe=ws.useRef(null),Ce=ws.useRef(null),se=ws.useRef(null),Ye=m[b-1],He=()=>{switch(Ye){case "name":return p.trim().length>0&&R.trim().length>0;case "dob":return k.length===2&&T.length===2&&f.length===4;case "address":return S.trim().length>0&&V.trim().length>0&&M.trim().length>0&&G.trim().length>0;case "ssn":return X.trim().length>0;default:return false}},Je=()=>{He()&&(b<h?d(xe=>xe+1):o({firstName:p,lastName:R,idNumber:X,dobMonth:k,dobDay:T,dobYear:f,addressLine1:S,addressLine2:D,city:V,state:M,postalCode:G,country:te}));},tt=()=>{b>1?d(xe=>xe-1):n();},Be={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:Ue}=Be[Ye],De=[_r.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:_r.header,children:[jsxRuntime.jsx(reactNative.View,{style:_r.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:_r.iconButton,onPress:tt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:b>1?"Back":"Cancel",children:jsxRuntime.jsx(Sl,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:_r.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:De,children:[b," of ",h]})}),jsxRuntime.jsx(reactNative.View,{style:_r.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:_r.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(Tt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:_r.progressTrack,children:Array.from({length:h}).map((xe,Ie)=>jsxRuntime.jsx(reactNative.View,{style:[_r.progressSegment,{backgroundColor:Ie<b||Ie+1===b?i.primary:i.border}]},Ie))}),jsxRuntime.jsx(Dt,{style:s.form.flex,contentContainerStyle:_r.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:Ue}),Ye==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(di,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:c,value:p,onChangeText:w,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>$.current?.focus()})}),jsxRuntime.jsx(di,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:$,style:s.form.input,placeholder:"Doe",placeholderTextColor:c,value:R,onChangeText:x,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Je})})]}),Ye==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:_r.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:_r.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,_r.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,_r.dobInput],placeholder:"MM",placeholderTextColor:c,value:k,onChangeText:xe=>{let Ie=xe.replace(/\D/g,"").slice(0,2);v(Ie),Ie.length===2&&Q.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:_r.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,_r.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Q,style:[s.form.input,_r.dobInput],placeholder:"DD",placeholderTextColor:c,value:T,onChangeText:xe=>{let Ie=xe.replace(/\D/g,"").slice(0,2);I(Ie),Ie.length===2&&ue.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:_r.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,_r.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ue,style:[s.form.input,_r.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:f,onChangeText:xe=>{let Ie=xe.replace(/\D/g,"").slice(0,4);u(Ie);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Je})]})]}),Ye==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(di,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:S,onChangeText:y,returnKeyType:"next",onSubmitEditing:()=>Z.current?.focus()})}),jsxRuntime.jsx(di,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Z,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:D,onChangeText:E,returnKeyType:"next",onSubmitEditing:()=>ke.current?.focus()})}),jsxRuntime.jsx(di,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ke,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:V,onChangeText:P,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>qe.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:_r.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(di,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:qe,style:s.form.input,placeholder:"CA",placeholderTextColor:c,value:M,onChangeText:xe=>W(xe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ce.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(di,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ce,style:s.form.input,placeholder:"94001",placeholderTextColor:c,value:G,onChangeText:Ne,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>se.current?.focus()})})})]}),jsxRuntime.jsx(di,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:se,style:s.form.input,placeholder:"US",placeholderTextColor:c,value:te,onChangeText:xe=>$e(xe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Je})})]}),Ye==="ssn"&&jsxRuntime.jsxs(di,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:X,onChangeText:de,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Je}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,_r.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&b>=h?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!He()&&s.form.continueBtnDisabled],onPress:Je,disabled:!He(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!He()&&s.form.continueBtnTextDisabled],children:b>=h?"Submit":"Continue"})})})]})})}function di({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var _r=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var xp="@unifold/stripe_oauth";async function Nm(){try{let e=await kp__default.default.getItem(xp);return e?JSON.parse(e):null}catch{return null}}async function vp(e){try{await kp__default.default.setItem(xp,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Sa(){try{await kp__default.default.removeItem(xp);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Pw=5,$i=null,Rp=false,Ip={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function cd(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:m,collectPaymentMethod:h,createCryptoPaymentToken:b}=stripeReactNative.useOnramp(),[d,p]=ws.useState(r),[w,R]=ws.useState(!!e?.externalUserId),[x,k]=ws.useState(false),[v,T]=ws.useState(false),[I,f]=ws.useState(""),[u,S]=ws.useState(null),[y,D]=ws.useState(e?.email??""),[E,V]=ws.useState(e?.phone??""),[P,M]=ws.useState(""),[W,G]=ws.useState("US"),[Ne,te]=ws.useState(""),[$e,X]=ws.useState(""),de=ws.useRef(""),$=ws.useRef(""),Q=ws.useRef(""),[ue,Z]=ws.useState(false),[ke,qe]=ws.useState(false),Ce=ws.useRef(0),se=ws.useRef(false),Ye=ws.useRef(false),He=ws.useRef(false),Je=ws.useRef(false),tt=ws.useRef(e?.email??""),Be=ws.useRef(false),Ue=ws.useRef(null),De=ws.useRef(""),xe=ws.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Ie=ws.useRef(null),[st,le]=ws.useState(0),[Ze,pr]=ws.useState(Ip),[Ve,Oe]=ws.useState(e?.defaultWalletAddress??""),[Ae,rt]=ws.useState(""),[Me,ge]=ws.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[ye,Bt]=ws.useState(e?.defaultSourceAmount??"100"),[zt,Rt]=ws.useState(e?.defaultSourceCurrency??"usd"),[ht,sr]=ws.useState(e?.defaultDestinationCurrency??"usdc"),[ze,gt]=ws.useState(null),[Ke,_e]=ws.useState(),[ot,Y]=ws.useState(),[Pe,_]=ws.useState(false),C=ws.useRef(null),L=ws.useRef(false),O=ws.useRef(0),H=ws.useRef(e?.onComplete),U=ws.useRef(e?.onError),ve=ws.useRef(e?.onStepChange),me=ws.useRef(r);ws.useEffect(()=>{H.current=e?.onComplete;},[e?.onComplete]),ws.useEffect(()=>{U.current=e?.onError;},[e?.onError]),ws.useEffect(()=>{ve.current=e?.onStepChange;},[e?.onStepChange]);let z=ws.useRef(r);ws.useEffect(()=>{d!==z.current&&(ve.current?.(d,z.current),z.current=d),me.current=d;},[d]),ws.useEffect(()=>{v&&d!=="email"&&T(false);},[v,d]),ws.useEffect(()=>{w&&d!==r&&R(false);},[w,d,r]);let A=ws.useCallback((F,N,pe)=>{let Le={code:F,message:N,step:me.current,stripeErrorCode:pe};S(Le),f(""),U.current?.(Le);},[]),jt=ws.useCallback(F=>{let N={sessionId:F.id,status:F.status,sourceAmount:F.transaction_details.source_amount,sourceCurrency:F.transaction_details.source_currency,destinationAmount:F.transaction_details.destination_amount,destinationCurrency:F.transaction_details.destination_currency,destinationNetwork:F.transaction_details.destination_network,walletAddress:F.transaction_details.wallet_address,fees:{networkFee:F.transaction_details.fees.network_fee_amount,transactionFee:F.transaction_details.fees.transaction_fee_amount}};return H.current?.(N),N},[]),nt=ws.useCallback(()=>S(null),[]),Te=F=>F.refresh_token??F.refresh?.refresh_token??"",It=ws.useCallback((F,N,pe,Le,Fe)=>{$.current=N,de.current=pe,e?.externalUserId&&vp({accessToken:N,refreshToken:pe,customerId:F,externalUserId:e.externalUserId,email:Fe||y,expiresAt:Date.now()+Le*1e3});},[e?.externalUserId,y]),it=ws.useCallback(async()=>{let F=de.current;if(!F)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let N=await lp(F,Q.current??void 0),pe=N.access_token,Le=Te(N)||F;return X(pe),It(Q.current,pe,Le,N.expires_in??3600),pe}catch(N){return console.error("[tryRefreshAccessToken] refresh failed:",N?.message),await Sa(),$i=null,Ie.current=null,$.current="",de.current="",Q.current="",X(""),te(""),null}},[It]),Xe=ws.useCallback(async F=>{try{return await F($.current)}catch(N){let pe=N?.message??"";if(pe.includes("stripe_onramp_forbidden")||pe.includes("403")){let Le=await it();if(!Le)throw A("authorization_error","Session expired. Please sign in again."),p("email"),N;return await F(Le)}throw N}},[it,A]);ws.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){_(false);return}let N=false;return stripeReactNative.isPlatformPaySupported().then(pe=>{N||_(pe);}),()=>{N=true;}},[e?.merchantIdentifier]),ws.useEffect(()=>(L.current=false,()=>{L.current=true,C.current&&clearTimeout(C.current);}),[]);let Zr=ws.useRef(false);ws.useEffect(()=>{if(Zr.current)return;if(!e?.externalUserId){Sa(),$i=null,Ie.current=null,R(false);return}let F=false;return (async()=>{try{let N=await Nm();if(F||!N){F||R(!1);return}if(N.externalUserId!==e.externalUserId){await Sa(),$i=null,Ie.current=null,F||R(!1);return}let pe=Date.now()>=N.expiresAt,Le=N.accessToken,Fe=N.refreshToken;if(pe)try{let bt=await lp(N.refreshToken,N.customerId);if(F)return;Le=bt.access_token,Fe=bt.refresh_token??bt.refresh?.refresh_token??N.refreshToken,await vp({accessToken:Le,refreshToken:Fe,customerId:N.customerId,externalUserId:e.externalUserId,email:N.email,expiresAt:Date.now()+(bt.expires_in??3600)*1e3});}catch(bt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",bt?.message),await Sa(),$i=null,Ie.current=null,F||R(!1);return}if(F)return;if(Zr.current=!0,te(N.customerId),Q.current=N.customerId,X(Le),$.current=Le,de.current=Fe,N.email&&(D(N.email),tt.current=N.email),$i===N.customerId)Ie.current=Promise.resolve({error:void 0});else {let bt=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:N.customerId});bt.error?console.error("[useStripeOnramp] restore configureSDK error:",bt.error.message):$i=N.customerId,Ie.current=Promise.resolve(bt);}if(F)return;let ut=()=>new Promise(bt=>{let fr=()=>{Be.current&&De.current?bt():setTimeout(fr,200);};fr();});try{if(await Promise.race([ut(),new Promise((fr,_t)=>setTimeout(()=>_t(new Error("timeout")),1e4))]),F)return;let bt=De.current.toLowerCase();await m(bt,xe.current);}catch(bt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",bt?.message);}if(F)return;try{let fr=(await li(Q.current,$.current)).kyc_tiers??[],_t=fr.find(Ao=>Ao.tier==="l0"),Nr=fr.find(Ao=>Ao.tier==="l1"),ao=fr.find(Ao=>Ao.tier==="l2"),Xr=_t?.verification_status==="verified",cn=Nr?.verification_status==="verified",mr=ao?.verification_status==="verified",ni=!!_t?.verification_status&&_t.verification_status!=="not_started";p(Xr||cn||mr?"session_params":ni?"kyc_offer":"kyc");}catch{p("kyc");}}finally{F||R(false);}})(),()=>{F=true;}},[]),ws.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ue)return;let F=false;qe(true);async function N(){try{let[pe,Le]=await Promise.all([Im({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?_m({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(mr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",mr?.message),null)):Promise.resolve(null)]);if(F)return;let Fe=e?.destinationChainType??"ethereum",ut=pe.data.find(mr=>mr.chain_type===Fe);if(ut?.address){let mr=ut.address.toLowerCase();Oe(mr),De.current=mr,ut.recipient_address&&rt(ut.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",Fe,"in",pe.data?.length,"wallets");let bt={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},fr={8453:"base",1:"ethereum",137:"polygon"},_t=Le?.destination_network,Nr="none";if(_t&&bt[_t])ge(bt[_t]),xe.current=bt[_t],Nr=_t+" (from default_token API)";else if(e?.destinationChainId&&fr[e.destinationChainId]){let mr=fr[e.destinationChainId];bt[mr]&&(ge(bt[mr]),xe.current=bt[mr]),Nr=mr+" (from chain_id "+e.destinationChainId+")";}else bt[Fe]&&(ge(bt[Fe]),xe.current=bt[Fe],Nr=Fe+" (from chain_type fallback)");Le?.destination_currency&&sr(Le.destination_currency.toLowerCase());let ao=Le?.destination_token_metadata,Xr=Ei(ao?.icon_urls,ao?.icon_url),cn=Ei(ao?.chain?.icon_urls,ao?.chain?.icon_url);Xr&&_e(Xr),cn&&Y(cn),Z(!0),Be.current=!0;}catch(pe){if(F)return;console.error("[resolveWallet] Failed to resolve wallet:",pe?.message),Z(true),Be.current=true;}finally{F||qe(false);}}return Ue.current=N(),()=>{F=true;}},[e?.publishableKey,e?.externalUserId,st]);let At=ws.useCallback(async()=>{if(Ie.current)return Ie.current;let F=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(N=>(N.error&&(console.error("[useStripeOnramp] configureSDK error:",N.error.message,N.error.code),Ie.current=null),N)).catch(N=>{throw console.error("[useStripeOnramp] configureSDK threw:",N?.message??N),Ie.current=null,N});return Ie.current=F,F},[o,e?.merchantDisplayName]);ws.useEffect(()=>{e?.externalUserId||At();},[]);let Ur=ws.useCallback(async F=>{if(!se.current){se.current=true,k(true),nt(),f("Creating auth intent...");try{let N=await ap(F);f("Waiting for authorization...");let pe=await i(N);if(pe?.error){A("authorization_error","Something went wrong during authorization. Please try again."),p("email");return}if(pe?.status==="Denied"){A("authorization_error","Authorization denied by user."),p("email");return}if(pe?.status!=="Consented"||!pe.customerId){A("authorization_error","Authorization was canceled."),p("email");return}f("Exchanging tokens...");let Le=pe.customerId,Fe=await Tm(N,Le),ut=Fe.access_token,bt=Te(Fe);D(F),tt.current=F,te(Le),Q.current=Le,$i=Le,X(ut),It(Le,ut,bt,Fe.expires_in??3600,F),f("Checking verification status...");try{let _t=(await li(Le,ut)).kyc_tiers??[],Nr=_t.find(wo=>wo.tier==="l0"),ao=_t.find(wo=>wo.tier==="l1"),Xr=_t.find(wo=>wo.tier==="l2"),cn=Nr?.verification_status==="verified",mr=ao?.verification_status==="verified",ni=Xr?.verification_status==="verified",Ao=!!Nr?.verification_status&&Nr.verification_status!=="not_started";if(f(""),cn||mr||ni){Ue.current&&(f("Resolving wallet..."),await Ue.current,f(""));let wo=De.current;if(wo)try{let Li=wo.toLowerCase(),Oc=xe.current,ii=await m(Li,Oc);ii?.error?(console.warn("[proceedToAuthorize] wallet registration error:",ii.error.message),A("wallet_error",ii.error.message,ii.error.code),p("wallet")):p("session_params");}catch(Li){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Li?.message),p("wallet");}else p("wallet");}else Ao?(await oi(),f(""),p("kyc_offer")):p("kyc");}catch(fr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",fr?.message),f(""),p("kyc");}}catch(N){A("authorization_error",N?.message??String(N)),p("email");}finally{se.current=false,k(false);}}},[i,nt,A,It,m,Me]),Cr=ws.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!y){A("validation_error","Please enter an email address.");return}k(true),nt(),f("");try{f("Configuring...");let F=await At();if(F.error){A("configuration_error",F.error.message,F.error.code);return}f("Checking Link account...");let N=await n(y);if(N.error){A("authorization_error",N.error.message,N.error.code);return}N.hasLinkAccount?await Ur(y):(f(""),p("disclaimer"));}catch(F){A("unknown_error",F?.message??String(F));}finally{k(false);}},[nt,At,y,A,n,Ur]),oa=ws.useCallback(async()=>{if(!He.current){if(!E){A("validation_error","Please enter your phone number.");return}He.current=true,k(true),nt(),f("");try{f("Creating Link account...");let F=await s({email:y,phone:E,fullName:P||y,country:W||"US"});if(F.error){A("registration_error",F.error.message,F.error.code);return}await Ur(y);}catch(F){A("registration_error",F?.message??String(F));}finally{He.current=false,k(false);}}},[nt,W,y,A,P,E,s,Ur]);ws.useEffect(()=>{if(d!=="email")return;let F=Je.current||Rp;if(F&&(Je.current=false,Rp=false),!e?.email||w)return;if(F){T(true);return}let N=++Ce.current,pe=false,Le=()=>pe||Ce.current!==N;return e?.phone?(async()=>{k(true),nt();try{f("Configuring...");let Fe=await At();if(Le())return;if(Fe.error){A("configuration_error",Fe.error.message,Fe.error.code);return}f("Checking Link account...");let ut=await n(e.email);if(Le())return;if(ut.error){A("authorization_error",ut.error.message,ut.error.code);return}if(ut.hasLinkAccount){if(Le())return;await Ur(e.email);}else {if(Le())return;f(""),p("disclaimer");}}catch(Fe){Le()||A("unknown_error",Fe?.message??String(Fe));}finally{k(false);}})():(async()=>{k(true),nt();try{f("Configuring...");let Fe=await At();if(Le())return;if(Fe.error){A("configuration_error",Fe.error.message,Fe.error.code);return}f("Checking Link account...");let ut=await n(e.email);if(Le())return;if(ut.error){A("authorization_error",ut.error.message,ut.error.code);return}if(ut.hasLinkAccount){if(Le())return;await Ur(e.email);}else {if(Le())return;f(""),p("disclaimer");}}catch(Fe){Le()||A("unknown_error",Fe?.message??String(Fe));}finally{k(false);}})(),()=>{pe=true;}},[d,e?.email,e?.phone,w]);let oi=ws.useCallback(async()=>{Ue.current&&(f("Resolving wallet..."),await Ue.current);let F=De.current;if(F)try{f("Registering wallet...");let N=F.toLowerCase(),pe=xe.current;await m(N,pe);}catch(N){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",N?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[m]),Pc=ws.useCallback(async(F,N)=>{k(true),nt(),f(""),pr(ut=>({...ut,...F}));let pe=!N,Le=N??"kyc_offer",Fe=N?"kyc_l1":"kyc";try{let ut=F.dobDay&&F.dobMonth&&F.dobYear,bt=F.firstName&&F.lastName,fr={};bt&&(fr.firstName=F.firstName,fr.lastName=F.lastName),F.addressLine1&&(fr.address={line1:F.addressLine1,line2:F.addressLine2||void 0,city:F.city,state:F.state,postalCode:F.postalCode,country:F.country}),F.idNumber&&(fr.idNumber=F.idNumber),ut&&(fr.dateOfBirth={day:parseInt(F.dobDay,10),month:parseInt(F.dobMonth,10),year:parseInt(F.dobYear,10)});let _t=await a(fr);if(_t?.error?.message&&(/no active link consumer/i.test(_t.error.message)||/not be verified/i.test(_t.error.message))){if(f("Verifying identity..."),!await Ts()){A("kyc_error","Please verify your identity to continue."),p(Fe);return}_t=await a(fr);}if(_t?.error){let mr=pe?"l0":"l1";try{let Ao=(await li(Q.current,$.current)).kyc_tiers?.find(wo=>wo.tier===mr);if(Ao?.verification_status==="verified"){let wo=pe?"session_params":Le;await oi(),f(""),p(wo);return}if(Ao?.verification_status==="rejected"){if(pe){await oi(),f(""),p(Le);return}A("kyc_error","Something went wrong. Please try again."),p(Fe);return}}catch(ni){console.warn("[attachKyc] could not fetch verification status:",ni?.message);}if(pe){await oi(),f(""),p(Le);return}A("kyc_error",_t.error.message,_t.error.stripeErrorCode??_t.error.code),p(Fe);return}if(!(_t&&Object.keys(_t).length>0&&!_t.error)){let mr=pe?"l0":"l1";if(f("Verifying identity..."),(!Q.current||!$.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${mr} \u2014 missing customerIdRef or accessTokenRef`),!pe)){A("kyc_error","Unable to verify identity. Please try again."),p(Fe);return}let ni=Q.current,Ao=$.current,wo=10,Li=!1;if(ni&&Ao)for(let Oc=0;Oc<wo;Oc++){try{let Vu=(await li(ni,Ao)).kyc_tiers?.find(Jy=>Jy.tier===mr);if(Vu?.verification_status==="verified"){Li=!0;break}if(Vu?.verification_status==="rejected"){if(pe)break;console.warn(`[attachKyc] \u274C ${mr} rejected:`,Vu?.verification_errors),A("kyc_error","KYC verification was rejected. Please try again."),p(Fe);return}}catch(ii){console.warn(`[attachKyc] ${mr} poll error:`,ii?.message);}await new Promise(ii=>setTimeout(ii,2e3));}if(!Li&&!pe){console.warn(`[attachKyc] \u274C ${mr} verification timed out after`,wo,"attempts"),A("kyc_error","Identity verification is taking longer than expected. Please try again."),p(Fe);return}await oi(),f(""),p(pe&&Li?"session_params":Le);return}f("Please review your KYC information...");let Xr=await l(null);if(Xr?.error){A("kyc_error",Xr.error.message,Xr.error.stripeErrorCode??Xr.error.code),p(Fe);return}if(Xr?.status==="UpdateAddress"){A("kyc_error","Please update your address and resubmit."),p(Fe);return}await oi(),f(""),p(pe?"session_params":Le);}catch(ut){A("kyc_error",ut?.message??String(ut)),p(Fe);}finally{k(false);}},[a,nt,A,l,oi]),Ts=ws.useCallback(async()=>{let F=tt.current||e?.email;if(!F)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(tt.current),"config.email:",e?.email),false;try{let N=await ap(F),pe=await i(N);return pe?.status==="Consented"&&pe.customerId?(Q.current=pe.customerId,te(pe.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",pe?.status),!1)}catch(N){return console.warn("[reestablishLinkSession] failed:",N?.message),false}},[i,e?.email]),Fc=ws.useCallback(async()=>{if(!Ye.current){Ye.current=true,k(true),nt(),f("Launching identity verification...");try{let F=await c();if(F?.error?.message&&(/no active link consumer/i.test(F.error.message)||/not be verified/i.test(F.error.message))){if(f("Verifying identity..."),!await Ts()){A("identity_error","Please verify your identity to continue.");return}F=await c();}if(F?.error){let pe=F.error.message??"";if(/cancel/i.test(pe)){f("");return}A("identity_error",pe,F.error.code);return}f(""),ks.current?(ks.current=!1,p("session_params")):p("wallet");}catch(F){A("identity_error",F?.message??String(F));}finally{Ye.current=false,k(false);}}},[nt,A,Ts,c]),ks=ws.useRef(false);ws.useEffect(()=>{d==="identity"&&!x&&Fc();},[d]);let Dc=ws.useCallback(async()=>{if(!Ve){A("validation_error","Please enter a wallet address.");return}k(true),nt(),f("");try{let F=Ve.toLowerCase(),N=await m(F,Me);if(N?.error){console.warn("[registerWallet] error:",N.error.message),A("wallet_error",N.error.message,N.error.code);return}f(""),p("kyc_offer");}catch(F){console.error("[registerWallet] exception:",F?.message??String(F)),A("wallet_error",F?.message??String(F));}finally{k(false);}},[nt,A,Ve,Me,m]);ws.useEffect(()=>{d==="wallet"&&ue&&Ve&&Dc();},[d,ue,Ve]);let na=ws.useCallback(F=>{L.current=false,O.current=0;let N=0,pe=async()=>{N+=1;let Le=$.current;try{let Fe=await Rm(F,Le);if(L.current)return;O.current=0,Fe.status==="fulfillment_complete"?(gt(Fe),p("success")):C.current=setTimeout(pe,3e3);}catch(Fe){if(L.current)return;let ut=Fe?.message??"";if((ut.includes("stripe_onramp_forbidden")||ut.includes("403"))&&await it()&&!L.current){C.current=setTimeout(pe,1e3);return}if(O.current+=1,console.error(`[pollSessionStatus] poll #${N} error:`,ut),O.current>=Pw){A("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}C.current=setTimeout(pe,5e3);}};C.current=setTimeout(pe,3e3);},[A,it]),Fu=ws.useCallback(()=>{if(me.current==="processing"&&ze?.id){if(!$.current){A("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}nt(),O.current=0,C.current&&(clearTimeout(C.current),C.current=null),na(ze.id);}},[nt,A,na,ze?.id]),Vi=ws.useCallback(async F=>{k(true),nt(),f("");try{f("Confirming purchase...");let N=await Xe(pe=>xm(F,pe));gt(N),p("processing"),f(""),na(N.id);}finally{k(false);}},[nt,na,Xe]),bl=ws.useRef(false),Du=ws.useCallback(async()=>{if(!(!ze||bl.current)){bl.current=true;try{k(!0),nt(),f("Refreshing quote...");let F=await Xe(N=>cp(ze.id,N));gt(F),await Vi(F.id);}catch{A("session_error","Something went wrong. Please try again."),p("quote");}finally{k(false),bl.current=false;}}},[nt,A,Vi,ze,Xe]),he=ws.useCallback(async(F=false,N,pe)=>{let Le=N??ye;if(!Le||isNaN(Number(Le))||Number(Le)<=0){A("validation_error","Please enter a valid amount.");return}N&&Bt(N),k(true),nt(),f("");try{let Fe=await At();if(Fe.error){A("configuration_error",Fe.error.message,Fe.error.code);return}let ut;if(pe)ut=pe;else if(F){if(!e?.merchantIdentifier?.trim()){A("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),p("session_params");return}f("Opening Apple Pay...");let _t={applePay:{merchantCountryCode:"US",currencyCode:zt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ht.toUpperCase()} purchase + fees`,amount:Le}]}},Nr=await h("PlatformPay",_t);if(Nr?.error){let Xr=Nr.error.message??"",cn=Nr.error.code??"";/cancel/i.test(Xr)||/cancel/i.test(cn)||(A("payment_error",Xr,cn),p("session_params"));return}if(!Nr?.displayData)return;f("Creating payment token...");let ao=await b();if(ao?.error){A("payment_error",ao.error.message,ao.error.code),p("session_params");return}ut=ao.cryptoPaymentToken;}else {f("Select a payment method...");let _t=await h("Card");if(_t?.error){let ao=_t.error.message??"",Xr=_t.error.code??"";/cancel/i.test(ao)||/cancel/i.test(Xr)||(A("payment_error",ao,Xr),p("session_params"));return}if(!_t?.displayData)return;f("Creating payment token...");let Nr=await b();if(Nr?.error){A("payment_error",Nr.error.message,Nr.error.code),p("session_params");return}ut=Nr.cryptoPaymentToken;}f("Creating onramp session...");let bt=De.current||Ve;if(!bt){A("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let fr=await Xe(_t=>km({cryptoCustomerId:Q.current,paymentToken:ut,sourceAmount:Number(Le),sourceCurrency:zt,destinationCurrency:ht,walletAddress:bt,destinationNetwork:Me},_t));gt(fr),f(""),F?await Vi(fr.id):p("quote");}catch{A("session_error","Something went wrong. Please try again."),p("session_params");}finally{k(false),f("");}},[nt,At,h,b,ht,A,Vi,Bt,ye,zt,Ve,Me,Xe,e?.merchantIdentifier]),Qe=ws.useCallback(async()=>{k(true),nt(),f("Select a payment method...");try{let F=await At();if(F.error)return A("configuration_error",F.error.message,F.error.code),null;let N=await h("Card");if(N?.error?.message&&(/no active link consumer/i.test(N.error.message)||/not be verified/i.test(N.error.message))){if(!await Ts())return A("authorization_error","Please verify your identity to add a payment method."),null;N=await h("Card");}if(N?.error){let ut=N.error.message??"",bt=N.error.code??"";return /cancel/i.test(ut)||/cancel/i.test(bt)||A("payment_error",ut,bt),null}if(!N?.displayData)return null;let Le=N.displayData;f("Saving payment method...");let Fe=await b();return Fe?.error?(A("payment_error",Fe.error.message,Fe.error.code),null):{token:Fe.cryptoPaymentToken,sublabel:Le.sublabel??""}}catch(F){return A("session_error",F?.message??String(F)),null}finally{k(false),f("");}},[nt,At,h,b,A,Ts]),Tr=ws.useCallback(async()=>{if(ze){k(true),nt(),f("");try{let F=await Xe(N=>cp(ze.id,N));gt(F);}catch{A("session_error","Something went wrong. Please try again.");}finally{k(false);}}},[nt,A,ze,Xe]),In=ws.useCallback(()=>{L.current=true,O.current=0,C.current&&(clearTimeout(C.current),C.current=null),p(r),k(false),T(false),f(""),S(null),D(e?.email??""),tt.current=e?.email??"",V(e?.phone??""),M(""),G("US"),te(""),Q.current="",X(""),$.current="",de.current="",Z(false),qe(false),Ue.current=null,le(F=>F+1),pr(Ip),Oe(""),De.current="",Be.current=false,ge(stripeReactNative.Onramp.CryptoNetwork.ethereum),Bt(e?.defaultSourceAmount??"100"),Rt(e?.defaultSourceCurrency??"usd"),sr(e?.defaultDestinationCurrency??"usdc"),rt(""),_e(void 0),Y(void 0),gt(null),Ce.current+=1,se.current=false,Ye.current=false,He.current=false;},[e,r]),Vc=ws.useCallback(()=>{ks.current=true,p("kyc_offer");},[]),Oi=ws.useCallback(async()=>{await Sa(),$i=null,Ie.current=null,Rp=true,Je.current=true,L.current=true,O.current=0,C.current&&(clearTimeout(C.current),C.current=null),Ce.current+=1,se.current=false,Ye.current=false,He.current=false,$.current="",de.current="",Q.current="",De.current="",Be.current=false,Ue.current=null,X(""),te(""),D(e?.email??""),tt.current=e?.email??"",V(e?.phone??""),M(""),G("US"),gt(null),S(null),k(false),T(false),f(""),pr(Ip),Oe(""),Z(false),qe(false),le(F=>F+1),rt(""),_e(void 0),Y(void 0),p(r);},[e?.email,e?.phone,r]);return {step:d,restoring:w,loading:x,status:I,error:u,email:y,phone:E,fullName:P,country:W,customerId:Ne,accessToken:$e,session:ze,kycData:Ze,walletAddress:Ve,resolvedRecipientAddress:Ae,walletNetwork:Me,sourceAmount:ye,sourceCurrency:zt,destinationCurrency:ht,tokenIconUrl:Ke,networkIconUrl:ot,applePaySupported:Pe,walletReady:ue,walletLoading:ke,setStep:p,setStatus:f,setEmail:D,setPhone:V,setFullName:M,setCountry:G,setWalletAddress:Oe,setWalletNetwork:ge,setSourceAmount:Bt,setSourceCurrency:Rt,setDestinationCurrency:sr,checkEmail:Cr,register:oa,attachKyc:Pc,verifyIdentity:Fc,requestKYCUpgrade:Vc,kycUpgradeMode:ks,logout:Oi,registerWallet:Dc,collectPaymentMethod:he,addPaymentMethod:Qe,refreshQuote:Tr,confirmCheckout:Du,reset:In,clearError:nt,emitComplete:jt,resumeFulfillmentPolling:Fu,amountFirst:t,switchingAccount:v}}function Hm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Vn(),{colors:a,fonts:l,components:c}=B(),m=c.input.placeholderColor,[h,b]=ws.useState(e.dobMonth??""),[d,p]=ws.useState(e.dobDay??""),[w,R]=ws.useState(e.dobYear??""),[x,k]=ws.useState(e.idNumber??""),[v,T]=ws.useState(null),I=ws.useRef(null),f=ws.useRef(null),u=ws.useRef(null),S=h.length===2&&d.length===2&&w.length===4&&x.trim().length>0,y=()=>{if(!S)return;let E=parseInt(h,10),V=parseInt(d,10),P=parseInt(w,10),M=new Date().getFullYear();if(E<1||E>12){T("Please enter a valid month (01\u201312).");return}if(V<1||V>31){T("Please enter a valid day (01\u201331).");return}if(P<1900||P>M){T(`Please enter a valid year (1900\u2013${M}).`);return}T(null),o({dobMonth:h,dobDay:d,dobYear:w,idNumber:x});},D=v||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(tr,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Dt,{style:i.form.flex,contentContainerStyle:Wn.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:Wn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:Wn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:Wn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,Wn.dobInput],placeholder:"MM",placeholderTextColor:m,value:h,onChangeText:E=>{let V=E.replace(/\D/g,"").slice(0,2);b(V),V.length===2&&I.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Wn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:I,style:[i.form.input,Wn.dobInput],placeholder:"DD",placeholderTextColor:m,value:d,onChangeText:E=>{let V=E.replace(/\D/g,"").slice(0,2);p(V),V.length===2&&f.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Wn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:f,style:[i.form.input,Wn.dobInput],placeholder:"YYYY",placeholderTextColor:m,value:w,onChangeText:E=>{let V=E.replace(/\D/g,"").slice(0,4);R(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Wn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:m,value:x,onChangeText:k,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:y,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),D?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:D}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!S&&i.form.continueBtnDisabled],onPress:y,disabled:!S,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!S&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Wn=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function jm({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ws.useRef(new reactNative.Animated.Value(.3)).current;return ws.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Ut.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:Ut.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Ut.skeletonLine,{width:"60%"}]})]})}function $m({onRefresh:e,colors:t,fonts:r}){let[o,n]=ws.useState(10),s=ws.useRef(null);ws.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=ws.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:Ut.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(ca,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[Ut.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function Gm({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:m=false,l2Completed:h=false,canPurchase:b=false,currentLimit:d}){let p=Vn(),{colors:w,fonts:R,components:x}=B(),k=[Ut.card,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius??12,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],v=[...k,{opacity:.5}],T=l==="verified",I=l==="pending",f=l==="rejected",u=c==="verified",S=c==="pending",y=T&&u,D=!T,E=!u,V=T,P=(b||T)&&!y,M=W=>`$${W.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:p.form.screen,children:[jsxRuntime.jsx(tr,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Ut.content,children:[d!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[Ut.limitBadge,{backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth,borderRadius:x.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.limitLabel,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ut.limitValue,{color:w.foreground,fontFamily:R.semibold}],children:[M(d)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.subtitle,{color:w.foregroundMuted,fontFamily:R.regular}],children:i?"Checking your verification status...":y?"All verification levels have been completed. Your limits are at the maximum available.":b?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jm,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth}),jsxRuntime.jsx(jm,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&(I?jsxRuntime.jsxs(reactNative.View,{style:k,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.pendingHeader,children:[jsxRuntime.jsx(Co,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardTitle,{color:w.foreground,fontFamily:R.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx($m,{onRefresh:n,colors:w,fonts:R}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ut.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardBody,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(wt,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[k,Ut.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(Co,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ut.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardTitle,{color:w.foreground,fontFamily:R.semibold}],children:f?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardBody,{color:w.foregroundMuted,fontFamily:R.regular}],children:f?"Previous verification was unsuccessful. Please try again.":b?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Br,{size:18,color:w.foregroundMuted,strokeWidth:2})]})),E&&(S?jsxRuntime.jsxs(reactNative.View,{style:k,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.pendingHeader,children:[jsxRuntime.jsx(Ac,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardTitle,{color:w.foreground,fontFamily:R.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx($m,{onRefresh:n,colors:w,fonts:R}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ut.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardBody,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(wt,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[k,Ut.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Ac,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ut.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardTitle,{color:w.foreground,fontFamily:R.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardBody,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Br,{size:18,color:w.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[v,Ut.cardRow],children:[jsxRuntime.jsx(Ac,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ut.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardTitle,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.cardBody,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[p.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:Ut.loaderRow,children:[jsxRuntime.jsx(wt,{size:24,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[p.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):y?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:p.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:p.form.continueBtnText,children:"Done"})}):P?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:p.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:p.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Ut=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var pd={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Jm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=B(),a=[bn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:bn.logoRow,children:jsxRuntime.jsx(om,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:bn.scroll,contentContainerStyle:bn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[bn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[bn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[bn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[bn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[bn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[bn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(pd.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(pd.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(pd.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(pd.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:bn.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var bn=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function Zm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:c}){let{colors:m}=B();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(wt,{size:56,strokeWidth:3}),jsxRuntime.jsx(So,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:m.primaryForeground,gradientTo:m.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(So,{error:n,progress:s,loading:o})]})]})})}function eh({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(wt,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(So,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function rh({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:m}){let{colors:h}=B(),b=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[b?jsxRuntime.jsx(tr,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:Jc}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(wt,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
+ `,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(Xc,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(So,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:m,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function oh({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:c}){let{colors:m}=B(),h=t.transaction_details,b=Yc(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c??l,title:"Review your purchase",variant:c?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(ya,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(mn,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(mn,{quote:e.quote,label:"You receive",value:`${b} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(mn,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(mn,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:m.primaryForeground,gradientTo:m.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(So,{error:o,progress:n,loading:r})]})]})}function nh({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:c}){let m=B(),{colors:h,fonts:b,components:d}=m,[p,w]=ws.useState("");ws.useEffect(()=>{if(t)return;let k=p?`+1${p}`:"";a(k);},[p,a,t]);let R=ws.useCallback(k=>{w(k.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(wt,{size:56,strokeWidth:3}),jsxRuntime.jsx(So,{error:o,progress:n,loading:r})]})]});let x=p.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:jl.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[jl.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:jl.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[jl.dialCode,{color:h.foreground,fontFamily:b.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,jl.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:m.components.input.placeholderColor,keyboardType:"phone-pad",value:p,onChangeText:R,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>x&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!x&&e.form.continueBtnDisabled],onPress:l,disabled:!x,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!x&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(So,{error:o,progress:n,loading:r})]})]})})}var jl=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function nC({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=B(),n=e.toLowerCase(),s=Zc[n]??o.primary,i=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[Un.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[Un.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Un.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(lt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function ih({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:c}=B(),m=t.transaction_details,h=Yc(m.destination_amount,m.destination_currency),b=r||o||"";ga(m.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Dt,{style:e.form.flex,contentContainerStyle:Un.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Un.iconSection,children:[jsxRuntime.jsx(nC,{currency:m.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Un.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Un.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Un.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Un.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Xc,{sourceCurrency:m.source_currency,destinationCurrency:m.destination_currency,destinationNetwork:m.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Un.detailCard],children:[jsxRuntime.jsx(mn,{quote:e.quote,label:"You Paid",value:`${m.source_amount} ${m.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(mn,{quote:e.quote,label:"You Received",value:`${h} ${m.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(mn,{quote:e.quote,label:"Network Fee",value:`$${m.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(mn,{quote:e.quote,label:"Transaction Fee",value:`$${m.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(sp,{quote:e.quote,label:"Intent Address",address:m.wallet_address,hideDivider:true}),b?jsxRuntime.jsx(sp,{quote:e.quote,label:"Recipient Address",address:b,last:true}):jsxRuntime.jsx(mn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var Un=reactNative.StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function sh({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:m,onClose:h}){let{colors:b,components:d}=B();if(t){let p=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!p&&jsxRuntime.jsx(wt,{size:56,strokeWidth:3}),jsxRuntime.jsx(So,{error:o,progress:n,loading:r})]}),p&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:m,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:d.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Kc.map(p=>{let w=i===p.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,w&&e.wallet.rowSelected],onPress:()=>{l(p.value),c(p.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(p.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,w&&e.wallet.rowTextSelected],children:p.label}),w&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(lt,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},p.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(wt,{size:28,strokeWidth:2,gradientFrom:b.primaryForeground,gradientTo:b.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:m,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(So,{error:o,progress:n,loading:r})]})]})})}function bd({config:e,onClose:t}){let r=B(),o=Vn(),{step:n,restoring:s,loading:i,status:a,error:l,email:c,phone:m,session:h,kycData:b,walletAddress:d,resolvedRecipientAddress:p,walletNetwork:w,sourceAmount:R,sourceCurrency:x,destinationCurrency:k,tokenIconUrl:v,networkIconUrl:T,applePaySupported:I,setStep:f,setEmail:u,setPhone:S,setWalletAddress:y,setWalletNetwork:D,setSourceAmount:E,setDestinationCurrency:V,checkEmail:P,register:M,attachKyc:W,verifyIdentity:G,registerWallet:Ne,collectPaymentMethod:te,addPaymentMethod:$e,confirmCheckout:X,reset:de,emitComplete:$,resumeFulfillmentPolling:Q,amountFirst:ue,customerId:Z,accessToken:ke,requestKYCUpgrade:qe,kycUpgradeMode:Ce,logout:se,clearError:Ye,switchingAccount:He}=cd(e),Je=!!e?.email&&!He,tt=!!e?.phone,Be=!!e?.publishableKey&&!!e?.externalUserId,[Ue,De]=ws.useState(void 0),[xe,Ie]=ws.useState(void 0),[st,le]=ws.useState([]),[Ze,pr]=ws.useState(false),[Ve,Oe]=ws.useState(false),[Ae,rt]=ws.useState(null),[Me,ge]=ws.useState(null),[ye,Bt]=ws.useState(null),[zt,Rt]=ws.useState(false),ht=ws.useCallback(async()=>{await se(),t?.();},[se,t]);ws.useEffect(()=>{n!=="kyc_offer"||!Z||!ke||(Rt(true),li(Z,ke).then(_e=>{let ot=_e.kyc_tiers??[],Y=ot.find(C=>C.tier==="l0"),Pe=ot.find(C=>C.tier==="l1"),_=ot.find(C=>C.tier==="l2");Y?.verification_status&&rt(Y.verification_status),Pe?.verification_status&&ge(Pe.verification_status),_?.verification_status&&Bt(_.verification_status);}).catch(_e=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",_e?.message);}).finally(()=>Rt(false)),d&&dp({destinationNetwork:w||"ethereum",walletAddress:d,accessToken:ke,cryptoCustomerId:Z}).then(_e=>{let ot=_e.limits?.usd;if(ot?.card?.length){let Y=Math.max(...ot.card.map(Pe=>Pe.limit));De(Y);}}).catch(_e=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",_e?.message);}));},[n,Z,ke,d,w]),ws.useEffect(()=>{if(s||n!=="session_params"||!Z||!ke)return;let _e=Y=>{let Pe=Y?.message??"";return Pe.includes("stripe_onramp_forbidden")||Pe.includes("403")},ot=Y=>{_e(Y)&&ht();};li(Z,ke).then(Y=>{let Pe=Y.kyc_tiers??[],_=Pe.find(U=>U.tier==="l0"),C=Pe.find(U=>U.tier==="l1"),L=Pe.find(U=>U.tier==="l2"),O=!!C?.verification_status&&C.verification_status!=="not_started",H=L?.verification_status==="verified";pr(O),Oe(!!H),_?.verification_status&&rt(_.verification_status),C?.verification_status&&ge(C.verification_status),L?.verification_status&&Bt(L.verification_status);}).catch(Y=>{console.warn("[OnrampScreen] customer fetch error:",Y?.message),ot(Y);}),up(Z,ke).then(Y=>{le(Y.data??[]);}).catch(Y=>{console.warn("[OnrampScreen] payment_tokens error:",Y?.message),ot(Y);}),d&&dp({destinationNetwork:w||"ethereum",walletAddress:d,accessToken:ke,cryptoCustomerId:Z}).then(Y=>{let Pe=Y.limits?.usd;if(Pe?.card?.length){let _=Math.max(...Pe.card.map(C=>C.limit));De(_);}}).catch(Y=>{console.warn("[OnrampScreen] transaction_limits error:",Y?.message),ot(Y);}),Pl(e?.publishableKey).then(Y=>{let Pe=Y.data?.find(_=>_.currency_code==="usd");Pe&&Ie(Pe.minimum_amount);}).catch(Y=>{console.warn("[OnrampScreen] fiat_currencies error:",Y?.message);});},[s,n,Z,ke,d,w,de,ht]);let sr=async()=>{if(!(!Z||!ke))try{let _e=await up(Z,ke);le(_e.data??[]);}catch(_e){console.warn("[OnrampScreen] payment_tokens refresh error:",_e?.message);let ot=_e?.message??"";(ot.includes("stripe_onramp_forbidden")||ot.includes("403"))&&ht();}},ze=async()=>{let _e=await $e();return _e&&await sr(),_e},gt=e?.skipSuccessConfirmation===true;ws.useEffect(()=>{n==="success"&&gt&&h&&($(h),de(),t?.());},[n,gt,h,$,de,t]),ws.useEffect(()=>{n==="register"&&tt&&M();},[n,tt,M]);let Ke=()=>{de(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[uC.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(wt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Jm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>f("register"),onClose:()=>f("email")});if(n==="email")return jsxRuntime.jsx(Zm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Je,loading:i,error:l,status:a,email:c,setEmail:u,checkEmail:P,onClose:Ke});if(n==="register")return jsxRuntime.jsx(nh,{styles:o,hasPrefilledPhone:tt,loading:i,error:l,status:a,email:c,phone:m,setPhone:S,register:M,onClose:Ke});if(n==="kyc")return jsxRuntime.jsx(ld,{initialData:b,loading:i,onComplete:W,onCancel:Ke});if(n==="kyc_offer"){let Y=Ae==="verified"||Me==="verified"||ye==="verified",Pe=()=>{Ce.current&&(Ce.current=false),f("session_params");};return jsxRuntime.jsx(Gm,{onSelectL1:()=>f("kyc_l1"),onSelectL2:()=>{Ce.current=true,f("identity");},onSkip:Pe,onClose:()=>{Ce.current?(Ce.current=false,f("session_params")):Y?Pe():Ke();},onRefresh:()=>{!Z||!ke||(Rt(true),li(Z,ke).then(L=>{let O=L.kyc_tiers??[],H=O.find(me=>me.tier==="l0"),U=O.find(me=>me.tier==="l1"),ve=O.find(me=>me.tier==="l2");H?.verification_status&&rt(H.verification_status),U?.verification_status&&ge(U.verification_status),ve?.verification_status&&Bt(ve.verification_status);}).catch(L=>{console.warn("[OnrampScreen] refresh customer fetch error:",L?.message);}).finally(()=>Rt(false)));},loading:i,loadingTiers:zt,error:l?.message,l1Status:Me??"not_started",l2Status:ye??"not_started",l1Completed:Ze,l2Completed:Ve,canPurchase:Y,currentLimit:Y?Ue:void 0})}if(n==="kyc_l1"){let _e=Ce.current?"session_params":"wallet";return jsxRuntime.jsx(Hm,{initialData:b,loading:i,error:l?.message,onComplete:ot=>{Ce.current&&(Ce.current=false),W(ot,_e);},onCancel:()=>{Ye(),f("kyc_offer");},onClose:Ke})}return n==="identity"?jsxRuntime.jsx(eh,{styles:o,loading:i,status:a,error:l,verifyIdentity:G,onClose:()=>{Ce.current?(Ce.current=false,f("session_params")):Ke();}}):n==="wallet"?jsxRuntime.jsx(sh,{styles:o,hasAutoWallet:Be,loading:i,error:l,status:a,walletAddress:d,walletNetwork:w,setWalletAddress:y,setWalletNetwork:D,setDestinationCurrency:V,registerWallet:Ne,onClose:Ke}):n==="session_params"?jsxRuntime.jsx(ad,{initialAmount:R,currency:x,applePaySupported:I,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:xe,maxAmount:Ue,paymentTokens:st,onAddPaymentMethod:ze,onCollectPayment:(_e,ot)=>{te(_e,ot);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(_e,ot)=>{if(ue&&!Z)E(_e),f("email");else {let Y=ot==="apple_pay";te(Y,_e,!Y&&ot?ot:void 0);}},onCancel:Ke,accessToken:ke,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:ht,onRequestKYC:qe,showSwitchAccount:!Je,inputDisabled:(Ae!==null||Me!==null)&&Ae!=="verified"&&Me!=="verified"&&ye!=="verified"}):n==="quote"&&h?jsxRuntime.jsx(oh,{styles:o,session:h,loading:i,error:l,status:a,confirmCheckout:X,tokenIconUrl:v,networkIconUrl:T,onClose:Ke,onBack:()=>f("session_params")}):n==="processing"?jsxRuntime.jsx(rh,{styles:o,error:l,status:a,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??k,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:v,networkIconUrl:T,onClose:Ke,onRetryStatusCheck:Q}):n==="success"&&h&&!gt?jsxRuntime.jsx(ih,{styles:o,session:h,resolvedRecipientAddress:p,recipientFromConfig:e?.recipientAddress,tokenIconUrl:v,networkIconUrl:T,onDone:()=>{$(h),de(),t?.();}}):null}var uC=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function ah(){try{let e=pC__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let s=n.trim();if(s.length>0)return s}}}catch{}}function wd({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:m,onStepChange:h,onClose:b,merchantIdentifier:d="",urlScheme:p="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:R=false,appName:x}){let{colors:k,fonts:v,components:T}=B(),I=e||Nc(),f=ws.useMemo(()=>{let V=d.trim();return V.length>0?V:ah()??""},[d]),[u,S]=ws.useState("loading"),[y,D]=ws.useState(null);ws.useEffect(()=>{let V=false;async function P(){try{I&&(ed(I),td(_l()));let M=await rd();if(V)return;let W=f.trim();if(await stripeReactNative.initStripe({publishableKey:M,urlScheme:p,...W?{merchantIdentifier:W}:{}}),V)return;S("ready");}catch(M){if(V)return;console.error("[StripeOnramp] Init failed:",M),D(M?.message??"Failed to load Stripe configuration"),S("error");}}return P(),()=>{V=true;}},[I,f,p]);let E=ws.useMemo(()=>{let V={publishableKey:I,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:c,onError:m,onStepChange:h};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),w&&(V.paymentSelectorPosition=w),V.skipSuccessConfirmation=R,V.merchantIdentifier=f,x&&(V.merchantDisplayName=x),V},[I,o,s,i,a,l,t,r,n,w,R,f,x,c,m,h]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[Ia.centered,{backgroundColor:k.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ia.errorText,{color:k.error,fontFamily:v.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[Ia.errorDetail,{color:k.foregroundMuted,fontFamily:v.regular}],children:y}),b&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ia.retryBtn,{backgroundColor:T.button.primaryBackground,borderRadius:T.button.borderRadius}],onPress:b,children:jsxRuntime.jsx(reactNative.Text,{style:[Ia.retryBtnText,{color:T.button.primaryText,fontFamily:v.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[Ia.centered,{backgroundColor:k.background}],children:jsxRuntime.jsx(wt,{size:56,strokeWidth:3,gradientFrom:k.primary,gradientTo:k.primary})}):jsxRuntime.jsx(bd,{config:E,onClose:b})}var Ia=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function uh(){let{configure:e}=stripeReactNative.useOnramp(),t=ws.useRef(false);return ws.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var ph="__unifold_stripe_onramp__";function Cd(e){globalThis[ph]=e;}function fh(){return globalThis[ph]}Cd(wd);var Ki=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 Ds,Gi,_a,mh,SC=(mh=class extends Ki{constructor(){super();re(this,Ds);re(this,Gi);re(this,_a);j(this,_a,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,Gi)||this.setEventListener(g(this,_a));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Gi))==null||t.call(this),j(this,Gi,void 0));}setEventListener(t){var r;j(this,_a,t),(r=g(this,Gi))==null||r.call(this),j(this,Gi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Ds)!==t&&(j(this,Ds,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Ds)=="boolean"?g(this,Ds):globalThis.document?.visibilityState!=="hidden"}},Ds=new WeakMap,Gi=new WeakMap,_a=new WeakMap,mh),Sd=new SC;var TC={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Nn,Vs,hh,kC=(hh=class{constructor(){re(this,Nn,TC);re(this,Vs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Vs)&&e!==g(this,Nn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Nn),provider:e}),j(this,Nn,e),process.env.NODE_ENV!=="production"&&j(this,Vs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,Vs,true),g(this,Nn).setTimeout(e,t)}clearTimeout(e){g(this,Nn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,Vs,true),g(this,Nn).setInterval(e,t)}clearInterval(e){g(this,Nn).clearInterval(e);}},Nn=new WeakMap,Vs=new WeakMap,hh),$l=new kC;function gh(e){setTimeout(e,0);}var wh=typeof window>"u"||"Deno"in globalThis;function Do(){}function Ch(e,t){return typeof e=="function"?e(t):e}function Sh(e){return typeof e=="number"&&e>=0&&e!==1/0}function Th(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ql(e,t){return typeof e=="function"?e(t):e}function kh(e,t){return typeof e=="function"?e(t):e}function Op(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Ql(i,t.options))return false}else if(!Da(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function Lp(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Pa(t.options.mutationKey)!==Pa(s))return false}else if(!Da(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Ql(e,t){return (t?.queryKeyHashFn||Pa)(e)}function Pa(e){return JSON.stringify(e,(t,r)=>Vp(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Da(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Da(e[r],t[r])):false}var xC=Object.prototype.hasOwnProperty;function Dp(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=yh(e)&&yh(t);if(!o&&!(Vp(e)&&Vp(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let m=0;m<a;m++){let h=o?m:i[m],b=e[h],d=t[h];if(b===d){l[h]=b,(o?m<s:xC.call(e,h))&&c++;continue}if(b===null||d===null||typeof b!="object"||typeof d!="object"){l[h]=d;continue}let p=Dp(b,d,r+1);l[h]=p,p===b&&c++;}return s===a&&c===s?e:l}function yh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vp(e){if(!bh(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!bh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bh(e){return Object.prototype.toString.call(e)==="[object Object]"}function xh(e){return new Promise(t=>{$l.setTimeout(t,e);})}function vh(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 Dp(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 Dp(e,t)}return t}function Rh(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Ih(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Fa=Symbol();function Td(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Fa&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Fa?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _h(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 kd=(()=>{let e=()=>wh;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Ph(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var vC=gh;function RC(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=vC,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var $r=RC();var Va,Yi,Oa,Fh,IC=(Fh=class extends Ki{constructor(){super();re(this,Va,true);re(this,Yi);re(this,Oa);j(this,Oa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,Yi)||this.setEventListener(g(this,Oa));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Yi))==null||t.call(this),j(this,Yi,void 0));}setEventListener(t){var r;j(this,Oa,t),(r=g(this,Yi))==null||r.call(this),j(this,Yi,t(this.setOnline.bind(this)));}setOnline(t){g(this,Va)!==t&&(j(this,Va,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,Va)}},Va=new WeakMap,Yi=new WeakMap,Oa=new WeakMap,Fh),La=new IC;function _C(e){return Math.min(1e3*2**e,3e4)}function Bp(e){return (e??"online")==="online"?La.isOnline():true}var xd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function vd(e){let t=false,r=0,o,n=Ph(),s=()=>n.status!=="pending",i=w=>{if(!s()){let R=new xd(w);b(R),e.onCancel?.(R);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>Sd.isFocused()&&(e.networkMode==="always"||La.isOnline())&&e.canRun(),m=()=>Bp(e.networkMode)&&e.canRun(),h=w=>{s()||(o?.(),n.resolve(w));},b=w=>{s()||(o?.(),n.reject(w));},d=()=>new Promise(w=>{o=R=>{(s()||c())&&w(R);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),p=()=>{if(s())return;let w,R=r===0?e.initialPromise:void 0;try{w=R??e.fn();}catch(x){w=Promise.reject(x);}Promise.resolve(w).then(h).catch(x=>{if(s())return;let k=e.retry??(kd.isServer()?0:3),v=e.retryDelay??_C,T=typeof v=="function"?v(r,x):v,I=k===true||typeof k=="number"&&r<k||typeof k=="function"&&k(r,x);if(t||!I){b(x);return}r++,e.onFail?.(r,x),xh(T).then(()=>c()?void 0:d()).then(()=>{t?b(x):p();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:m,start:()=>(m()?p():d().then(p),n)}}var Os,Dh,Rd=(Dh=class{constructor(){re(this,Os);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Sh(this.gcTime)&&j(this,Os,$l.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(kd.isServer()?1/0:300*1e3));}clearGcTimeout(){g(this,Os)!==void 0&&($l.clearTimeout(g(this,Os)),j(this,Os,void 0));}},Os=new WeakMap,Dh);function Oh(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let m=false,h=p=>{_h(p,()=>t.signal,()=>m=true);},b=Td(t.options,t.fetchOptions),d=async(p,w,R)=>{if(m)return Promise.reject(t.signal.reason);if(w==null&&p.pages.length)return Promise.resolve(p);let k=(()=>{let f={client:t.client,queryKey:t.queryKey,pageParam:w,direction:R?"backward":"forward",meta:t.options.meta};return h(f),f})(),v=await b(k),{maxPages:T}=t.options,I=R?Ih:Rh;return {pages:I(p.pages,v,T),pageParams:I(p.pageParams,w,T)}};if(n&&s.length){let p=n==="backward",w=p?PC:Vh,R={pages:s,pageParams:i},x=w(o,R);a=await d(R,x,p);}else {let p=e??s.length;do{let w=l===0?i[0]??o.initialPageParam:Vh(o,a);if(l>0&&w==null)break;a=await d(a,w),l++;}while(l<p)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Vh(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 PC(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ba,Ls,Aa,on,Bs,no,Kl,As,jo,Eh,fi,Ah,Wh=(Ah=class extends Rd{constructor(t){super();re(this,jo);re(this,Ba);re(this,Ls);re(this,Aa);re(this,on);re(this,Bs);re(this,no);re(this,Kl);re(this,As);j(this,As,false),j(this,Kl,t.defaultOptions),this.setOptions(t.options),this.observers=[],j(this,Bs,t.client),j(this,on,g(this,Bs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,j(this,Ls,Bh(this.options)),this.state=t.state??g(this,Ls),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return g(this,Ba)}get promise(){return g(this,no)?.promise}setOptions(t){if(this.options={...g(this,Kl),...t},t?._type&&j(this,Ba,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Bh(this.options);r.data!==void 0&&(this.setState(Lh(r.data,r.dataUpdatedAt)),j(this,Ls,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,on).remove(this);}setData(t,r){let o=vh(this.state.data,t,this.options);return yt(this,jo,fi).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){yt(this,jo,fi).call(this,{type:"setState",state:t});}cancel(t){let r=g(this,no)?.promise;return g(this,no)?.cancel(t),r?r.then(Do).catch(Do):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return g(this,Ls)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>kh(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fa||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ql(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:!Th(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),g(this,no)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),g(this,no)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,on).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(g(this,no)&&(g(this,As)||yt(this,jo,Eh).call(this)?g(this,no).cancel({revert:true}):g(this,no).cancelRetry()),this.scheduleGc()),g(this,on).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||yt(this,jo,fi).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&g(this,no)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(g(this,no))return g(this,no).continueRetry(),g(this,no).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(m=>m.options.queryFn);c&&this.setOptions(c.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(j(this,As,true),o.signal)});},s=()=>{let c=Td(this.options,r),h=(()=>{let b={client:g(this,Bs),queryKey:this.queryKey,meta:this.meta};return n(b),b})();return j(this,As,false),this.options.persister?this.options.persister(c,h,this):c(h)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:g(this,Bs),state:this.state,fetchFn:s};return n(c),c})();(g(this,Ba)==="infinite"?Oh(this.options.pages):this.options.behavior)?.onFetch(a,this),j(this,Aa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&yt(this,jo,fi).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),j(this,no,vd({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof xd&&c.revert&&this.setState({...g(this,Aa),fetchStatus:"idle"}),o.abort();},onFail:(c,m)=>{yt(this,jo,fi).call(this,{type:"failed",failureCount:c,error:m});},onPause:()=>{yt(this,jo,fi).call(this,{type:"pause"});},onContinue:()=>{yt(this,jo,fi).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await g(this,no).start();if(c===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(c),g(this,on).config.onSuccess?.(c,this),g(this,on).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof xd){if(c.silent)return g(this,no).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw yt(this,jo,fi).call(this,{type:"error",error:c}),g(this,on).config.onError?.(c,this),g(this,on).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Ba=new WeakMap,Ls=new WeakMap,Aa=new WeakMap,on=new WeakMap,Bs=new WeakMap,no=new WeakMap,Kl=new WeakMap,As=new WeakMap,jo=new WeakSet,Eh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},fi=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,...FC(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Lh(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return j(this,Aa,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),$r.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),g(this,on).notify({query:this,type:"updated",action:t});});},Ah);function FC(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lh(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Bh(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 Gl,Hn,ho,Ws,jn,Ji,Mh,zh=(Mh=class extends Rd{constructor(t){super();re(this,jn);re(this,Gl);re(this,Hn);re(this,ho);re(this,Ws);j(this,Gl,t.client),this.mutationId=t.mutationId,j(this,ho,t.mutationCache),j(this,Hn,[]),this.state=t.state||DC(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){g(this,Hn).includes(t)||(g(this,Hn).push(t),this.clearGcTimeout(),g(this,ho).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){j(this,Hn,g(this,Hn).filter(r=>r!==t)),this.scheduleGc(),g(this,ho).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){g(this,Hn).length||(this.state.status==="pending"?this.scheduleGc():g(this,ho).remove(this));}continue(){return g(this,Ws)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{yt(this,jn,Ji).call(this,{type:"continue"});},o={client:g(this,Gl),meta:this.options.meta,mutationKey:this.options.mutationKey};j(this,Ws,vd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{yt(this,jn,Ji).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{yt(this,jn,Ji).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,ho).canRun(this)}));let n=this.state.status==="pending",s=!g(this,Ws).canStart();try{if(n)r();else {yt(this,jn,Ji).call(this,{type:"pending",variables:t,isPaused:s}),g(this,ho).config.onMutate&&await g(this,ho).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&yt(this,jn,Ji).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await g(this,Ws).start();return await g(this,ho).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await g(this,ho).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),yt(this,jn,Ji).call(this,{type:"success",data:i}),i}catch(i){try{await g(this,ho).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await g(this,ho).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw yt(this,jn,Ji).call(this,{type:"error",error:i}),i}finally{g(this,ho).runNext(this);}}},Gl=new WeakMap,Hn=new WeakMap,ho=new WeakMap,Ws=new WeakMap,jn=new WeakSet,Ji=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),$r.batch(()=>{g(this,Hn).forEach(o=>{o.onMutationUpdate(t);}),g(this,ho).notify({mutation:this,type:"updated",action:t});});},Mh);function DC(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var mi,wn,Yl,Uh,Nh=(Uh=class extends Ki{constructor(t={}){super();re(this,mi);re(this,wn);re(this,Yl);this.config=t,j(this,mi,new Set),j(this,wn,new Map),j(this,Yl,0);}build(t,r,o){let n=new zh({client:t,mutationCache:this,mutationId:++wl(this,Yl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){g(this,mi).add(t);let r=Id(t);if(typeof r=="string"){let o=g(this,wn).get(r);o?o.push(t):g(this,wn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(g(this,mi).delete(t)){let r=Id(t);if(typeof r=="string"){let o=g(this,wn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&g(this,wn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Id(t);if(typeof r=="string"){let n=g(this,wn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Id(t);return typeof r=="string"?g(this,wn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){$r.batch(()=>{g(this,mi).forEach(t=>{this.notify({type:"removed",mutation:t});}),g(this,mi).clear(),g(this,wn).clear();});}getAll(){return Array.from(g(this,mi))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Lp(r,o))}findAll(t={}){return this.getAll().filter(r=>Lp(t,r))}notify(t){$r.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return $r.batch(()=>Promise.all(t.map(r=>r.continue().catch(Do))))}},mi=new WeakMap,wn=new WeakMap,Yl=new WeakMap,Uh);function Id(e){return e.options.scope?.id}var $n,Hh,jh=(Hh=class extends Ki{constructor(t={}){super();re(this,$n);this.config=t,j(this,$n,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Ql(n,r),i=this.get(s);return i||(i=new Wh({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){g(this,$n).has(t.queryHash)||(g(this,$n).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=g(this,$n).get(t.queryHash);r&&(t.destroy(),r===t&&g(this,$n).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){$r.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return g(this,$n).get(t)}getAll(){return [...g(this,$n).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Op(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Op(t,o)):r}notify(t){$r.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){$r.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){$r.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},$n=new WeakMap,Hh);var Dr,Zi,Xi,Wa,Ea,es,Ma,za,$h,Ap=($h=class{constructor(e={}){re(this,Dr);re(this,Zi);re(this,Xi);re(this,Wa);re(this,Ea);re(this,es);re(this,Ma);re(this,za);j(this,Dr,e.queryCache||new jh),j(this,Zi,e.mutationCache||new Nh),j(this,Xi,e.defaultOptions||{}),j(this,Wa,new Map),j(this,Ea,new Map),j(this,es,0);}mount(){wl(this,es)._++,g(this,es)===1&&(j(this,Ma,Sd.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Dr).onFocus());})),j(this,za,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Dr).onOnline());})));}unmount(){var e,t;wl(this,es)._--,g(this,es)===0&&((e=g(this,Ma))==null||e.call(this),j(this,Ma,void 0),(t=g(this,za))==null||t.call(this),j(this,za,void 0));}isFetching(e){return g(this,Dr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Zi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Dr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=g(this,Dr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(ql(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return g(this,Dr).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=g(this,Dr).get(o.queryHash)?.state.data,i=Ch(t,s);if(i!==void 0)return g(this,Dr).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return $r.batch(()=>g(this,Dr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Dr).get(t.queryHash)?.state}removeQueries(e){let t=g(this,Dr);$r.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=g(this,Dr);return $r.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=$r.batch(()=>g(this,Dr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Do).catch(Do)}invalidateQueries(e,t={}){return $r.batch(()=>(g(this,Dr).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=$r.batch(()=>g(this,Dr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Do)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Do)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=g(this,Dr).build(this,t);return r.isStaleByTime(ql(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Do).catch(Do)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Do).catch(Do)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return La.isOnline()?g(this,Zi).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,Dr)}getMutationCache(){return g(this,Zi)}getDefaultOptions(){return g(this,Xi)}setDefaultOptions(e){j(this,Xi,e);}setQueryDefaults(e,t){g(this,Wa).set(Pa(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...g(this,Wa).values()],r={};return t.forEach(o=>{Da(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){g(this,Ea).set(Pa(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...g(this,Ea).values()],r={};return t.forEach(o=>{Da(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...g(this,Xi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Ql(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Fa&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...g(this,Xi).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){g(this,Dr).clear(),g(this,Zi).clear();}},Dr=new WeakMap,Zi=new WeakMap,Xi=new WeakMap,Wa=new WeakMap,Ea=new WeakMap,es=new WeakMap,Ma=new WeakMap,za=new WeakMap,$h);var qh=ws__namespace.createContext(void 0);var Wp=({client:e,children:t})=>(ws__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(qh.Provider,{value:e,children:t}));var Na=new Map;function Qh({width:e,height:t,borderRadius:r,color:o}){let n=ws.useRef(new reactNative.Animated.Value(.3)).current;return ws.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function To({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=B(),[c,m]=ws.useState(false),[h,b]=ws.useState(false),[d,p]=ws.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let I=Na.get(e);return I?{uri:e,xml:I}:null}),w=e?.toLowerCase().endsWith(".svg"),R=w&&e&&d?.uri===e?d.xml:null;ws.useEffect(()=>{m(false),b(false);},[e]),ws.useEffect(()=>{if(!w||!e)return;if(Na.has(e)){p({uri:e,xml:Na.get(e)});return}let I=false;return fetch(e).then(f=>{if(!f.ok)throw new Error(`HTTP ${f.status}`);return f.text()}).then(f=>{I||(Na.set(e,f),p({uri:e,xml:f}));}).catch(()=>{I||m(true);}),()=>{I=true;}},[e,w]);let x=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:x},a]});let k={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},v=t-n*2,T=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[k,{backgroundColor:i||x}]}):w?jsxRuntime.jsxs(reactNative.View,{style:k,children:[!!!R&&jsxRuntime.jsx(Qh,{width:v,height:T,borderRadius:o,color:x}),R?jsxRuntime.jsx(or.SvgXml,{xml:R,width:v,height:T,onError:()=>m(true)}):jsxRuntime.jsx(or.SvgUri,{uri:e,width:v,height:T,onError:()=>m(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:k,children:[!h&&jsxRuntime.jsx(Qh,{width:v,height:T,borderRadius:o,color:x}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:v,height:T},resizeMode:"contain",onLoad:()=>b(true),onError:()=>m(true)})]})}function Zl(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Na.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Na.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Qr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:m,balanceTokenAddress:h,publishableKey:b,projectName:d,leftIcon:p,onLeftAction:w}){let{colors:R,fonts:x,components:k}=B(),[v,T]=ws.useState(null),[I,f]=ws.useState(false),u=ws.useState(()=>new reactNative.Animated.Value(0))[0];ws.useEffect(()=>{if(!I)return;let y=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return y.start(),()=>y.stop()},[I,u]),ws.useEffect(()=>{if(!a||!l||!c||!m||!h||!b){T(null),f(false);return}let y=false;return f(true),Qc(l,c,m,h,b).then(D=>{if(y)return;let E=D.balance,V=null;E&&(E.amount_usd!=null&&E.amount_usd!==""?V=`$${E.amount_usd}`:V="$0.00"),T(V);}).catch(()=>{y||T(null);}).finally(()=>{y||f(false);}),()=>{y=true;}},[a,l,c,m,h,b]);let S=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:go.header,children:[jsxRuntime.jsx(reactNative.View,{style:go.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[go.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Sl,{size:20,color:k.header.buttonColor,strokeWidth:2})}):p&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[go.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:p}):jsxRuntime.jsx(reactNative.View,{style:go.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:go.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:go.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[go.title,{color:k.header.titleColor,fontFamily:x.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[go.titleBadge,{backgroundColor:R.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[go.titleBadgeText,{color:R.foregroundMuted,fontFamily:x.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[go.balanceText,{color:R.foregroundMuted,fontFamily:x.regular}],children:t}):null,a&&(I?jsxRuntime.jsx(reactNative.Animated.View,{style:[go.balanceSkeleton,{backgroundColor:R.cardHover,opacity:S}]}):v!=null?jsxRuntime.jsxs(reactNative.Text,{style:[go.balanceText,{color:R.foregroundMuted,fontFamily:x.regular}],children:[d?`${d} `:"","Balance: ",v]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:go.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[go.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tt,{size:20,color:k.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:go.spacer})})]})}var go=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Vr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=B(),a=s??i.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},m=[Jh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],h=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:m,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Jh.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Jh=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Xl({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(Vr,{cardTokens:i,onPress:e,style:qn.wrapper,contentStyle:qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[qn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Mu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[qn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[qn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:qn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:qn.networkIcons,children:a.map((l,c)=>{let m=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[qn.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(To,{uri:ne(m),width:20,height:20})},l.name)})})})]})}var qn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function tc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card;return jsxRuntime.jsxs(Vr,{cardTokens:i,onPress:e,style:hi.wrapper,contentStyle:hi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:hi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[hi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(sa,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:hi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[hi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[hi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:hi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:hi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsxRuntime.jsx(To,{uri:ne(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var hi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function rc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card;return jsxRuntime.jsx(Vr,{cardTokens:i,onPress:e,style:gi.wrapper,contentStyle:gi.container,children:jsxRuntime.jsxs(reactNative.View,{style:gi.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[gi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(mo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[gi.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[gi.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:gi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[gi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[gi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var gi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function nc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=B(),s=n.depositMenu.card;return jsxRuntime.jsxs(Vr,{cardTokens:s,onPress:e,style:Qn.wrapper,contentStyle:Qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Wc,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Qn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Qn.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Qn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Qn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var QC="#00D632";function ic({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=B(),s=n.depositMenu.card,[i,a]=ws.useState(false),l=er("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Vr,{cardTokens:s,onPress:e,style:Kn.wrapper,contentStyle:Kn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Kn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Kn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[Kn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Kn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Kn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Kn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Kn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Kn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Kn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:QC,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function sc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:s}=B(),i=s.depositMenu.card;return jsxRuntime.jsxs(Vr,{cardTokens:i,onPress:e,style:Gn.wrapper,contentStyle:Gn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Gn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Gn.iconContainer,{backgroundColor:i.iconBackgroundColor,borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(rm,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Gn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Gn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Gn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:Gn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Gn.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(m=>m.format==="png")?.url||a.icon_urls.find(m=>m.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Gn.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(To,{uri:ne(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Gn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});var Us="#00D632",sg=5,ZC=[25,50,100,500],Qa=120,XC=5e3,eS=2e3,tS=300;function ac(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function ag(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function rS(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function lg(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function oS(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function cg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function nS(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function iS(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function Od({size:e,faded:t=false,withBackground:r=false}){let[o,n]=ws.useState(false),s=er("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Us,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Us}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Ld({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:m,components:h}=B();ws.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[b,d]=ws.useState("amountInput"),[p,w]=ws.useState("25"),[R,x]=ws.useState(null),[k,v]=ws.useState(null),[T,I]=ws.useState(true),[f,u]=ws.useState(null),[S,y]=ws.useState(false),[D,E]=ws.useState(null),[V,P]=ws.useState(Qa),[M,W]=ws.useState(null),[G,Ne]=ws.useState(false),[te,$e]=ws.useState("pending"),X=ws.useRef(null),de=ws.useRef(null),$=ws.useRef(null),Q=ws.useRef("pending"),ue=ws.useRef(null),Z=ws.useRef("amountInput"),ke=ws.useRef(Qa),qe=ws.useRef(null),Ce=ws.useRef(null),se=ws.useRef(false),Ye=ws.useRef(true),He=k?.minimum_amount??sg,Je=k?.maximum_amount,tt=parseFloat(p)||0,Be=!isNaN(tt)&&tt>=He&&(Je==null||tt<=Je),Ue=Je?`$${ac(He)} \u2013 $${ac(Je)}`:`$${ac(He)} minimum`,De=b==="amountInput"?"Pay with Cash App":`Pay $${ag(p)} via Cash App`,xe=b==="waitingForPayment";ws.useEffect(()=>(Ye.current=true,I(true),Ju("usd",t).then(C=>{Ye.current&&v(C);}).catch(()=>{}).finally(()=>{Ye.current&&I(false);}),()=>{Ye.current=false,st();}),[t]);function Ie(C,L=k){if(E(null),!C){x(null);return}let O=parseFloat(C);if(isNaN(O)){x("Enter a valid number");return}let H=L?.minimum_amount??sg,U=L?.maximum_amount;O<H?x(`$${ac(H)} minimum`):U!=null&&O>U?x(`$${ac(U)} maximum`):x(null);}function st(){X.current&&clearInterval(X.current),de.current&&clearInterval(de.current),$.current&&clearInterval($.current),X.current=null,de.current=null,$.current=null;}function le(){st(),u(null),ue.current=null,W(null),Ne(false),E(null),Q.current="pending",$e("pending"),P(Qa),ke.current=Qa,qe.current=null,se.current=false,d("amountInput"),Z.current="amountInput";}async function Ze(){if(!(!Be||S)){y(true),E(null),st(),qe.current=null;try{let C=await Yu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:p},t);ue.current=C,Q.current=C.status,u(C),y(!1),d("waitingForPayment"),Z.current="waitingForPayment",pr(),Ve(),reactNative.Linking.openURL(C.url).catch(()=>{});}catch(C){y(false),E(C instanceof Error?C.message:"Failed to create session");}}}function pr(){ke.current=Qa,P(Qa),$.current&&clearInterval($.current),$.current=setInterval(()=>{ke.current-=1,P(ke.current),ke.current<=0&&(clearInterval($.current),$.current=null,Q.current==="pending"&&(d("softExpired"),Z.current="softExpired"));},1e3);}function Ve(){X.current&&clearInterval(X.current),X.current=setInterval(()=>{Oe();},XC);}async function Oe(){if(!Ye.current)return;let C=ue.current;if(!C)return;let L=C.external_id??C.id;try{let O=await Zu(L,t),H=Q.current;switch(Q.current=O.status,$e(O.status),O.status){case "processing":(Z.current==="amountInput"||Z.current==="softExpired"||Z.current==="waitingForPayment")&&(d("paymentReceived"),Z.current="paymentReceived",$.current&&(clearInterval($.current),$.current=null));break;case "completed":X.current&&(clearInterval(X.current),X.current=null),$.current&&(clearInterval($.current),$.current=null),H!=="completed"&&(d("paymentReceived"),Z.current="paymentReceived",rt());break;case "failed":X.current&&(clearInterval(X.current),X.current=null),$.current&&(clearInterval($.current),$.current=null),Z.current!=="amountInput"&&(d("failed"),Z.current="failed");break;case "expired":X.current&&(clearInterval(X.current),X.current=null),$.current&&(clearInterval($.current),$.current=null),Z.current!=="amountInput"&&(d("softExpired"),Z.current="softExpired");break;default:break}}catch{}}let Ae=6e5;function rt(){de.current&&clearInterval(de.current);let C=Date.now()+Ae;de.current=setInterval(()=>{if(Date.now()>C){clearInterval(de.current),de.current=null;let L=Q.current;L==="completed"||L==="processing"?(d("paymentReceived"),Z.current="paymentReceived"):(d("failed"),Z.current="failed");return}Me();},eS);}async function Me(){if(Ye.current)try{let C=await fn(e,t,"deposit"),L=Date.now(),O=[...C.data].sort((ve,me)=>{let z=ve.created_at?new Date(ve.created_at).getTime():0;return (me.created_at?new Date(me.created_at).getTime():0)-z}),H=qe.current,U=H?O.find(ve=>ve.id===H):O.find(ve=>{if(!ve.created_at)return !1;let me=new Date(ve.created_at).getTime();return L-me<tS*1e3});U&&(qe.current||(qe.current=U.id),U.status==="succeeded"?(de.current&&(clearInterval(de.current),de.current=null),W(U),d("depositComplete"),Z.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:U.id,transaction:U})):(U.status==="failed"||U.status==="refunded")&&(de.current&&(clearInterval(de.current),de.current=null),W(U),d("failed"),Z.current="failed"));}catch{}}function ge(){if(b==="waitingForPayment"){$.current&&(clearInterval($.current),$.current=null),d("amountInput"),Z.current="amountInput";return}i();}function ye(){st(),a();}function Bt(){let C=ue.current??f;C&&reactNative.Linking.openURL(C.url).catch(()=>{});}function zt(C){let L=C.destination_amount_base_unit;if(!L)return "\u2014";let O=C.destination_token_metadata?.decimals??6;return rS(L,O)}function Rt(C){return oS(C.destination_currency)}function ht(C){let L=C.destination_token_metadata;return L?L.icon_urls&&L.icon_urls.length>0?Pn(L.icon_urls,"png")??L.icon_url??null:L.icon_url??null:null}function sr(){return jsxRuntime.jsxs(reactNative.View,{style:K.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.poweredByText,{color:c.foregroundMuted,fontFamily:m.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[K.poweredByBold,{color:c.foreground,fontFamily:m.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[K.poweredByBold,{color:c.foreground,fontFamily:m.semibold}],children:"nifold"})]})}function ze(C,L){return jsxRuntime.jsxs(reactNative.View,{style:K.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.detailLabel,{color:c.foregroundMuted,fontFamily:m.regular}],children:C}),jsxRuntime.jsx(reactNative.Text,{style:[K.detailValue,{color:c.foreground,fontFamily:m.medium}],children:L})]},C)}function gt(C,L,O){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[K.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(O).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.txLabel,{color:c.foreground,fontFamily:m.medium}],children:C}),jsxRuntime.jsxs(reactNative.View,{style:K.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.txHash,{color:c.foregroundMuted}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[K.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},C)}function Ke(){let C=Math.max(60-p.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:K.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:K.flex,contentContainerStyle:K.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{se.current||(se.current=true,setTimeout(()=>Ce.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:K.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:K.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.amountDollar,{color:c.foreground,fontSize:C}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ce,value:p,onChangeText:L=>{w(L),Ie(L);},keyboardType:"decimal-pad",style:[K.amountInput,{color:c.foreground,fontSize:C}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),R?jsxRuntime.jsx(reactNative.Text,{style:[K.amountError,{color:c.warning,fontFamily:m.regular}],children:R}):T?jsxRuntime.jsx(reactNative.View,{style:[K.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[K.limitsSubtitle,{color:c.foregroundMuted,fontFamily:m.regular}],children:Ue})]}),jsxRuntime.jsx(reactNative.View,{style:K.quickAmountsRow,children:ZC.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[K.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let O=String(L);w(O),Ie(O);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[K.quickAmountText,{color:c.foreground,fontFamily:m.medium}],children:["$",L]})},L))}),D&&jsxRuntime.jsxs(reactNative.View,{style:[K.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:K.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[K.errorBannerText,{color:c.foreground,fontFamily:m.regular}],children:D})]})]}),jsxRuntime.jsx(reactNative.View,{style:K.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[K.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius,opacity:!Be||S?.4:1}],onPress:Ze,disabled:!Be||S,activeOpacity:.8,children:[S&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:K.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[K.continueButtonText,{color:"#fff",fontFamily:m.medium}],children:S?"Loading...":"Continue"})]})})]})}function _e(){return jsxRuntime.jsxs(reactNative.View,{style:K.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:K.centeredContent,children:[jsxRuntime.jsx(Od,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateTitle,{color:c.foreground,fontFamily:m.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateDescription,{color:c.foregroundMuted,fontFamily:m.regular}],children:`Complete the payment in Cash App.
3
+ This page will update automatically.`}),V>0&&jsxRuntime.jsxs(reactNative.Text,{style:[K.expiryText,{color:V<=30?c.warning:c.foregroundMuted,fontFamily:m.medium}],children:["Expires in ",iS(V)]})]}),jsxRuntime.jsx(reactNative.View,{style:K.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[K.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:Bt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:K.cashAppButtonIcon,children:jsxRuntime.jsx(Od,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[K.continueButtonText,{color:"#fff",fontFamily:m.semibold}],children:"Open Cash App"})]})})]})}function ot(){let C=te==="processing",L=C?"Payment processing":"Payment received",O=C?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:K.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:K.centeredContent,children:[jsxRuntime.jsx(wt,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(Od,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateTitle,{color:c.foreground,fontFamily:m.semibold}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateDescription,{color:c.foregroundMuted,fontFamily:m.regular}],children:O})]})})}function Y(){if(!M)return ot();let C=M,L=["pending","waiting","delayed"].includes(C.status),O=ht(C),H=nS(C.created_at);return jsxRuntime.jsxs(reactNative.View,{style:K.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:K.flex,contentContainerStyle:K.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:K.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:O?jsxRuntime.jsx(reactNative.Image,{source:{uri:O,cache:"force-cache"},style:K.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[K.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[K.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[K.statusBadge,{backgroundColor:L?c.warning:c.success}],children:jsxRuntime.jsx(reactNative.Text,{style:K.statusBadgeText,children:L?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:K.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[K.statusDot,{backgroundColor:L?c.warning:c.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[K.statusText,{color:c.foreground,fontFamily:m.semibold}],children:L?"In Progress":"Completed"})]}),H?jsxRuntime.jsx(reactNative.Text,{style:[K.dateText,{color:c.foregroundMuted,fontFamily:m.regular}],children:H}):null,jsxRuntime.jsxs(reactNative.View,{style:[K.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[ze("Amount Sent",`$${ag(p)} USD`),ze("Amount Received",`${zt(C)} ${Rt(C)}`),C.source_amount_usd?ze("USD Value",`$${parseFloat(C.source_amount_usd).toFixed(2)}`):null,C.source_chain_id?ze("Source Network",lg(C.source_chain_type??"",C.source_chain_id)):null,C.destination_chain_id?ze("Destination Network",lg(C.destination_chain_type??"",C.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:K.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),Ne(U=>!U);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.seeMoreText,{color:c.foreground,fontFamily:m.medium}],children:G?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[K.seeMoreChevron,{color:c.foregroundMuted}],children:G?"\u25B2":"\u25BC"})]}),G&&jsxRuntime.jsxs(reactNative.View,{style:K.txHashSection,children:[C.explorer_url?gt("Deposit Tx",cg(C.transaction_hash),C.explorer_url):null,!L&&C.destination_explorer_url&&C.destination_transaction_hashes?.[0]?gt("Completion Tx",cg(C.destination_transaction_hashes[0]),C.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:K.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[K.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:ye,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[K.continueButtonText,{color:"#fff",fontFamily:m.medium}],children:"Done"})})})]})}function Pe(){return jsxRuntime.jsxs(reactNative.View,{style:K.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:K.centeredContent,children:[jsxRuntime.jsx(Od,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateTitle,{color:c.foreground,fontFamily:m.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[K.stateDescription,{color:c.foregroundMuted,fontFamily:m.regular}],children:["Your session has expired.",`
4
+ `,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:K.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[K.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:le,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[K.continueButtonText,{color:"#fff",fontFamily:m.semibold}],children:"New Cash App session"})})})]})}function _(){return jsxRuntime.jsxs(reactNative.View,{style:K.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:K.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[K.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[K.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateTitle,{color:c.foreground,fontFamily:m.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[K.stateDescription,{color:c.foregroundMuted,fontFamily:m.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:K.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[K.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:le,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[K.continueButtonText,{color:"#fff",fontFamily:m.semibold}],children:"Try Again"})}),sr()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[K.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(Qr,{title:De,showBack:xe,onBack:ge,onClose:ye}),b==="amountInput"&&Ke(),b==="waitingForPayment"&&_e(),b==="paymentReceived"&&ot(),b==="depositComplete"&&Y(),b==="softExpired"&&Pe(),b==="failed"&&_()]})}var K=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var fg=5e3,mg=2500,hg=5e3,gg=6e4;function Sn(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:m,setDepositExecutions:h,setTrackedExecutions:b,setLatestExecution:d,setShowStatusSheet:p,onDepositSuccess:w,onExecutionsChange:R,onDepositError:x}=e,[k,v]=ws.useState(false),[T,I]=ws.useState(false);return ws.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;v(false),t==="auto_ui"&&I(false);let u=setTimeout(()=>{v(true),t==="auto_ui"&&I(true);},fg);return ()=>clearTimeout(u)},[r,t,o,n]),ws.useEffect(()=>{if(!r||!s||!a)return;let u=new Date(a.getTime()-gg),S=setInterval(async()=>{try{let E=[...(await fn(s,i,"deposit")).data??[]].sort((P,M)=>{let W=P.created_at?new Date(P.created_at).getTime():0;return (M.created_at?new Date(M.created_at).getTime():0)-W}),V=null;for(let P of E){let M=P.created_at?new Date(P.created_at):null;if(!M||M<=u)continue;let W=m.get(P.id);if(!W){V=P;break}if(["pending","waiting","delayed"].includes(W)&&P.status==="succeeded"){V=P;break}}if(V){let P=V;h(M=>{let W=M.findIndex(G=>G.id===P.id);if(W>=0){let G=[...M];return G[W]=P,G}return [...M,P]}),b(M=>{let W=new Map(M);return W.set(P.id,P.status),W}),d(P),p(!0),P.status==="succeeded"&&w?.({message:"Deposit completed successfully",executionId:P.id}),R?.([...c,P]);}}catch(y){x?.({message:"Failed to check deposit status",error:y});}},mg);return ()=>clearInterval(S)},[r,s,i,a,m,c,R,w,x]),ws.useEffect(()=>{if(!r||!k||!l)return;let u=async()=>{try{await Hc(l,i);}catch{}};u();let S=setInterval(u,hg);return ()=>clearInterval(S)},[r,k,l,i]),{pollingEnabled:k,showWaitingUi:T,handleIveDeposited:()=>{v(true),I(true);}}}function bg({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(cc,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(ef,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function cc({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=B(),n=ws.useRef(new reactNative.Animated.Value(0)).current;ws.useEffect(()=>{if(e&&!t){n.setValue(0);let i=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Ad.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:s}]},children:jsxRuntime.jsx(Tl,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ad.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function ef({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=B();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Ad.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ad.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var Ad=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Ed(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ne(t||r||e.icon_url)}function pS(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=reactNative.Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var Md=18,zd=12,fS=2;function mS({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),s=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(To,{uri:e,width:r,height:r,borderRadius:10}),s?jsxRuntime.jsxs(reactNative.View,{style:bi.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[bi.badge,bi.backBadge],children:jsxRuntime.jsx(ha,{size:zd})}),jsxRuntime.jsx(reactNative.View,{style:[bi.badge,bi.frontBadge],children:jsxRuntime.jsx(pa,{size:zd})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[bi.badge,bi.singleBadge],children:jsxRuntime.jsx(pa,{size:zd})}):n?jsxRuntime.jsx(reactNative.View,{style:[bi.badge,bi.singleBadge],children:jsxRuntime.jsx(ha,{size:zd})}):null]})}var bi=reactNative.StyleSheet.create({badge:{width:Md,height:Md,borderRadius:Md/2,borderWidth:fS,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function Ud({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,onBack:i,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:m,onLatestExecution:h,onShowStatusSheet:b}){let{colors:d,fonts:p,components:w}=B(),R=ws.useRef(true);ws.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let x=ws.useRef(false),[k,v]=ws.useState("selectWallet"),[T,I]=ws.useState([]),[f,u]=ws.useState(true),[S,y]=ws.useState(null),[D,E]=ws.useState(null),[V,P]=ws.useState(null),[M,W]=ws.useState(null),[G,Ne]=ws.useState(null),[te,$e]=ws.useState([]),[X,de]=ws.useState(false),[$,Q]=ws.useState(null),[ue,Z]=ws.useState([]),[ke,qe]=ws.useState(new Map),[Ce]=ws.useState(()=>new Date),[se,Ye]=ws.useState(null),[He,Je]=ws.useState(false),[tt,Be]=ws.useState(null),[Ue,De]=ws.useState(false);ws.useEffect(()=>{if(k==="depositProcessing"||k==="depositComplete")return;if(k!=="waitingForDeposit"){De(false);return}reactNative.AppState.currentState==="active"&&De(true);let z=reactNative.AppState.addEventListener("change",A=>{A==="active"&&De(true);});return ()=>z.remove()},[k]);let xe=k==="waitingForDeposit"&&Ue||k==="depositProcessing",Ie=M||V||D?.chain_types[0]||o||"ethereum",st=vo(te,Ie),le=st?.address||"",Ze=st?.id??"",pr=`${Ie}:${n||""}`;ws.useEffect(()=>(R.current=true,()=>{R.current=false;}),[]),ws.useEffect(()=>{rt();},[t]),ws.useEffect(()=>{se&&h?.(se);},[se]),ws.useEffect(()=>{m?.(ue);},[ue]);let[Ve,Oe]=ws.useState(false);ws.useEffect(()=>{!He||!se||(Je(false),se.status==="succeeded"?(v("depositComplete"),l?.({message:"Deposit completed successfully",executionId:se.id,transaction:se})):se.status==="failed"||se.status==="refunded"?(v("failed"),c?.({message:`Deposit ${se.status}`,code:se.status})):v("depositProcessing"));},[He,se]),ws.useEffect(()=>{k!=="depositProcessing"||!se||(se.status==="succeeded"?(v("depositComplete"),l?.({message:"Deposit completed successfully",executionId:se.id,transaction:se})):(se.status==="failed"||se.status==="refunded")&&(v("failed"),c?.({message:`Deposit ${se.status}`,code:se.status})));},[se?.status]);let{showWaitingUi:Ae}=Sn({depositConfirmationMode:"auto_ui",enabled:xe,depositAddress:le,chain:pr,externalUserId:e,publishableKey:t,modalOpenedAt:tt??Ce,depositWalletId:Ze,depositExecutions:ue,trackedExecutions:ke,setDepositExecutions:Z,setTrackedExecutions:qe,setLatestExecution:Ye,setShowStatusSheet:Je,onExecutionsChange:m,onDepositError:c});async function rt(){u(true),y(null);try{let z=await Xu(t);if(!R.current)return;let A=z.data.filter(pS),jt=A.map(Ed).filter(Boolean);if(jt.length>0&&await Zl(jt),!R.current)return;I(A);}catch(z){if(!R.current)return;y(z instanceof Error?z.message:"Failed to load wallets");}finally{R.current&&u(false);}}function Me(z){E(z),W(null),Q(null),z.chain_types.length>1?(P(null),v("selectNetwork")):ye(z);}function ge(z){P(z),D&&ye(D,z);}async function ye(z,A){if(x.current)return;x.current=true,de(true),v("connecting");let jt=A||z.chain_types[0]||null;try{let nt=await Eo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:s,recipient_address:r},t);if(!R.current)return;$e(nt.data);let Te=nt.data.map(Cr=>({chain_type:Cr.chain_type,address:Cr.address})),It=jt?Te.filter(Cr=>Cr.chain_type===jt):Te,it=It.length>0,Xe=it?It:Te,Zr=it?jt:Xe[0]?.chain_type??jt;W(Zr??null);let At=await ep(z.id,Xe,t);if(!R.current)return;if(Ne(At),de(!1),!At.supported||!At.deeplink&&!At.pay_url){Q(`${z.name} doesn't support in-app browser on this device`),v("failed");return}let Ur=At.deeplink||At.pay_url;try{await reactNative.Linking.openURL(Ur);}catch{if(!R.current)return;Q(`Could not open ${z.name}. Make sure it is installed.`),v("failed");return}if(!R.current)return;Be(new Date),v("waitingForDeposit");}catch(nt){if(!R.current)return;de(false),Q(nt instanceof Error?nt.message:"Failed to connect wallet"),v("failed");}}function Bt(){if(!G)return;let z=G.deeplink||G.pay_url;reactNative.Linking.openURL(z).catch(()=>{});}function zt(){x.current=false,E(null),P(null),W(null),Ne(null),$e([]),Be(null),Q(null),de(false),v("selectWallet");}function Rt(){return f?jsxRuntime.jsx(reactNative.View,{style:pt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary})}):S?jsxRuntime.jsxs(reactNative.View,{style:pt.centeredContainer,children:[jsxRuntime.jsx(Bi,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[pt.errorTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.errorSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:S}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:rt,style:[pt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[pt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.semibold}],children:"Retry"})})]}):T.length===0?jsxRuntime.jsxs(reactNative.View,{style:pt.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.errorTitle,{color:d.foreground,fontFamily:p.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.errorSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:pt.walletList,contentContainerStyle:pt.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Select a wallet to deposit from"}),T.map(z=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Me(z),activeOpacity:.7,disabled:X,style:[pt.walletRow,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor,opacity:X?.5:1}],children:[jsxRuntime.jsx(mS,{uri:Ed(z),chainTypes:z.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:pt.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.walletName,{color:d.foreground,fontFamily:p.medium}],children:z.name}),jsxRuntime.jsx(reactNative.Text,{style:[pt.walletChains,{color:d.foregroundMuted,fontFamily:p.regular}],children:z.chain_types.map(A=>A.charAt(0).toUpperCase()+A.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(Br,{size:16,color:d.foregroundMuted,strokeWidth:2})]},z.id))]})}function ht(){if(!D)return null;let z=Ed(D),A=D.chain_types.map(jt=>({id:jt,name:jt.charAt(0).toUpperCase()+jt.slice(1),Icon:jt==="ethereum"?pa:ha}));return jsxRuntime.jsxs(reactNative.View,{style:pt.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:pt.networkPickerHeader,children:[jsxRuntime.jsx(To,{uri:z,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[pt.statusTitle,{color:d.foreground,fontFamily:p.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[pt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:["Choose which network to deposit from with ",D.name]})]}),jsxRuntime.jsx(reactNative.View,{style:pt.networkList,children:A.map(({id:jt,name:nt,Icon:Te})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>ge(jt),activeOpacity:.7,disabled:X,style:[pt.networkRow,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor,opacity:X?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:pt.networkIconContainer,children:jsxRuntime.jsx(Te,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[pt.networkName,{color:d.foreground,fontFamily:p.medium}],children:nt}),jsxRuntime.jsx(Br,{size:16,color:d.foregroundMuted,strokeWidth:2})]},jt))})]})}function sr(){return jsxRuntime.jsxs(reactNative.View,{style:pt.centeredContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[pt.statusTitle,{color:d.foreground,fontFamily:p.semibold}],children:["Opening ",D?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[pt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Preparing your deposit session"})]})}function ze(){let z=D?.name??"your wallet",A=D?Ed(D):null;return jsxRuntime.jsxs(reactNative.View,{style:pt.centeredContainer,children:[A?jsxRuntime.jsx(wt,{size:80,children:jsxRuntime.jsx(To,{uri:A,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[pt.statusTitle,{color:d.foreground,fontFamily:p.semibold}],children:["Continue in ",z]}),jsxRuntime.jsx(reactNative.Text,{style:[pt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Bt,activeOpacity:.8,style:[pt.primaryButton,{backgroundColor:d.primary,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:[jsxRuntime.jsx(Yo,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[pt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.semibold}],children:["Open ",z]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(cc,{showWaitingUi:Ae,latestExecution:se})})]})}function gt(z,A){let jt=parseFloat(z)/Math.pow(10,A);return jt===0?"0.00":jt>=1?jt.toFixed(2):parseFloat(jt.toPrecision(6)).toString()}function Ke(z,A){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[A]??`${z.charAt(0).toUpperCase()+z.slice(1)} (${A})`}function _e(z){if(!z)return "";let A=z.indexOf(".");return A!==-1?z.slice(0,A).toUpperCase()+z.slice(A):z.toUpperCase()}function ot(z){return z.length<=12?z:`${z.slice(0,6)}...${z.slice(-4)}`}function Y(z){if(!z)return "";try{return new Date(z).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Pe(z){let A=z.destination_amount_base_unit;return A?gt(A,z.destination_token_metadata?.decimals??6):"\u2014"}function _(z){let A=z.destination_token_metadata;return A?A.icon_urls?.length?Pn(A.icon_urls,"png")??A.icon_url??null:A.icon_url??null:null}function C(){if(!se)return null;let z=_(se);return jsxRuntime.jsx(reactNative.View,{style:Ge.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:Ge.centeredContent,children:[jsxRuntime.jsx(wt,{size:84,strokeWidth:4,iconSize:48,children:z?jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(z)},style:Ge.loaderIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[Ge.loaderIcon,{backgroundColor:d.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Deposit Processing"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:"This usually takes less than a minute."})]})})}function L(){if(!se)return C();let z=se,A=["pending","waiting","delayed"].includes(z.status),jt=_(z),nt=Y(z.created_at);return jsxRuntime.jsxs(reactNative.View,{style:Ge.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:Ge.flex,contentContainerStyle:Ge.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.tokenIconWrapper,children:[jt?jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(jt)},style:Ge.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[Ge.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Ge.statusBadge,{backgroundColor:A?d.warning:w.container.iconBackgroundColor}],children:A?jsxRuntime.jsx(reactNative.Text,{style:Ge.statusBadgeText,children:"\u21BB"}):jsxRuntime.jsx(lt,{size:14,color:w.container.iconColor,strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ge.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ge.statusDot,{backgroundColor:A?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.statusText,{color:d.foreground,fontFamily:p.semibold}],children:A?"In Progress":"Completed"})]}),nt?jsxRuntime.jsx(reactNative.Text,{style:[Ge.dateText,{color:d.foregroundMuted,fontFamily:p.regular}],children:nt}):null,jsxRuntime.jsxs(reactNative.View,{style:[Ge.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[z.source_amount_usd?jsxRuntime.jsxs(reactNative.View,{style:Ge.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ge.detailValue,{color:d.foreground,fontFamily:p.medium}],children:["$",parseFloat(z.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxRuntime.jsxs(reactNative.View,{style:Ge.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ge.detailValue,{color:d.foreground,fontFamily:p.medium}],children:[Pe(z)," ",_e(z.destination_currency)]})]}),z.source_chain_id?jsxRuntime.jsxs(reactNative.View,{style:Ge.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.detailValue,{color:d.foreground,fontFamily:p.medium}],children:Ke(z.source_chain_type??"",z.source_chain_id)})]}):null,z.destination_chain_id?jsxRuntime.jsxs(reactNative.View,{style:Ge.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.detailValue,{color:d.foreground,fontFamily:p.medium}],children:Ke(z.destination_chain_type??"",z.destination_chain_id)})]}):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ge.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),Oe(Te=>!Te);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.seeMoreText,{color:d.foreground,fontFamily:p.medium}],children:Ve?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.seeMoreChevron,{color:d.foregroundMuted}],children:Ve?"\u25B2":"\u25BC"})]}),Ve&&jsxRuntime.jsxs(reactNative.View,{style:Ge.txHashSection,children:[z.explorer_url?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(z.explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.txLabel,{color:d.foreground,fontFamily:p.medium}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ge.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.txHash,{color:d.foregroundMuted}],children:ot(z.transaction_hash)}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!A&&z.destination_explorer_url&&z.destination_transaction_hashes?.[0]?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(z.destination_explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.txLabel,{color:d.foreground,fontFamily:p.medium}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ge.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.txHash,{color:d.foregroundMuted}],children:ot(z.destination_transaction_hashes[0])}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsxRuntime.jsx(reactNative.View,{style:Ge.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[pt.primaryButton,{backgroundColor:d.primary,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],onPress:a,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[pt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.medium}],children:"Done"})})})]})}function O(){return jsxRuntime.jsxs(reactNative.View,{style:pt.centeredContainer,children:[jsxRuntime.jsx(Bi,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[pt.statusTitle,{color:d.foreground,fontFamily:p.semibold}],children:$||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:zt,activeOpacity:.8,style:[pt.primaryButton,{backgroundColor:d.primary,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[pt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.semibold}],children:"Try Again"})})]})}function H(){switch(k){case "selectWallet":return Rt();case "selectNetwork":return ht();case "connecting":return sr();case "waitingForDeposit":return ze();case "depositProcessing":return C();case "depositComplete":return L();case "failed":return O()}}let U=k==="selectWallet"||k==="selectNetwork"||k==="failed",ve=k==="selectNetwork"?D?.name??"Select Network":k==="depositProcessing"?"Deposit Processing":k==="depositComplete"?"Deposit Summary":"Connect Wallet";function me(){k==="selectNetwork"?(x.current=false,E(null),P(null),W(null),v("selectWallet")):i();}return jsxRuntime.jsxs(reactNative.View,{style:pt.container,children:[jsxRuntime.jsx(Qr,{title:ve,showBack:U,onBack:me,onClose:a}),H()]})}var pt=reactNative.StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}}),Ge=reactNative.StyleSheet.create({flex:{flex:1},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},loaderIcon:{width:48,height:48,borderRadius:24},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:24,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:28},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8}});var Ci=7,wi=4,Ka=4;function SS(e,t,r){return e<Ci&&t<Ci||e<Ci&&t>=r-Ci||e>=r-Ci&&t<Ci}function cs({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=B(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",m=n||l,h=ws.useMemo(()=>{try{return CS__default.default(e||"placeholder","H")}catch{return null}},[e]),b=h?h.length:0,d=b?(t-wi*2)/b:0,p=d*.38,w=o+12,R=w/2+4,x=t/2,k=t/2,v=b?[{x:wi,y:wi},{x:wi+(b-Ci)*d,y:wi},{x:wi,y:wi+(b-Ci)*d}]:[],T=Ci*d,I=5*d,f=d,u=3*d,S=2*d;return jsxRuntime.jsxs(reactNative.View,{style:[sf.container,{width:t,height:t}],children:[jsxRuntime.jsxs(or__default.default,{width:t,height:t,children:[jsxRuntime.jsx(or.Rect,{x:0,y:0,width:t,height:t,fill:l}),h?.map((y,D)=>y.map((E,V)=>{if(!E||SS(D,V,b))return null;let P=wi+V*d+d/2,M=wi+D*d+d/2;if(r){let W=P-x,G=M-k;if(Math.sqrt(W*W+G*G)<R)return null}return jsxRuntime.jsx(or.Circle,{cx:P,cy:M,r:p,fill:c},`${D}-${V}`)})),v.map((y,D)=>jsxRuntime.jsxs(ws__namespace.default.Fragment,{children:[jsxRuntime.jsx(or.Rect,{x:y.x,y:y.y,width:T,height:T,rx:Ka,ry:Ka,fill:c}),jsxRuntime.jsx(or.Rect,{x:y.x+f,y:y.y+f,width:I,height:I,rx:Ka-1,ry:Ka-1,fill:l}),jsxRuntime.jsx(or.Rect,{x:y.x+S,y:y.y+S,width:u,height:u,rx:Ka-1.5,ry:Ka-1.5,fill:c})]},`finder-${D}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[sf.logoContainer,{width:w,height:w,top:k-w/2,left:x-w/2,backgroundColor:m,borderRadius:w/2}],children:[jsxRuntime.jsx(To,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[sf.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:m}],children:jsxRuntime.jsx(To,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var sf=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var RS=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ya=(e,t)=>`${t}:${e}`,IS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function $d({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:m="auto_ui",onExecutionsChange:h,onDepositSuccess:b,onDepositError:d,onLatestExecution:p,onShowStatusSheet:w,onSelectedTokenIconUrl:R,borderTopLeftRadius:x,borderTopRightRadius:k,sheetBorderRadius:v}){let{colors:T,fonts:I,components:f}=B(),u=a&&l?`${a}:${l}`:"solana:mainnet",[S,y]=ws.useState("USDC"),[D,E]=ws.useState(u),[V,P]=ws.useState([]),[M,W]=ws.useState(true),[G,Ne]=ws.useState([]),[te,$e]=ws.useState(true),[X,de]=ws.useState(false),[$,Q]=ws.useState(false),[ue,Z]=ws.useState(false),[ke,qe]=ws.useState(false),[Ce,se]=ws.useState([]),[Ye,He]=ws.useState(new Map),[Je]=ws.useState(()=>new Date),[tt,Be]=ws.useState(null),[Ue,De]=ws.useState(false),[xe,Ie]=ws.useState(null),[st,le]=ws.useState(false);ws.useEffect(()=>{xe&&p?.(xe);},[xe]),ws.useEffect(()=>{Ue&&(w?.(true),De(false));},[Ue]);let Ze=new Map;G.forEach(_=>{_.chains.forEach(C=>{let L=`${C.chain_type}:${C.chain_id}`;Ze.has(L)||Ze.set(L,C);});});let pr=Array.from(Ze.values()),Ve=IS(D),Ae=pr.find(_=>_.chain_type===Ve.chainType&&_.chain_id===Ve.chainId)?.chain_type||"ethereum",rt=vo(V,Ae),Me=rt?.address||"",ge=ws.useRef(false);ws.useEffect(()=>{async function _(){try{$e(!0),Be(null);let L=await ai(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Ne(L.data),L.data.length>0&&!ge.current){ge.current=!0;let O,H;if(a&&l)if(c)for(let U of L.data){let ve=U.chains.find(me=>me.chain_type===a&&me.chain_id===l&&me.token_address.toLowerCase()===c.toLowerCase());if(ve){O=U,H=ve;break}}else {let U=me=>me.chain_type===a&&me.chain_id===l,ve=L.data.find(me=>me.symbol==="USDC"&&me.chains.some(U));if(ve)O=ve,H=ve.chains.find(U);else for(let me of L.data){let z=me.chains.find(U);if(z){O=me,H=z;break}}}if(!O&&s)for(let U of L.data){let ve=U.chains.find(me=>me.token_address.toLowerCase()===s.toLowerCase());if(ve){O=U,H=ve;break}}O||(O=L.data.find(U=>U.symbol==="USDC"),O&&O.chains.length>0&&(H=O.chains[0])),O||(O=L.data.find(U=>U.symbol==="USDT"),O&&O.chains.length>0&&(H=O.chains[0])),O||(O=L.data[0],O.chains.length>0&&(H=O.chains[0])),O&&y(O.symbol),H&&E(Ya(H.chain_id,H.chain_type));}}catch(C){console.error("Error fetching supported tokens:",C),Be("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:C});}finally{$e(false);}}_();},[t,d,a,l,c,s,n,o]),ws.useEffect(()=>{async function _(){try{W(!0),Be(null);let C=await Eo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);P(C.data);}catch(C){console.error("Error fetching wallets:",C),Be("Failed to load wallets"),d?.({message:"Failed to load wallets",error:C});}finally{W(false);}}_();},[e,r,o,n,s,t,d]);let ye=rt?.id??"",{showWaitingUi:Bt,handleIveDeposited:zt}=Sn({depositConfirmationMode:m,depositAddress:Me,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:Je,depositWalletId:ye,depositExecutions:Ce,trackedExecutions:Ye,setDepositExecutions:se,setTrackedExecutions:He,setLatestExecution:Ie,setShowStatusSheet:De,onDepositSuccess:b,onExecutionsChange:h,onDepositError:d});ws.useEffect(()=>{if(!G.length)return;let _=G.find(L=>L.symbol===S);if(!_||_.chains.length===0){let L=G.find(O=>O.symbol==="USDC")||G[0];L&&(y(L.symbol),L.chains.length>0&&E(Ya(L.chains[0].chain_id,L.chains[0].chain_type)));return}if(!_.chains.some(L=>Ya(L.chain_id,L.chain_type)===D)){let L=_.chains[0];E(Ya(L.chain_id,L.chain_type));}},[S,G,D]);let Rt=G.find(_=>_.symbol===S),ht=We(Rt,"png")||void 0;ws.useEffect(()=>{R?.(ht);},[ht]);let sr=Rt?.chains||[],ze=sr.find(_=>Ya(_.chain_id,_.chain_type)===D),gt=async()=>{if(Me)try{reactNative.Clipboard.setString(Me),de(!0),setTimeout(()=>de(!1),2e3);}catch(_){console.error("Failed to copy:",_);}},Ke=ze?.estimated_price_impact_percent??0,_e=ze?.max_slippage_percent??.25,ot=ze?.minimum_deposit_amount_usd??3;if(te)return jsxRuntime.jsxs(reactNative.View,{style:q.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[q.loadingText,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Loading currencies..."})]});if(tt&&G.length===0)return jsxRuntime.jsxs(reactNative.View,{style:q.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.errorText,{color:T.error,fontFamily:I.regular}],children:tt}),jsxRuntime.jsx(reactNative.Text,{style:[q.errorHint,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Please check your network connection and try again."})]});let Y=()=>jsxRuntime.jsxs(Wt,{visible:ue,onClose:()=>Z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[q.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[q.sheetTitle,{color:f.header.titleColor,fontFamily:I.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Z(false),style:q.sheetCloseButton,children:jsxRuntime.jsx(Tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Dt,{style:q.sheetList,contentContainerStyle:q.sheetListContent,showsVerticalScrollIndicator:false,children:G.map(_=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{y(_.symbol),Z(false);},activeOpacity:.7,style:[q.sheetItem,{backgroundColor:S===_.symbol?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(_,"png"))},style:q.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:q.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.sheetItemTitle,{color:f.card.titleColor,fontFamily:I.medium}],children:_.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[q.sheetItemSubtitle,{color:f.card.subtitleColor,fontFamily:I.regular}],children:[_.chains.length," network",_.chains.length!==1?"s":""," available"]})]}),S===_.symbol&&jsxRuntime.jsx(lt,{size:20,color:T.primary,strokeWidth:2})]},_.symbol))})]}),Pe=()=>jsxRuntime.jsxs(Wt,{visible:ke,onClose:()=>qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:v?.chainSelector?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[q.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[q.sheetTitle,{color:f.header.titleColor,fontFamily:I.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qe(false),style:q.sheetCloseButton,children:jsxRuntime.jsx(Tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Dt,{style:q.sheetList,contentContainerStyle:q.sheetListContent,showsVerticalScrollIndicator:false,children:sr.map(_=>{let C=Ya(_.chain_id,_.chain_type),L=D===C;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{E(C),qe(false);},activeOpacity:.7,style:[q.sheetItem,{backgroundColor:L?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(_,"png"))},style:q.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:q.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.sheetItemTitle,{color:f.card.titleColor,fontFamily:I.medium}],children:_.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[q.sheetItemSubtitle,{fontFamily:I.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:f.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:T.warning},children:["$",_.minimum_deposit_amount_usd]})]})]}),L&&jsxRuntime.jsx(lt,{size:20,color:T.primary,strokeWidth:2})]},C)})})]});return jsxRuntime.jsxs(reactNative.View,{style:q.container,children:[jsxRuntime.jsxs(reactNative.View,{style:q.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.selectorLabel,{color:f.card.labelColor,fontFamily:I.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Z(true),style:[q.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[Rt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(Rt,"png"))},style:q.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[q.selectorText,{color:f.card.titleColor,fontFamily:I.medium}],children:S}),jsxRuntime.jsx(ar,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:q.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[q.selectorLabel,{color:f.card.labelColor,fontFamily:I.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[q.minDeposit,{color:T.warning,fontFamily:I.regular}],children:["($",ot," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qe(true),style:[q.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[ze&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(ze,"png"))},style:q.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[q.selectorText,{color:f.card.titleColor,fontFamily:I.medium}],numberOfLines:1,children:ze?.chain_name||"Select network"}),jsxRuntime.jsx(ar,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[q.intentAddressLabel,{color:T.foregroundMuted,fontFamily:I.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:q.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[q.qrWrapper,{backgroundColor:T.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:M?jsxRuntime.jsxs(reactNative.View,{style:q.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[q.loadingText,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Loading..."})]}):Me?jsxRuntime.jsx(cs,{value:Me,size:160,logoUri:ne(We(ze,"png")||er("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:q.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[q.errorText,{color:T.error,fontFamily:I.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:gt,disabled:M||!Me,style:q.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.addressTruncated,{color:T.foregroundMuted,fontFamily:I.regular}],numberOfLines:1,children:M?"Loading...":Me?RS(Me):"No address"}),X?jsxRuntime.jsx(lt,{size:16,color:T.success,strokeWidth:2}):jsxRuntime.jsx(dn,{size:16,color:T.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(cc,{showWaitingUi:Bt,latestExecution:xe}),jsxRuntime.jsxs(reactNative.View,{style:[q.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Q(!$),style:q.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.detailsLabel,{color:f.card.titleColor,fontFamily:I.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:q.chevronContainer,children:$?jsxRuntime.jsx(_n,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(ar,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),$&&jsxRuntime.jsxs(reactNative.View,{style:q.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(un,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[q.detailsLabel,{color:f.card.titleColor,fontFamily:I.regular}],children:["Price impact: ",Ke.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(pn,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Co,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[q.detailsLabel,{color:f.card.titleColor,fontFamily:I.regular}],children:["Slippage: Auto \u2022 ",_e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(pn,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[q.detailsLabel,{color:f.card.titleColor,fontFamily:I.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(pn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.detailsLabel,{color:T.primary,fontFamily:I.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(ef,{depositConfirmationMode:m,depositAddress:Me,showWaitingUi:Bt,onIveDeposited:zt}),Y(),Pe(),jsxRuntime.jsxs(Wt,{visible:st,onClose:()=>le(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[q.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[q.sheetTitle,{color:f.header.titleColor,fontFamily:I.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(false),style:q.sheetCloseButton,children:jsxRuntime.jsx(Tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[q.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[q.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(un,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardTitle,{color:f.card.titleColor,fontFamily:I.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[q.infoCardValue,{color:f.card.titleColor,fontFamily:I.medium}],children:[Ke.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardDescription,{color:f.card.descriptionColor,fontFamily:I.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[q.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[q.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Co,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardTitle,{color:f.card.titleColor,fontFamily:I.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[q.infoCardValue,{color:f.card.titleColor,fontFamily:I.medium}],children:[_e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardDescription,{color:f.card.descriptionColor,fontFamily:I.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var q=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function qd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=B();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ns.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ns.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ns.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(e,"png"))},style:Ns.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ns.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ns.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ns.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(lt,{size:16,color:o.primary,strokeWidth:2})]})}var Ns=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function uc({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=B();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Fg.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Fg.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(qd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Fg=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Kd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:c,components:m}=B(),[h,b]=ws.useState(""),d=o.map(T=>r.find(I=>I.currency_code.toLowerCase()===T.toLowerCase())).filter(T=>T!==void 0),p=r.filter(T=>!o.includes(T.currency_code.toLowerCase())),w=T=>{if(!h)return T;let I=h.toLowerCase();return T.filter(f=>f.name.toLowerCase().includes(I)||f.currency_code.toLowerCase().includes(I))},R=w(d),x=w(p),k=T=>{s(T),t(false),b("");},v=()=>{t(false),b("");};return jsxRuntime.jsxs(Wt,{visible:e,onClose:v,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(Qr,{title:"Currency",showBack:false,onClose:v}),jsxRuntime.jsx(reactNative.View,{style:Hs.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Hs.searchInput,{backgroundColor:m.search.backgroundColor,color:m.search.inputColor,fontFamily:c.regular,borderRadius:m.input.borderRadius,borderWidth:m.input.borderWidth,borderColor:m.input.borderColor}],value:h,onChangeText:b,placeholder:"Search",placeholderTextColor:m.search.placeholderColor})}),jsxRuntime.jsx(Dt,{style:Hs.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Hs.listContent,children:[jsxRuntime.jsx(uc,{title:"Popular currencies",currencies:R,selectedCurrency:n,onSelect:k}),R.length>0&&x.length>0&&jsxRuntime.jsx(reactNative.View,{style:Hs.sectionSpacer}),jsxRuntime.jsx(uc,{title:"All currencies",currencies:x,selectedCurrency:n,onSelect:k}),R.length===0&&x.length===0&&jsxRuntime.jsx(reactNative.View,{style:Hs.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Hs.noResultsText,{color:m.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Hs=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function uf(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 Jd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:m,onExecutionsChange:h,onLatestExecution:b,onShowStatusSheet:d,onSelectedTokenIconUrl:p,borderTopLeftRadius:w,borderTopRightRadius:R,sheetBorderRadius:x}){let{colors:k,fonts:v,components:T}=B(),[I,f]=ws.useState(""),[u,S]=ws.useState("usd"),[y,D]=ws.useState(false),[E,V]=ws.useState(false),[P,M]=ws.useState([]),[W,G]=ws.useState(false),[Ne,te]=ws.useState(null),[$e,X]=ws.useState(null),[de,$]=ws.useState("amount"),[Q,ue]=ws.useState(null),[Z,ke]=ws.useState(true),[qe,Ce]=ws.useState(null),[se,Ye]=ws.useState(false),He=ws.useRef(null),Je=ws.useRef(false);ws.useEffect(()=>{He.current=Q;},[Q]),ws.useEffect(()=>{Je.current=se;},[se]);let[tt,Be]=ws.useState([]),[Ue,De]=ws.useState(true),[xe,Ie]=ws.useState(60),[st,le]=ws.useState([]),[Ze,pr]=ws.useState([]),[Ve,Oe]=ws.useState(null),[Ae,rt]=ws.useState(null),[Me,ge]=ws.useState(true),[ye,Bt]=ws.useState(null),[zt,Rt]=ws.useState(false),[ht,sr]=ws.useState(null),[ze,gt]=ws.useState(false),[Ke,_e]=ws.useState(false),[ot,Y]=ws.useState(false),[Pe,_]=ws.useState(null),C=r??de,L=ws.useRef(null),O=st.find(he=>he.currency_code.toLowerCase()===u.toLowerCase()),H=ws.useCallback(he=>{$(he),he==="quotes"?o?.(he,P.length):o?.(he);},[P.length,o]);ws.useEffect(()=>{async function he(){try{let Qe=await Dl();rt(Qe);}catch(Qe){console.error("Error fetching user IP:",Qe);}finally{ge(false);}}he();},[]),ws.useEffect(()=>{async function he(){try{let Qe=await Eo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);Be(Qe.data);}catch(Qe){console.error("Error fetching wallets:",Qe),te("Failed to load wallet addresses");}finally{De(false);}}he();},[e,s,i,a,l,t]);let U=n||Ve?.symbol.toUpperCase()||"USDC",ve=Pn(Ve?.icon_urls,"png")||Ve?.icon_url,me=Pn(Ve?.chain_icon_urls,"png")||Ve?.chain_icon_url,[z,A]=ws.useState([]),[jt,nt]=ws.useState(new Map),[Te]=ws.useState(()=>new Date),[It,it]=ws.useState(null),[Xe,Zr]=ws.useState(false),[At,Ur]=ws.useState(null);ws.useEffect(()=>{C==="onramp"&&!At&&Ur(new Date);},[C,At]);let Cr=ye?.destination_token_metadata?.chain_type||i||"ethereum",oa=ye?.destination_token_metadata?.chain_id||a||"",oi=`${Cr}:${oa}`,Pc=vo(tt,Cr),Ts=Pc?.address||"",Fc=Pc?.id??"";ws.useEffect(()=>{It&&b?.(It);},[It]),ws.useEffect(()=>{Xe&&(d?.(true),Zr(false));},[Xe]),ws.useEffect(()=>{p?.(ve||void 0);},[ve]),ws.useEffect(()=>{h?.(z);},[z]),Sn({depositConfirmationMode:"auto_silent",enabled:C==="onramp",depositAddress:Ts,chain:oi,externalUserId:e,publishableKey:t,modalOpenedAt:At??Te,depositWalletId:Fc,depositExecutions:z,trackedExecutions:jt,setDepositExecutions:A,setTrackedExecutions:nt,setLatestExecution:it,setShowStatusSheet:Zr,onDepositSuccess:c,onExecutionsChange:h,onDepositError:m}),ws.useEffect(()=>{async function he(){try{let Qe=await Pl(t);le(Qe.data),pr(Qe.preferred||[]);}catch(Qe){console.error("Error fetching fiat currencies:",Qe);}}he();},[t]),ws.useEffect(()=>{if(y||st.length===0||!Ae?.alpha2)return;let he=Ae.alpha2.toUpperCase(),Qe=st.find(Tr=>Tr.country_codes.includes(he));if(Qe)S(Qe.currency_code.toLowerCase()),!I&&!E&&f(String(Qe.default_amount??100));else if(!I&&!E){let Tr=st.find(In=>In.currency_code.toLowerCase()==="usd");Tr&&f(String(Tr.default_amount??100));}},[st,Ae,y,I,E]),ws.useEffect(()=>{if(st.length!==0){if(L.current!==null&&L.current!==u){let he=st.find(Qe=>Qe.currency_code.toLowerCase()===u.toLowerCase());he&&f(String(he.default_amount??100));}L.current=u;}},[u,st]),ws.useEffect(()=>{async function he(){try{let Qe=await Hu({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Oe(Qe);}catch(Qe){console.error("Error fetching supported tokens:",Qe);}}he();},[i,a,l,t]),ws.useEffect(()=>{async function he(){if(!(!l||!a||!i)&&!Me){Rt(true);try{let Qe=await qu({country_code:Ae?.alpha2?.toUpperCase()||"US",subdivision_code:Ae?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Bt(Qe);}catch(Qe){console.error("Error fetching default onramp token:",Qe);}finally{Rt(false);}}}he();},[l,a,i,Ae,Me,t]),ws.useEffect(()=>{let he=parseFloat(I);if(isNaN(he)||he<=0){M([]),X(null);return}if(!ye||zt){M([]),ue(null);return}let Qe=st.find(In=>In.currency_code.toLowerCase()===u.toLowerCase());if(Qe){if(he<Qe.minimum_amount){M([]),ue(null),X(`Minimum amount is ${uf(u)}${Qe.minimum_amount.toLocaleString()}`);return}if(he>Qe.maximum_amount){M([]),ue(null),X(`Maximum amount is ${uf(u)}${Qe.maximum_amount.toLocaleString()}`);return}}X(null);let Tr=setTimeout(()=>{ks(he);},500);return ()=>clearTimeout(Tr)},[I,u,t,ye,zt,st]);let ks=async he=>{if(!ye){te("Loading token information...");return}G(true),te(null);try{let Qe={country_code:Ae?.alpha2?.toUpperCase()||"US",source_amount:he.toString(),source_currency:u.toLowerCase(),destination_currency:ye.destination_currency,destination_network:ye.destination_network,subdivision_code:Ae?.state||void 0},Tr=await ju(Qe,t);M(Tr.data);let In=Je.current,Vc=He.current;if(In&&Vc){let Oi=Tr.data.find(F=>F.service_provider===Vc.service_provider);if(Oi){if(ue(Oi),Tr.data.length>0){let F=Tr.data[0];qe||Ce(F.service_provider),ke(Oi.service_provider===qe);}}else if(Tr.data.length>0){let F=Tr.data[0];ue(F),Ce(F.service_provider),ke(!0),Ye(!1);}}else if(Tr.data.length>0){let Oi=Tr.data[0];ue(Oi),Ce(Oi.service_provider),ke(!0);}Ie(60);}catch(Qe){console.error("Failed to fetch quotes:",Qe),te("Failed to fetch quotes. Please try again."),M([]);}finally{G(false);}};ws.useEffect(()=>{if(P.length===0)return;let he=setInterval(()=>{Ie(Qe=>{if(Qe<=1){let Tr=parseFloat(I);return !isNaN(Tr)&&Tr>0&&ks(Tr),60}return Qe-1});},1e3);return ()=>clearInterval(he)},[P.length,I]);let Dc=he=>{(/^\d*\.?\d{0,2}$/.test(he)||he==="")&&(f(he),V(true));},na=he=>{f(he.toString()),V(true);},Fu=async()=>{if(Q&&ye)try{let he=ye.destination_token_metadata.chain_type,Qe=vo(tt,he);if(!Qe?.address){te("Wallet address not available");return}let Tr={service_provider:Q.service_provider,country_code:Q.country_code?.toUpperCase()||Ae?.alpha2?.toUpperCase()||"US",source_currency:Q.source_currency,source_amount:I,destination_currency:Q.destination_currency,destination_network:Q.destination_network,wallet_address:Qe.address,subdivision_code:Ae?.state||void 0},In=await $u(Tr,t);sr({provider:Q,sourceCurrency:u,sourceAmount:I,sessionUrl:In.url}),_(In.url),Y(!0);}catch(he){console.error("Failed to create session:",he),te("Failed to start payment flow"),m?.({message:"Failed to start payment flow",error:he});}},Vi=uf(u),bl=()=>{Y(false),H("onramp"),c?.({message:"Payment flow completed"});},Du=()=>jsxRuntime.jsx(US,{visible:ot,onClose:bl,url:Pe,providerName:Q?.service_provider_display_name||"Complete Payment",colors:k,fonts:v,borderTopLeftRadius:x?.webView?.borderTopLeftRadius??w,borderTopRightRadius:x?.webView?.borderTopRightRadius??R});return C==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ae.amountViewContainer,children:[jsxRuntime.jsxs(Dt,{style:ae.scrollContainer,contentContainerStyle:ae.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:ae.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>gt(true),style:[ae.currencyButton,{backgroundColor:T.card.backgroundColor,borderRadius:T.input.borderRadius,borderWidth:T.input.borderWidth,borderColor:T.input.borderColor}],children:[O&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(O,"png"))},style:ae.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ae.currencyText,{color:T.card.titleColor,fontFamily:v.medium}],children:u.toUpperCase()}),jsxRuntime.jsx(ar,{size:16,color:T.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Kd,{open:ze,onOpenChange:gt,currencies:st,preferredCurrencyCodes:Ze,selectedCurrency:u,onSelectCurrency:he=>{S(he.toLowerCase()),D(true);},borderTopLeftRadius:x?.currencyModal?.borderTopLeftRadius??w,borderTopRightRadius:x?.currencyModal?.borderTopRightRadius??R}),jsxRuntime.jsx(reactNative.View,{style:ae.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:ae.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.currencySymbol,{color:T.container.titleColor,fontFamily:v.medium}],children:Vi}),jsxRuntime.jsx(reactNative.TextInput,{style:[ae.amountInput,{color:T.container.titleColor,fontFamily:v.medium}],value:I,onChangeText:Dc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:k.foregroundMuted})]})}),O?.suggested_amounts&&O.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:ae.quickAmounts,children:O.suggested_amounts.map(he=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>na(he),style:[ae.quickAmountButton,{backgroundColor:T.card.backgroundColor,borderRadius:T.button.borderRadius,borderWidth:parseFloat(I)===he?2:T.button.borderWidth,borderColor:parseFloat(I)===he?k.primary:T.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ae.quickAmountText,{color:T.card.titleColor,fontFamily:v.medium}],children:[Vi,he.toLocaleString()]})},he))}),$e&&jsxRuntime.jsx(reactNative.Text,{style:[ae.validationError,{color:k.error,fontFamily:v.regular}],children:$e}),jsxRuntime.jsxs(reactNative.View,{style:ae.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.providerLabel,{color:T.card.labelColor,fontFamily:v.medium}],children:"Provider"}),P.length>0&&!W&&jsxRuntime.jsxs(reactNative.Text,{style:[ae.refreshText,{color:T.card.labelRightColor,fontFamily:v.regular}],children:["Refreshing in ",xe,"s"]})]}),jsxRuntime.jsx(Vr,{cardTokens:T.depositCard.quoteProvider.card,onPress:W||P.length===0?void 0:()=>_e(true),contentStyle:reactNative.StyleSheet.flatten([ae.providerButton,(W||P.length===0)&&ae.disabled]),children:W?jsxRuntime.jsxs(reactNative.View,{style:ae.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ae.loadingText,{color:T.container.subtitleColor,fontFamily:v.regular}],children:"Finding best rates..."})]}):Q?jsxRuntime.jsxs(reactNative.View,{style:ae.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.providerInfo,children:[Z&&jsxRuntime.jsx(reactNative.Text,{style:[ae.autoPickedText,{color:T.container.subtitleColor,fontFamily:v.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:ae.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(jc(Q.icon_urls,"png",Q.icon_url))},style:ae.providerIconImage},`provider-${Q.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.providerName,{color:T.card.titleColor,fontFamily:v.medium}],children:Q.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.bestPriceText,{color:T.container.subtitleColor,fontFamily:v.regular}],children:[Q.destination_amount.toFixed(2)," ",U]})]})]})]}),jsxRuntime.jsx(Br,{size:20,color:T.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[ae.noProviderText,{color:T.container.subtitleColor,fontFamily:v.regular}],children:parseFloat(I)>0?"No providers available":"Enter an amount to see providers"})}),Ne&&jsxRuntime.jsx(reactNative.Text,{style:[ae.errorText,{color:k.error,fontFamily:v.regular}],children:Ne})]}),jsxRuntime.jsxs(Wt,{visible:Ke,onClose:()=>_e(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:x?.providerModal?.borderTopLeftRadius??w,borderTopRightRadius:x?.providerModal?.borderTopRightRadius??R,children:[jsxRuntime.jsx(Qr,{title:"Select Provider",showBack:false,onClose:()=>_e(false)}),jsxRuntime.jsx(Dt,{style:ae.providerModalList,contentContainerStyle:ae.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:ae.quotesList,children:P.map(he=>{let Qe=Q?.service_provider===he.service_provider;return jsxRuntime.jsxs(Vr,{cardTokens:T.depositCard.quoteProvider.card,onPress:()=>{ue(he),Ye(true),ke(he.service_provider===qe),_e(false);},contentStyle:reactNative.StyleSheet.flatten([ae.quoteItem,Qe&&{borderWidth:2,borderColor:k.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:ae.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(jc(he.icon_urls,"png",he.icon_url))},style:ae.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[ae.quoteName,{color:T.card.titleColor,fontFamily:v.medium}],children:he.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ae.quoteAmount,{color:T.card.textRightColor,fontFamily:v.medium}],children:[he.destination_amount.toFixed(2)," ",U]}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.quoteSource,{color:T.card.subtextRightColor,fontFamily:v.regular}],children:["Fee: ",Vi,he.total_fee.toFixed(2)]})]})]},he.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ae.continueButtonContainer,{backgroundColor:k.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:W||Ue||!Q||parseFloat(I)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Fu,disabled:W||Ue||!Q||parseFloat(I)<=0,style:[ae.continueButton,{backgroundColor:T.container.buttonColor,borderRadius:T.button.borderRadius,borderWidth:T.button.borderWidth,borderColor:T.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ae.continueButtonText,{color:T.container.buttonTitleColor,fontFamily:v.medium}],children:Ue?"Loading...":"Continue"})})})})]}),Du()]}):C==="onramp"&&ht?jsxRuntime.jsxs(reactNative.View,{style:ae.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(jc(ht.provider.icon_urls,"png",ht.provider.icon_url))},style:ae.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.onrampTitle,{color:T.container.titleColor,fontFamily:v.medium}],children:["Complete transaction with ",ht.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.onrampSubtitle,{color:T.container.subtitleColor,fontFamily:v.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[ae.flowDiagram,{backgroundColor:T.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ae.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:er(`/icons/currencies/png/${ht.sourceCurrency.toLowerCase()}.png`)},style:ae.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[ae.flowLabel,{color:T.card.subtitleColor,fontFamily:v.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[ae.flowValue,{color:T.card.titleColor,fontFamily:v.medium}],children:ht.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Br,{size:16,color:T.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ae.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Pn(ye?.destination_token_metadata?.icon_urls,"png")||ye?.destination_token_metadata?.icon_url||er("/icons/tokens/png/usdc.png")},style:ae.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Pn(ye?.destination_token_metadata?.chain?.icon_urls,"png")||ye?.destination_token_metadata?.chain?.icon_url||er("/icons/networks/png/polygon.png")},style:[ae.flowNetworkBadge,{borderColor:k.background,borderRadius:T.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.flowLabel,{color:T.card.subtitleColor,fontFamily:v.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[ae.flowValue,{color:T.card.titleColor,fontFamily:v.medium}],children:"USDC"})]}),jsxRuntime.jsx(Br,{size:16,color:T.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ae.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ve||er("/icons/tokens/png/usdc.png")},style:ae.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:me||er("/icons/networks/png/polygon.png")},style:[ae.flowNetworkBadge,{borderColor:k.background,borderRadius:T.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.flowLabel,{color:T.card.subtitleColor,fontFamily:v.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[ae.flowValue,{color:T.card.titleColor,fontFamily:v.medium}],children:U})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ae.onrampInfoBox,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ae.onrampInfoText,{color:T.card.descriptionColor,fontFamily:v.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 US({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(Wt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:js.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:js.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(lt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[js.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:js.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:js.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:js.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:js.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var js=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),ae=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function $S(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 qS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function eu({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=B(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ne(We(e.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),c=i?"Deposit Processing":"Deposit Completed",m=$S(e.created_at||new Date().toISOString()),h=qS(e.source_amount_usd);return jsxRuntime.jsxs(Vr,{cardTokens:s,onPress:t,contentStyle:ki.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ki.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:ki.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ki.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ki.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ki.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[ki.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:m})]}),jsxRuntime.jsxs(reactNative.View,{style:ki.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ki.amount,{color:s.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(Br,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var ki=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Lg(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 Bg(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 KS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Ag=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Wg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function GS(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 YS({count:e=4}){let{colors:t,components:r}=B(),o=ws.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return ws.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:$s.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[$s.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:$s.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var $s=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function mf({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=B(),[l,c]=ws.useState(r),[m,h]=ws.useState(false),[b,d]=ws.useState(null),[p,w]=ws.useState(false),R=ws.useRef(null);ws.useEffect(()=>{if(!e||!o)return;let u=async()=>{h(true);try{let D=[...(await fn(o,n,"deposit")).data].sort((E,V)=>{let P=E.created_at?new Date(E.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-P});c(D);}catch(y){console.error("Failed to fetch executions:",y),c(r);}finally{h(false);}};u();let S=setInterval(u,1e4);return ()=>clearInterval(S)},[e,o,n,r]),ws.useEffect(()=>{r.length>0&&c(u=>{let S=new Set(u.map(D=>D.id)),y=r.filter(D=>!S.has(D.id));return y.length>0?[...y,...u]:u});},[r]),ws.useEffect(()=>{e||d(null);},[e]);let x=u=>{d(u);},k=()=>{d(null),w(false);},v=()=>{d(null),t();},T=()=>{if(!b)return null;let u=b,S=u.status==="pending"||u.status==="waiting"||u.status==="delayed",y=u.status==="succeeded",D=ne(We(u.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),E=u.provider_metadata?.details,V=E?.currencyIn,P=E?.currencyOut;V?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let G=Bg(u.source_amount_base_unit,u.source_token_metadata?.decimals),Ne=Bg(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),te=KS(u.source_amount_usd),$e=Lg(u.source_chain_type,u.source_chain_id),X=Lg(u.destination_chain_type,u.destination_chain_id),de=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},$=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(Dt,{ref:R,style:je.scrollContainer,contentContainerStyle:je.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:je.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:je.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:D},style:je.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[je.statusBadge,{backgroundColor:S?s.warning:s.success,borderColor:s.background}],children:S?jsxRuntime.jsx(ar,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(lt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:je.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[je.statusDot,{backgroundColor:S?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[je.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:S?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[je.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:GS(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[je.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[G," ",Wg(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[je.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Ne," ",Wg(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[je.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:te})]}),jsxRuntime.jsx(reactNative.View,{style:[je.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:$e})]}),jsxRuntime.jsx(reactNative.View,{style:[je.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:X})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Q=!p;w(Q),Q?setTimeout(()=>{R.current?.scrollToEnd({animated:true});},100):R.current?.scrollTo({y:0,animated:true});},style:je.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:p?"See less":"See more details"}),p?jsxRuntime.jsx(_n,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(ar,{size:14,color:a.container.actionColor,strokeWidth:2})]}),p&&jsxRuntime.jsxs(reactNative.View,{style:[je.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:de,style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:je.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ag(u.transaction_hash)}),jsxRuntime.jsx(Yo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[je.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&y&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:$,style:je.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:je.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ag(u.destination_transaction_hashes[0])}),jsxRuntime.jsx(Yo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},I=m&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qr,{title:b?"Deposit Details":"Deposit Tracker",onClose:v,showClose:!b,showBack:!!b,onBack:k}),b?T():I?jsxRuntime.jsx(YS,{}):jsxRuntime.jsx(Dt,{style:je.scrollContainer,contentContainerStyle:je.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:je.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[je.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[je.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:je.executionsList,children:l.map(u=>jsxRuntime.jsx(eu,{execution:u,onPress:()=>x(u)},u.id))})})]})}var je=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function pc(e,t=true){let[r,o]=ws.useState(null),[n,s]=ws.useState(null),[i,a]=ws.useState(false),[l,c]=ws.useState(false),[m,h]=ws.useState(null),[b,d]=ws.useState(null);ws.useEffect(()=>{!t||r||(a(true),Dl().then(x=>{o(x),h(null);}).catch(x=>{h(x instanceof Error?x:new Error(String(x)));}).finally(()=>{a(false);}));},[t,r]),ws.useEffect(()=>{!t||!e||n||(c(true),Fl(e).then(x=>{s(x),d(null);}).catch(x=>{d(x instanceof Error?x:new Error(String(x)));}).finally(()=>{c(false);}));},[t,e,n]);let p=i||l,w=m||b||null,R=null;if(r&&n){let x=n.blocked_country_codes||[],k=r.alpha2.toUpperCase();R=!x.some(v=>v.toUpperCase()===k);}return {isAllowed:R,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:p,error:w}}var yf="unifold_recent_tokens",tT=5,Hg=[{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 iu(){try{let e=await kp__default.default.getItem(yf);return e?JSON.parse(e):[]}catch{return []}}async function rT(e){try{let r=(await iu()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,tT);await kp__default.default.setItem(yf,JSON.stringify(o));}catch{}}async function oT(e){try{let r=(await iu()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await kp__default.default.setItem(yf,JSON.stringify(r)),r}catch{return []}}function bf({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:m=.9,showHandle:h=true}){let{colors:b,fonts:d,components:p}=B(),[w,R]=ws.useState(""),[x,k]=ws.useState([]);ws.useEffect(()=>{e&&iu().then(k);},[e]),ws.useEffect(()=>{e||R("");},[e]);let v=ws.useMemo(()=>{let y=[];return r.forEach(D=>{D.chains.forEach(E=>{y.push({token:D,chain:E});});}),y},[r]),T=ws.useMemo(()=>{let y=[],D=new Set,E=(V,P,M,W)=>{let G=`${V}-${P}:${M}`;if(D.has(G))return;let Ne=r.find($e=>$e.symbol===V);if(!Ne)return;let te=Ne.chains.find($e=>$e.chain_type===P&&$e.chain_id===M);te&&(D.add(G),y.push({token:Ne,chain:te,isRecent:W}));};return x.forEach(V=>{E(V.symbol,V.chainType,V.chainId,true);}),Hg.forEach(V=>{E(V.symbol,V.chainType,V.chainId,false);}),y},[r,x]),I=ws.useMemo(()=>{if(!w.trim())return v;let y=w.toLowerCase();return v.filter(({token:D,chain:E})=>D.symbol.toLowerCase().includes(y)||D.name.toLowerCase().includes(y)||E.chain_name.toLowerCase().includes(y))},[v,w]),f=(y,D,E)=>Hg.some(V=>V.symbol===y&&V.chainType===D&&V.chainId===E),u=async(y,D)=>{let E=`${D.chain_type}:${D.chain_id}`;if(!f(y.symbol,D.chain_type,D.chain_id)){await rT({symbol:y.symbol,chainType:D.chain_type,chainId:D.chain_id});let V=await iu();k(V);}R(""),s(y.symbol,E),t();},S=async(y,D)=>{let E=await oT({symbol:y.symbol,chainType:D.chain_type,chainId:D.chain_id});k(E);};return jsxRuntime.jsxs(Wt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:h,heightPercent:m,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[Yt.header,!h&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:Yt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.headerTitle,{color:p.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Yt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Yt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Yt.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:d.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],placeholder:"Search",placeholderTextColor:p.search.placeholderColor,value:w,onChangeText:R,autoCapitalize:"none",autoCorrect:false})}),!l&&T.length>0&&!w&&jsxRuntime.jsxs(reactNative.View,{style:Yt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Yt.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Yt.quickSelectScroll,children:T.map(({token:y,chain:D,isRecent:E})=>{let V=`${D.chain_type}:${D.chain_id}`;y.symbol===o&&V===n;return jsxRuntime.jsxs(reactNative.View,{children:[E&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>S(y,D),style:Yt.removeButton,children:jsxRuntime.jsx(Tt,{size:12,color:b.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(y,D),activeOpacity:.7,style:[Yt.quickSelectItem,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Yt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(y,"png"))},style:Yt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(D,"png"))},style:[Yt.quickSelectChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Yt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Yt.quickSelectSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.quickSelectChain,{color:p.card.subtitleColor,fontFamily:d.regular}],children:D.chain_name})]})]})]},`quick-${y.symbol}-${V}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Dt,{style:Yt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Yt.tokenListContent,children:I.length===0?jsxRuntime.jsx(reactNative.View,{style:Yt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Yt.emptyText,{color:b.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):I.map(({token:y,chain:D})=>{let E=`${D.chain_type}:${D.chain_id}`,V=y.symbol===o&&E===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(y,D),activeOpacity:.7,style:[Yt.tokenItem,{backgroundColor:V?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Yt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(y,"png"))},style:Yt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(D,"png"))},style:[Yt.tokenChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Yt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Yt.tokenSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.tokenChainName,{color:p.card.subtitleColor,fontFamily:d.regular}],children:D.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Yt.minDeposit,{color:p.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:p.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",D.minimum_deposit_amount_usd]})]})]},`${y.symbol}-${E}`)})})]})}var Yt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var fc=(e,t)=>`${t}:${e}`,lT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function wf({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:m="auto_ui",onExecutionsChange:h,onDepositSuccess:b,onDepositError:d,onLatestExecution:p,onShowStatusSheet:w,onSelectedTokenIconUrl:R,wallets:x,borderTopLeftRadius:k,borderTopRightRadius:v,sheetBorderRadius:T}){let{colors:I,fonts:f,components:u}=B(),S=a&&l?`${a}:${l}`:"solana:mainnet",[y,D]=ws.useState("USDC"),[E,V]=ws.useState(S),[P,M]=ws.useState([]),[W,G]=ws.useState(!x?.length),Ne=x?.length?x:P,[te,$e]=ws.useState([]),[X,de]=ws.useState(true),[$,Q]=ws.useState(false),[ue,Z]=ws.useState(false),[ke,qe]=ws.useState(false),[Ce,se]=ws.useState([]),[Ye,He]=ws.useState(new Map),[Je]=ws.useState(()=>new Date),[tt,Be]=ws.useState(null),[Ue,De]=ws.useState(false),[xe,Ie]=ws.useState(null),[st,le]=ws.useState(false);ws.useEffect(()=>{xe&&p?.(xe);},[xe]),ws.useEffect(()=>{Ue&&(w?.(true),De(false));},[Ue]);let Ze=new Map;te.forEach(Y=>{Y.chains.forEach(Pe=>{let _=`${Pe.chain_type}:${Pe.chain_id}`;Ze.has(_)||Ze.set(_,Pe);});});let pr=Array.from(Ze.values()),Ve=lT(E),Oe=pr.find(Y=>Y.chain_type===Ve.chainType&&Y.chain_id===Ve.chainId),Ae=Oe?.chain_type||"ethereum",rt=vo(Ne,Ae),Me=rt?.address||"",ge=ws.useRef(false);ws.useEffect(()=>{async function Y(){try{de(!0),Be(null);let _=await ai(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if($e(_.data),_.data.length>0&&!ge.current){ge.current=!0;let C,L;if(a&&l)if(c)for(let O of _.data){let H=O.chains.find(U=>U.chain_type===a&&U.chain_id===l&&U.token_address.toLowerCase()===c.toLowerCase());if(H){C=O,L=H;break}}else {let O=U=>U.chain_type===a&&U.chain_id===l,H=_.data.find(U=>U.symbol==="USDC"&&U.chains.some(O));if(H)C=H,L=H.chains.find(O);else for(let U of _.data){let ve=U.chains.find(O);if(ve){C=U,L=ve;break}}}if(!C&&s)for(let O of _.data){let H=O.chains.find(U=>U.token_address.toLowerCase()===s.toLowerCase());if(H){C=O,L=H;break}}C||(C=_.data.find(O=>O.symbol==="USDC"),C&&C.chains.length>0&&(L=C.chains[0])),C||(C=_.data.find(O=>O.symbol==="USDT"),C&&C.chains.length>0&&(L=C.chains[0])),C||(C=_.data[0],C.chains.length>0&&(L=C.chains[0])),C&&D(C.symbol),L&&V(fc(L.chain_id,L.chain_type));}}catch(Pe){console.error("Error fetching supported tokens:",Pe),Be("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Pe});}finally{de(false);}}Y();},[t,s,n,o,a,l,c,d]),ws.useEffect(()=>{h&&h(Ce);},[Ce,h]),ws.useEffect(()=>{if(x?.length){G(false);return}if(P.length>0){G(false);return}let Y=null,Pe=false,_=async()=>{if(!Pe){G(true);try{let C=await Eo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Pe||(M(C.data),Be(null),G(!1));}catch(C){console.error("Error fetching wallets, retrying in 5s:",C),Pe||(Be(C instanceof Error?C.message:"Failed to load wallets"),G(false),Y=setTimeout(_,5e3));}}};return _(),()=>{Pe=true,Y&&clearTimeout(Y);}},[e,r,o,n,s,t,x,P.length]);let ye=rt?.id??"",{showWaitingUi:Bt,handleIveDeposited:zt}=Sn({depositConfirmationMode:m,depositAddress:Me,chain:E,externalUserId:e,publishableKey:t,modalOpenedAt:Je,depositWalletId:ye,depositExecutions:Ce,trackedExecutions:Ye,setDepositExecutions:se,setTrackedExecutions:He,setLatestExecution:Ie,setShowStatusSheet:De,onDepositSuccess:b,onExecutionsChange:h,onDepositError:d});ws.useEffect(()=>{if(!te.length)return;let Y=te.find(_=>_.symbol===y);if(!Y||Y.chains.length===0){let _=te.find(C=>C.symbol==="USDC")||te[0];_&&(D(_.symbol),_.chains.length>0&&V(fc(_.chains[0].chain_id,_.chains[0].chain_type)));return}if(!Y.chains.some(_=>fc(_.chain_id,_.chain_type)===E)){let _=Y.chains[0];V(fc(_.chain_id,_.chain_type));}},[y,te,E]);let Rt=te.find(Y=>Y.symbol===y),ht=We(Rt,"png")||void 0;ws.useEffect(()=>{R?.(ht);},[ht]);let ze=(Rt?.chains||[]).find(Y=>fc(Y.chain_id,Y.chain_type)===E),gt=async()=>{if(Me)try{reactNative.Clipboard.setString(Me),Q(!0),setTimeout(()=>Q(!1),2e3);}catch(Y){console.error("Failed to copy:",Y);}},Ke=ze?.estimated_price_impact_percent??0,_e=ze?.max_slippage_percent??.25,ot=ze?.minimum_deposit_amount_usd??3;return X?jsxRuntime.jsxs(reactNative.View,{style:ie.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ie.loadingText,{color:I.foregroundMuted,fontFamily:f.regular}],children:"Loading currencies..."})]}):tt&&te.length===0?jsxRuntime.jsxs(reactNative.View,{style:ie.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.errorText,{color:I.error,fontFamily:f.regular}],children:tt}),jsxRuntime.jsx(reactNative.Text,{style:[ie.errorHint,{color:I.foregroundMuted,fontFamily:f.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ie.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.selectorLabel,{color:u.card.labelColor,fontFamily:f.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>qe(true),disabled:X||te.length===0,style:[ie.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:X?jsxRuntime.jsxs(reactNative.View,{style:ie.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.loadingIcon,{backgroundColor:I.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:ie.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.loadingLine,{backgroundColor:I.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[ie.loadingLine,{backgroundColor:I.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ie.tokenIconWrapper,children:[Rt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(Rt,"png"))},style:ie.tokenMainIcon}),(ze||Oe)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(ze||Oe,"png"))},style:[ie.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:f.semibold}],children:Rt?.symbol||y}),jsxRuntime.jsx(reactNative.Text,{style:[ie.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:f.regular}],numberOfLines:1,children:ze?.chain_name||Oe?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ie.minDepositText,{color:I.warning,fontFamily:f.medium}],children:["$",ot," minimum"]}),jsxRuntime.jsx(Br,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(bf,{visible:ke,onClose:()=>qe(false),tokens:te,selectedToken:y,selectedChainKey:E,onSelect:(Y,Pe)=>{D(Y),V(Pe);},borderTopLeftRadius:T?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:T?.tokenSelector?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:ie.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ie.qrWrapper,{backgroundColor:I.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:W?jsxRuntime.jsxs(reactNative.View,{style:ie.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ie.loadingText,{color:I.foregroundMuted,fontFamily:f.regular}],children:"Loading..."})]}):Me?jsxRuntime.jsx(cs,{value:Me,size:180,logoUri:ne(We(ze,"png")||er("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:ie.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ie.errorText,{color:I.error,fontFamily:f.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:ie.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.addressLabel,{color:u.card.labelColor,fontFamily:f.medium}],children:"Deposit Address"}),$&&jsxRuntime.jsxs(reactNative.View,{style:ie.copiedIndicator,children:[jsxRuntime.jsx(lt,{size:14,color:I.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ie.copiedText,{color:I.success,fontFamily:f.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Vr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!W&&Me?gt:void 0,contentStyle:ie.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.addressText,{color:u.card.titleColor,fontFamily:f.regular}],numberOfLines:2,children:W?"Loading...":Me||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:ie.addressCopyIcon,children:jsxRuntime.jsx(dn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ie.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Z(!ue),style:ie.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.detailsLabel,{color:u.card.titleColor,fontFamily:f.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ie.chevronContainer,children:ue?jsxRuntime.jsx(_n,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(ar,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),ue&&jsxRuntime.jsxs(reactNative.View,{style:ie.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(un,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.detailsLabel,{color:u.card.titleColor,fontFamily:f.regular}],children:["Price impact: ",Ke.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(pn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Co,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.detailsLabel,{color:u.card.titleColor,fontFamily:f.regular}],children:["Slippage: Auto \u2022 ",_e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(pn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.detailsLabel,{color:u.card.titleColor,fontFamily:f.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(bg,{depositConfirmationMode:m,depositAddress:Me,showWaitingUi:Bt,latestExecution:xe,onIveDeposited:zt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:ie.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[ie.termsText,{color:I.primary,fontFamily:f.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Wt,{visible:st,onClose:()=>le(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:T?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:T?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[ie.sheetHeader,{borderBottomColor:I.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ie.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ie.sheetTitle,{color:u.header.titleColor,fontFamily:f.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(false),style:ie.sheetCloseButton,children:jsxRuntime.jsx(Tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ie.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ie.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(un,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.infoCardTitle,{color:u.card.titleColor,fontFamily:f.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.infoCardValue,{color:u.card.titleColor,fontFamily:f.medium}],children:[Ke.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.infoCardDescription,{color:u.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."})]}),jsxRuntime.jsxs(reactNative.View,{style:[ie.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ie.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Co,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.infoCardTitle,{color:u.card.titleColor,fontFamily:f.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.infoCardValue,{color:u.card.titleColor,fontFamily:f.medium}],children:[_e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.infoCardDescription,{color:u.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."})]})]})]})]})}var ie=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Xa=(e,t)=>`${t}:${e}`,fT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},mT=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function lu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:m="auto_ui",onExecutionsChange:h,onDepositSuccess:b,onDepositError:d,onLatestExecution:p,onShowStatusSheet:w,onSelectedTokenIconUrl:R,onShowInfoSheet:x,onInfoSheetData:k,wallets:v,borderTopLeftRadius:T,borderTopRightRadius:I,sheetBorderRadius:f}){let{colors:u,fonts:S,components:y}=B(),D=a&&l?`${a}:${l}`:"solana:mainnet",[E,V]=ws.useState("USDC"),[P,M]=ws.useState(D),[W,G]=ws.useState([]),[Ne,te]=ws.useState(!v?.length),$e=v?.length?v:W,[X,de]=ws.useState([]),[$,Q]=ws.useState(true),[ue,Z]=ws.useState(false),[ke,qe]=ws.useState(false),[Ce,se]=ws.useState(false),[Ye,He]=ws.useState([]),[Je,tt]=ws.useState(new Map),[Be]=ws.useState(()=>new Date),[Ue,De]=ws.useState(null),[xe,Ie]=ws.useState(false),[st,le]=ws.useState(null),[Ze,pr]=ws.useState(false),[Ve,Oe]=ws.useState(false),[Ae,rt]=ws.useState(""),[Me,ge]=ws.useState(""),ye=ws.useRef(new reactNative.Animated.Value(0)).current;ws.useEffect(()=>{let Te=reactNative.Animated.loop(reactNative.Animated.timing(ye,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Te.start(),()=>Te.stop()},[ye]);let Bt=ye.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});ws.useEffect(()=>{st&&p?.(st);},[st]),ws.useEffect(()=>{xe&&(w?.(true),Ie(false));},[xe]);let zt=new Map;X.forEach(Te=>{Te.chains.forEach(It=>{let it=`${It.chain_type}:${It.chain_id}`;zt.has(it)||zt.set(it,It);});});let Rt=Array.from(zt.values()),ht=fT(P),sr=Rt.find(Te=>Te.chain_type===ht.chainType&&Te.chain_id===ht.chainId),ze=sr?.chain_type||"ethereum",gt=vo($e,ze),Ke=gt?.address||"",_e=ws.useRef(false);ws.useEffect(()=>{async function Te(){try{Q(!0),De(null);let it=await ai(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(de(it.data),it.data.length>0&&!_e.current){_e.current=!0;let Xe,Zr;if(a&&l)if(c)for(let At of it.data){let Ur=At.chains.find(Cr=>Cr.chain_type===a&&Cr.chain_id===l&&Cr.token_address.toLowerCase()===c.toLowerCase());if(Ur){Xe=At,Zr=Ur;break}}else {let At=Cr=>Cr.chain_type===a&&Cr.chain_id===l,Ur=it.data.find(Cr=>Cr.symbol==="USDC"&&Cr.chains.some(At));if(Ur)Xe=Ur,Zr=Ur.chains.find(At);else for(let Cr of it.data){let oa=Cr.chains.find(At);if(oa){Xe=Cr,Zr=oa;break}}}if(!Xe&&s)for(let At of it.data){let Ur=At.chains.find(Cr=>Cr.token_address.toLowerCase()===s.toLowerCase());if(Ur){Xe=At,Zr=Ur;break}}Xe||(Xe=it.data.find(At=>At.symbol==="USDC"),Xe&&Xe.chains.length>0&&(Zr=Xe.chains[0])),Xe||(Xe=it.data.find(At=>At.symbol==="USDT"),Xe&&Xe.chains.length>0&&(Zr=Xe.chains[0])),Xe||(Xe=it.data[0],Xe.chains.length>0&&(Zr=Xe.chains[0])),Xe&&V(Xe.symbol),Zr&&M(Xa(Zr.chain_id,Zr.chain_type));}}catch(It){console.error("Error fetching supported tokens:",It),De("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:It});}finally{Q(false);}}Te();},[t,s,n,o,a,l,c,d]),ws.useEffect(()=>{h&&h(Ye);},[Ye,h]),ws.useEffect(()=>{if(v?.length){te(false);return}if(W.length>0){te(false);return}let Te=null,It=false,it=async()=>{if(!It){te(true);try{let Xe=await Eo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);It||(G(Xe.data),De(null),te(!1));}catch(Xe){console.error("Error fetching wallets, retrying in 5s:",Xe),It||(De(Xe instanceof Error?Xe.message:"Failed to load wallets"),te(false),Te=setTimeout(it,5e3));}}};return it(),()=>{It=true,Te&&clearTimeout(Te);}},[e,r,o,n,s,t,v,W.length]);let ot=gt?.id??"",{showWaitingUi:Y,handleIveDeposited:Pe}=Sn({depositConfirmationMode:m,depositAddress:Ke,chain:P,externalUserId:e,publishableKey:t,modalOpenedAt:Be,depositWalletId:ot,depositExecutions:Ye,trackedExecutions:Je,setDepositExecutions:He,setTrackedExecutions:tt,setLatestExecution:le,setShowStatusSheet:Ie,onDepositSuccess:b,onExecutionsChange:h,onDepositError:d}),_=m==="manual"&&Ke&&!Y;ws.useEffect(()=>{if(!X.length)return;let Te=X.find(it=>it.symbol===E);if(!Te||Te.chains.length===0){let it=X.find(Xe=>Xe.symbol==="USDC")||X[0];it&&(V(it.symbol),it.chains.length>0&&M(Xa(it.chains[0].chain_id,it.chains[0].chain_type)));return}if(!Te.chains.some(it=>Xa(it.chain_id,it.chain_type)===P)){let it=Te.chains[0];M(Xa(it.chain_id,it.chain_type));}},[E,X,P]);let C=X.find(Te=>Te.symbol===E),L=We(C,"png")||void 0;ws.useEffect(()=>{R?.(L);},[L]);let O=C?.chains||[],H=O.find(Te=>Xa(Te.chain_id,Te.chain_type)===P),U=async()=>{if(Ke)try{reactNative.Clipboard.setString(Ke),Z(!0),setTimeout(()=>Z(!1),2e3);}catch(Te){console.error("Failed to copy:",Te);}},ve=H?.estimated_price_impact_percent??0,me=H?.max_slippage_percent??.25,z=H?.minimum_deposit_amount_usd??3,A=H?.chain_name||sr?.chain_name||"Network",jt=ws.useMemo(()=>{if(!Ae.trim())return O;let Te=Ae.toLowerCase();return O.filter(It=>It.chain_name.toLowerCase().includes(Te))},[O,Ae]),nt=ws.useMemo(()=>{if(!Me.trim())return X;let Te=Me.toLowerCase();return X.filter(It=>It.symbol.toLowerCase().includes(Te)||It.name?.toLowerCase().includes(Te)||It.chains.some(it=>it.chain_name.toLowerCase().includes(Te)))},[X,Me]);return $?jsxRuntime.jsxs(reactNative.View,{style:ce.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ce.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading currencies..."})]}):Ue&&X.length===0?jsxRuntime.jsxs(reactNative.View,{style:ce.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.errorText,{color:u.error,fontFamily:S.regular}],children:Ue}),jsxRuntime.jsx(reactNative.Text,{style:[ce.errorHint,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ce.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.content,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.intentAddressLabel,{color:u.foregroundMuted,fontFamily:S.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[ce.qrCard,{backgroundColor:u.background,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth>0?y.card.borderWidth:1,borderColor:y.card.borderColor}],children:Ne?jsxRuntime.jsxs(reactNative.View,{style:ce.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ce.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading..."})]}):Ke?jsxRuntime.jsx(reactNative.View,{style:ce.qrWrapper,children:jsxRuntime.jsx(cs,{value:Ke,size:200,logoUri:ne(We(C,"png")||er("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ne(We(H,"png")||er("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:ce.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.errorText,{color:u.error,fontFamily:S.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:ce.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{rt(""),Oe(true);},style:[ce.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[(H||sr)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(H||sr,"png"))},style:ce.selectorPillIcon}),jsxRuntime.jsx(ar,{size:14,color:y.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{ge(""),se(true);},disabled:$||X.length===0,style:[ce.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[C&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(C,"png"))},style:ce.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ce.selectorPillText,{color:y.card.titleColor,fontFamily:S.semibold}],children:C?.symbol||E}),jsxRuntime.jsx(ar,{size:14,color:y.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:ce.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:U,style:[ce.addressPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.addressPillText,{color:y.card.titleColor,fontFamily:S.regular}],numberOfLines:1,children:Ne?"Loading...":Ke?mT(Ke):"No address"}),ue?jsxRuntime.jsx(lt,{size:14,color:u.success,strokeWidth:2}):jsxRuntime.jsx(dn,{size:14,color:y.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:Y&&!st?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:Bt}]},children:jsxRuntime.jsx(Tl,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:S.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k?.({priceImpact:ve,maxSlippage:me,minDepositUsd:z,chainName:A}),x?.(true);},style:ce.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(pn,{size:14,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[ce.infoFooterText,{color:y.card.subtitleColor,fontFamily:S.regular}],numberOfLines:1,children:["$",z," ",A," Minimum and ","<","1 min Processing"]})]}),_?jsxRuntime.jsxs(reactNative.View,{style:ce.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:ce.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Pe,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:S.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:ce.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:U,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.ctaText,{color:u.foreground,fontFamily:S.semibold}],children:ue?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:U,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.ctaText,{color:"#FFFFFF",fontFamily:S.semibold}],children:ue?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(Wt,{visible:Ce,onClose:()=>{se(false),ge("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:f?.tokenSelector?.borderTopLeftRadius??T,borderTopRightRadius:f?.tokenSelector?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[ce.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ce.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{se(false),ge("");},style:ce.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Tt,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ce.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ce.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:y.search.placeholderColor,value:Me,onChangeText:ge,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Dt,{style:ce.sheetList,contentContainerStyle:ce.sheetListContent,showsVerticalScrollIndicator:false,children:nt.length===0?jsxRuntime.jsx(reactNative.View,{style:ce.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No tokens found"})}):nt.map(Te=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(Te.symbol),se(false),ge("");},activeOpacity:.7,style:[ce.sheetItem,{backgroundColor:E===Te.symbol?y.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(Te,"png"))},style:ce.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ce.sheetItemTitle,{color:y.card.titleColor,fontFamily:S.medium}],children:Te.symbol}),jsxRuntime.jsx(reactNative.View,{style:ce.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[ce.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ce.sheetItemBadgeText,{color:y.card.subtitleColor,fontFamily:S.medium}],children:[Te.chains.length," chain",Te.chains.length!==1?"s":""]})})]},Te.symbol))})]}),jsxRuntime.jsxs(Wt,{visible:Ve,onClose:()=>{Oe(false),rt("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:f?.chainSelector?.borderTopLeftRadius??T,borderTopRightRadius:f?.chainSelector?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[ce.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ce.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Oe(false),rt("");},style:ce.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Tt,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ce.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ce.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search networks",placeholderTextColor:y.search.placeholderColor,value:Ae,onChangeText:rt,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Dt,{style:ce.sheetList,contentContainerStyle:ce.sheetListContent,showsVerticalScrollIndicator:false,children:jt.length===0?jsxRuntime.jsx(reactNative.View,{style:ce.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No networks found"})}):jt.map(Te=>{let It=Xa(Te.chain_id,Te.chain_type),it=P===It;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{M(It),Oe(false),rt("");},activeOpacity:.7,style:[ce.chainItem,{backgroundColor:it?y.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(Te,"png"))},style:ce.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:ce.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.chainItemName,{color:y.card.titleColor,fontFamily:S.medium}],children:Te.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[ce.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ce.chainMinBadgeText,{color:u.warning,fontFamily:S.medium}],children:["$",Te.minimum_deposit_amount_usd," Minimum"]})})]},It)})})]})]})}var ce=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Zg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function yT(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function du({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,execution:a,onClose:l,borderTopLeftRadius:c,borderTopRightRadius:m,useModal:h,heightProcessing:b,heightCompleted:d,heightCompletedExpanded:p}){let{components:w}=B(),[R,x]=ws.useState(false),k=t==="succeeded";return jsxRuntime.jsx(Wt,{visible:e,onClose:l,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:k?R?p??d??.55:d??.55:b??.4,borderTopLeftRadius:c,borderTopRightRadius:m,useModal:h,children:jsxRuntime.jsxs(reactNative.View,{style:Jt.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Jt.closeButton,onPress:l,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tt,{size:20,color:w.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Jt.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:Jt.scrollContent,children:jsxRuntime.jsx(wT,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,execution:a,showDetails:R,onToggleDetails:()=>x(!R)})})]})})}function Xg(e,t){if(!e||t===void 0||t===null)return null;let r=Number(e)/10**t;return Number.isFinite(r)?r.toLocaleString(void 0,{maximumFractionDigits:6}):null}function ey(e){return e?e.charAt(0).toUpperCase()+e.slice(1):null}function bT(e){if(!e)return [];let t=[],r=Xg(e.source_amount_base_unit,e.source_token_metadata?.decimals);r&&t.push({label:"Sent",value:e.source_currency?`${r} ${e.source_currency}`:r});let o=Xg(e.destination_amount_base_unit,e.destination_token_metadata?.decimals);if(o&&t.push({label:"Received",value:e.destination_currency?`${o} ${e.destination_currency}`:o}),e.source_amount_usd){let i=parseFloat(e.source_amount_usd);Number.isFinite(i)&&t.push({label:"USD value",value:`$${i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`});}let n=ey(e.source_chain_type);n&&t.push({label:"Source network",value:n});let s=ey(e.destination_chain_type);return s&&t.push({label:"Destination network",value:s}),t}function wT({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:s,execution:i,showDetails:a,onToggleDetails:l,containerStyle:c}){let{colors:m,fonts:h,components:b}=B(),[d,p]=ws.useState(false),w=a??d,R=l??(()=>p(u=>!u)),x=e==="pending"||e==="waiting"||e==="delayed",k=e==="succeeded",v=bT(i),T=v.length>0||!!r||!!o,I=()=>{r&&reactNative.Linking.openURL(r);},f=()=>{o&&reactNative.Linking.openURL(o);};return jsxRuntime.jsxs(reactNative.View,{style:[Jt.container,c],children:[jsxRuntime.jsx(reactNative.View,{style:Jt.iconContainer,children:x?jsxRuntime.jsx(wt,{size:80,strokeWidth:4,iconSize:56,children:t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(t)},style:Jt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Jt.tokenIconFill,{backgroundColor:m.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(t)},style:Jt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Jt.tokenIconLarge,{backgroundColor:m.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Jt.statusBadge,{backgroundColor:b.container.iconBackgroundColor}],children:jsxRuntime.jsx(lt,{size:16,color:b.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.title,{color:b.container.titleColor,fontFamily:h.semibold}],children:x?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Jt.amount,{color:b.container.titleColor,fontFamily:h.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[Jt.date,{color:b.container.subtitleColor,fontFamily:h.regular}],children:yT(n)}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.subtitle,{color:b.container.subtitleColor,fontFamily:h.regular}],children:x?"This usually takes less than a minute.":"Your account has been credited successfully!"}),k&&T&&jsxRuntime.jsxs(reactNative.View,{style:Jt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Jt.divider,{backgroundColor:m.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Jt.detailsToggle,onPress:R,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.detailsToggleText,{color:b.container.actionTitle,fontFamily:h.medium}],children:w?"See less":"See more details"}),w?jsxRuntime.jsx(_n,{size:18,color:b.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(ar,{size:18,color:b.container.actionColor,strokeWidth:2})]}),w&&v.length>0&&jsxRuntime.jsx(reactNative.View,{style:Jt.detailRows,children:v.map(u=>jsxRuntime.jsxs(reactNative.View,{style:Jt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.detailRowLabel,{color:b.container.subtitleColor,fontFamily:h.regular}],children:u.label}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.detailRowValue,{color:b.container.titleColor,fontFamily:h.medium}],children:u.value})]},u.label))}),w&&jsxRuntime.jsxs(reactNative.View,{style:Jt.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Jt.txButton,{backgroundColor:b.card.backgroundColor,borderColor:m.border}],onPress:I,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.txLabel,{color:b.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.txHash,{color:b.card.subtitleColor,fontFamily:h.regular}],children:Zg(r)}),jsxRuntime.jsx(Yo,{size:16,color:b.card.actionColor,strokeWidth:2})]}),o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Jt.txButton,{backgroundColor:b.card.backgroundColor,borderColor:m.border}],onPress:f,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.txLabel,{color:b.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.txHash,{color:b.card.subtitleColor,fontFamily:h.regular}],children:Zg(o)}),jsxRuntime.jsx(Yo,{size:16,color:b.card.actionColor,strokeWidth:2})]})]})]})]})}var Jt=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},detailRows:{width:"100%",gap:10,marginTop:12},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12},detailRowLabel:{fontSize:14},detailRowValue:{fontSize:14,flexShrink:1,textAlign:"right"},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 Cf({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:m,components:h}=B(),b=[{icon:jsxRuntime.jsx(mo,{size:14,color:h.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(un,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(un,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(Co,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(Wt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:an.container,children:[jsxRuntime.jsxs(reactNative.View,{style:an.header,children:[jsxRuntime.jsxs(reactNative.View,{style:an.titleRow,children:[jsxRuntime.jsx(pn,{size:16,color:h.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[an.title,{color:h.header.titleColor,fontFamily:m.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:an.closeButton,children:jsxRuntime.jsx(Tt,{size:18,color:h.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:an.rows,children:[b.map((d,p)=>jsxRuntime.jsxs(reactNative.View,{style:an.row,children:[jsxRuntime.jsx(reactNative.View,{style:[an.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:d.icon}),jsxRuntime.jsx(reactNative.Text,{style:[an.label,{color:h.card.titleColor,fontFamily:m.regular}],children:d.label})]},p)),jsxRuntime.jsxs(reactNative.View,{style:an.row,children:[jsxRuntime.jsx(reactNative.View,{style:[an.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:14,color:h.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[an.label,{color:h.card.titleColor,fontFamily:m.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var an=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var Rn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function RT(){let{colors:e,components:t}=B(),r=ws.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ws.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[fs.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:fs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:fs.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:fs.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var fs=reactNative.StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function IT({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=B(),s=({tab:i,label:a,glyph:l})=>{let c=e===i,m=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:mc.item,activeOpacity:.8,onPress:()=>t(i),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[mc.badge,{backgroundColor:m}],children:jsxRuntime.jsx(reactNative.Text,{style:[mc.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[mc.label,{color:m,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[mc.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(s,{tab:"crypto",label:Rn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(s,{tab:"cash",label:Rn.tabs.cash,glyph:"$"})]})}var mc=reactNative.StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function _T({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,defaultChainType:m,defaultChainId:h,defaultTokenAddress:b,showBalance:d=false,hideDepositTracker:p=false,enableCashApp:w=false,enableConnectWallet:R,enableStripeLinkPay:x=false,StripeOnrampComponent:k,stripeOnrampEmail:v,stripeOnrampPhone:T,stripeMerchantIdentifier:I,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:u,stripeTheme:S,depositConfirmationMode:y="auto_ui",transferInputVariant:D="double_input",depositMenuDisplay:E="stacked",initialScreen:V="main",onDepositSuccess:P,onDepositError:M,sheetBorderRadius:W}){let G=W?.globalBorderTopLeftRadius,Ne=W?.globalBorderTopRightRadius,{colors:te,fonts:$e}=B(),[X,de]=ws.useState([]),[$,Q]=ws.useState(null),[ue,Z]=ws.useState("amount"),[ke,qe]=ws.useState(false),[Ce,se]=ws.useState(null),[Ye,He]=ws.useState(void 0),[Je,tt]=ws.useState(false),[Be,Ue]=ws.useState(null),De=R??$?.connect_wallet?.enabled??false,xe=V==="tracker"&&!p?"tracker":V==="transfer"?"transfer":V==="card"?"card":V==="cashapp"&&w?"cashapp":V==="wallet"&&De?"wallet":"main",[Ie,st]=ws.useState(xe==="main"),[le,Ze]=ws.useState(xe),[pr,Ve]=ws.useState("crypto"),{isAllowed:Oe,isLoading:Ae}=pc(o,e);ws.useEffect(()=>{if(!e||$)return;let H=false;return Fl(o).then(async U=>{if(H)return;let ve=[];for(let me of U?.transfer_crypto?.networks??[]){let z=me.icon_urls.find(A=>A.format==="png")?.url||me.icon_urls.find(A=>A.format==="svg")?.url;z&&ve.push(ne(z));}for(let me of U?.payment_networks?.networks??[]){let z=me.icon_urls.find(A=>A.format==="png")?.url||me.icon_urls.find(A=>A.format==="svg")?.url;z&&ve.push(ne(z));}ve.length>0&&await Zl(ve),H||Q(U);}).catch(console.error),()=>{H=true;}},[e,$,o]);let rt=()=>{t();},Me=ws.useRef(false);ws.useEffect(()=>{e&&!Me.current&&(Ze(xe),st(xe==="main"),Z("amount"),tt(false),Ue(null),Ve("crypto")),Me.current=e;},[e,xe]),ws.useEffect(()=>{e&&(V!=="wallet"||!De||Ze(H=>H==="main"?"wallet":H));},[e,V,De]);let ge=ws.useCallback(H=>{H.length!==0&&de(U=>{let ve=new Map(U.map(me=>[me.id,me]));for(let me of H)ve.set(me.id,me);return Array.from(ve.values())});},[]),ye=ws.useCallback(()=>{tt(false),Ue(null),Ie?(Ze("main"),Z("amount")):rt();},[Ie,rt]),Bt=ws.useRef(reactNative.AppState.currentState==="active"),zt=ws.useRef(0);ws.useEffect(()=>{if(reactNative.Platform.OS!=="android")return;let H=reactNative.AppState.addEventListener("change",U=>{U==="active"&&!Bt.current&&(zt.current=Date.now()),Bt.current=U==="active";});return ()=>H.remove()},[]);let Rt=ws.useCallback(()=>{if(reactNative.Platform.OS==="android"){let H=!Bt.current,U=Date.now()-zt.current<800;if(H||U)return}ye();},[ye]),ht=X.filter(H=>H.status==="pending"||H.status==="waiting").length,ze=!!(i&&a&&l&&c&&o)&&d!==false&&!!$,gt=Ae||e&&!$,Ke=Oe===false,_e=null;if(le==="stripe"&&k){let H=jsxRuntime.jsx(k,{publishableKey:o,email:v,phone:T,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,merchantIdentifier:I,paymentSelectorPosition:f,skipSuccessConfirmation:u,appName:$?.project_name??"",onClose:ye});_e=S?jsxRuntime.jsx(da,{...S,children:H}):H;}let ot=le==="stripe"||le==="transfer"||le==="card"||le==="cashapp"||le==="wallet"?.9:le==="tracker"?.6:le==="main"?w||De?.6:.5:void 0,Y=le==="main"?.9:void 0,_={main:W?.main,transfer:W?.transferCrypto,card:W?.buyWithCard,stripe:W?.stripeLinkPay,cashapp:W?.cashApp,wallet:W?.connectWallet,tracker:W?.depositsTracker}[le],C=_?.borderTopLeftRadius??G,L=_?.borderTopRightRadius??Ne,O=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ce&&jsxRuntime.jsx(du,{visible:ke,useModal:false,status:Ce.status,tokenIconUrl:Ce.destination_token_metadata?.icon_urls?.find(H=>H.format==="png")?.url||Ce.destination_token_metadata?.icon_url||Ye,explorerUrl:Ce.explorer_url,completionExplorerUrl:Ce.destination_explorer_url,execution:Ce,date:Ce.created_at?new Date(Ce.created_at):void 0,amountUsd:Ce.source_amount_usd?parseFloat(Ce.source_amount_usd):void 0,onClose:()=>qe(false),heightProcessing:le==="card"||le==="wallet"?.35:void 0,heightCompleted:le==="card"||le==="wallet"?.41:void 0,heightCompletedExpanded:le==="card"||le==="wallet"?.53:void 0,borderTopLeftRadius:W?.depositStatus?.borderTopLeftRadius??G,borderTopRightRadius:W?.depositStatus?.borderTopRightRadius??Ne}),Be&&jsxRuntime.jsx(Cf,{visible:Je,useModal:false,onClose:()=>tt(false),priceImpact:Be.priceImpact,maxSlippage:Be.maxSlippage,minDepositUsd:Be.minDepositUsd,chainName:Be.chainName,borderTopLeftRadius:W?.infoSheet?.borderTopLeftRadius??G,borderTopRightRadius:W?.infoSheet?.borderTopRightRadius??Ne})]});return jsxRuntime.jsxs(Wt,{visible:e,onClose:le==="main"?rt:Rt,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:ot,maxHeightPercent:Y,borderTopLeftRadius:C,borderTopRightRadius:L,overlay:O,children:[le==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qr,{title:n,showBack:false,onClose:rt,showBalance:ze,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:$?.project_name}),gt&&jsxRuntime.jsx(RT,{}),!gt&&Ke&&jsxRuntime.jsxs(reactNative.View,{style:Jr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Jr.iconContainer,{backgroundColor:te.cardHover}],children:jsxRuntime.jsx(kl,{size:32,color:te.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Jr.blockedTitle,{color:te.foreground,fontFamily:$e.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Jr.blockedDescription,{color:te.foreground,opacity:.7,fontFamily:$e.regular}],children:"There are no supported tokens available from your current location."})]}),!gt&&!Ke&&(()=>{let H=jsxRuntime.jsx(Xl,{onPress:()=>Ze("transfer"),title:Rn.transferCrypto.title,subtitle:Rn.transferCrypto.subtitle,featuredTokens:$?.transfer_crypto?.networks},"transfer"),U=jsxRuntime.jsx(tc,{onPress:()=>Ze("card"),title:Rn.depositWithCard.title,subtitle:Rn.depositWithCard.subtitle,paymentNetworks:$?.payment_networks?.networks},"card"),ve=De?jsxRuntime.jsx(sc,{onPress:()=>Ze("wallet"),featuredWallets:$?.connect_wallet?.wallets},"wallet"):null,me=w?jsxRuntime.jsx(ic,{onPress:()=>Ze("cashapp")},"cashapp"):null,z=x&&k?jsxRuntime.jsx(nc,{onPress:()=>Ze("stripe"),title:Rn.stripeLinkPay.title,subtitle:Rn.stripeLinkPay.subtitle},"stripe"):null,A=p?null:jsxRuntime.jsx(rc,{onPress:()=>Ze("tracker"),title:Rn.depositTracker.title,subtitle:Rn.depositTracker.subtitle,badge:ht>0?ht:void 0},"tracker");return jsxRuntime.jsxs(reactNative.View,{style:Jr.optionsContainer,children:[E==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(IT,{selected:pr,onSelect:Ve}),pr==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[H,ve]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[U,me,z]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[H,ve,U,me,z]}),A]})})()]}),le==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qr,{title:Rn.transferCrypto.title,showBack:false,onClose:ye,showBalance:ze,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:$?.project_name}),Ae&&jsxRuntime.jsx(reactNative.View,{style:[Jr.centeredContainer,Jr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:te.primary})}),!Ae&&Ke&&jsxRuntime.jsxs(reactNative.View,{style:[Jr.centeredContainer,Jr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Jr.iconContainer,{backgroundColor:te.cardHover}],children:jsxRuntime.jsx(kl,{size:32,color:te.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Jr.blockedTitle,{color:te.foreground,fontFamily:$e.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Jr.blockedDescription,{color:te.foreground,opacity:.7,fontFamily:$e.regular}],children:"There are no supported tokens available from your current location."})]}),!Ae&&!Ke&&jsxRuntime.jsx(Dt,{style:Jr.transferScrollContainer,contentContainerStyle:D==="compact"?Jr.scrollContentCompact:Jr.scrollContent,showsVerticalScrollIndicator:false,children:D==="compact"?jsxRuntime.jsx(lu,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:m,defaultChainId:h,defaultTokenAddress:b,depositConfirmationMode:y,onExecutionsChange:ge,onDepositSuccess:P,onDepositError:M,onLatestExecution:se,onShowStatusSheet:qe,onSelectedTokenIconUrl:He,onShowInfoSheet:tt,onInfoSheetData:Ue,borderTopLeftRadius:G,borderTopRightRadius:Ne,sheetBorderRadius:{tokenSelector:W?.tokenSelector,chainSelector:W?.chainSelector,infoSheet:W?.infoSheet,depositStatus:W?.depositStatus}}):D==="single_input"?jsxRuntime.jsx(wf,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:m,defaultChainId:h,defaultTokenAddress:b,depositConfirmationMode:y,onExecutionsChange:ge,onDepositSuccess:P,onDepositError:M,onLatestExecution:se,onShowStatusSheet:qe,onSelectedTokenIconUrl:He,borderTopLeftRadius:G,borderTopRightRadius:Ne,sheetBorderRadius:{tokenSelector:W?.tokenSelector,infoSheet:W?.infoSheet,depositStatus:W?.depositStatus}}):jsxRuntime.jsx($d,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:m,defaultChainId:h,defaultTokenAddress:b,depositConfirmationMode:y,onExecutionsChange:ge,onDepositSuccess:P,onDepositError:M,onLatestExecution:se,onShowStatusSheet:qe,onSelectedTokenIconUrl:He,borderTopLeftRadius:G,borderTopRightRadius:Ne,sheetBorderRadius:{tokenSelector:W?.tokenSelector,chainSelector:W?.chainSelector,infoSheet:W?.infoSheet,depositStatus:W?.depositStatus}})})]}),le==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qr,{title:`Deposit ${s||"USDC"}`,showBack:ue==="onramp",onBack:()=>Z("amount"),onClose:ye,showBalance:ze,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:$?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Jr.buyWithCardContainer,children:jsxRuntime.jsx(Jd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onDepositSuccess:P,onDepositError:M,onExecutionsChange:ge,onLatestExecution:se,onShowStatusSheet:qe,onSelectedTokenIconUrl:He,view:ue,onViewChange:H=>Z(H),borderTopLeftRadius:G,borderTopRightRadius:Ne,sheetBorderRadius:{providerModal:W?.providerModal,webView:W?.webView,currencyModal:W?.currencyModal}})})]}),le==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:Jr.cashAppContainer,children:jsxRuntime.jsx(Ld,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:ye,onClose:ye,onDepositSuccess:P})}),le==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:Jr.connectWalletContainer,children:jsxRuntime.jsx(Ud,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:ye,onClose:ye,onDepositSuccess:P,onDepositError:M,onExecutionsChange:ge,onLatestExecution:se,onShowStatusSheet:qe})}),le==="stripe"&&_e&&jsxRuntime.jsx(reactNative.View,{style:Jr.stripeLinkPayContainer,children:_e}),le==="tracker"&&jsxRuntime.jsx(mf,{active:le==="tracker",onClose:ye,executions:X,externalUserId:r,publishableKey:o})]})}function mu({theme:e="auto",...t}){return jsxRuntime.jsx(_T,{...t})}var Jr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});var tl=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 Ks,hs,rl,ny,FT=(ny=class extends tl{constructor(){super();re(this,Ks);re(this,hs);re(this,rl);j(this,rl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,hs)||this.setEventListener(g(this,rl));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,hs))==null||t.call(this),j(this,hs,void 0));}setEventListener(t){var r;j(this,rl,t),(r=g(this,hs))==null||r.call(this),j(this,hs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Ks)!==t&&(j(this,Ks,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Ks)=="boolean"?g(this,Ks):globalThis.document?.visibilityState!=="hidden"}},Ks=new WeakMap,hs=new WeakMap,rl=new WeakMap,ny),iy=new FT;var DT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ei,Gs,sy,VT=(sy=class{constructor(){re(this,ei,DT);re(this,Gs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Gs)&&e!==g(this,ei)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,ei),provider:e}),j(this,ei,e),process.env.NODE_ENV!=="production"&&j(this,Gs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,Gs,true),g(this,ei).setTimeout(e,t)}clearTimeout(e){g(this,ei).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,Gs,true),g(this,ei).setInterval(e,t)}clearInterval(e){g(this,ei).clearInterval(e);}},ei=new WeakMap,Gs=new WeakMap,sy),gc=new VT;function ay(e){setTimeout(e,0);}var Tf=typeof window>"u"||"Deno"in globalThis;function ol(){}function kf(e){return typeof e=="number"&&e>=0&&e!==1/0}function uy(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nl(e,t){return typeof e=="function"?e(t):e}function qo(e,t){return typeof e=="function"?e(t):e}var OT=Object.prototype.hasOwnProperty;function hu(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=ly(e)&&ly(t);if(!o&&!(cy(e)&&cy(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let m=0;m<a;m++){let h=o?m:i[m],b=e[h],d=t[h];if(b===d){l[h]=b,(o?m<s:OT.call(e,h))&&c++;continue}if(b===null||d===null||typeof b!="object"||typeof d!="object"){l[h]=d;continue}let p=hu(b,d,r+1);l[h]=p,p===b&&c++;}return s===a&&c===s?e:l}function gu(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 ly(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cy(e){if(!dy(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!dy(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function dy(e){return Object.prototype.toString.call(e)==="[object Object]"}function xf(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 hu(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 hu(e,t)}return t}function yu(e,t){return typeof e=="function"?e(...t):!!e}var il=(()=>{let e=()=>Tf;return {isServer(){return e()},setIsServer(t){e=t;}}})();function vf(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var py=ay;function LT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=py,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var yc=LT();var sl,gs,al,fy,BT=(fy=class extends tl{constructor(){super();re(this,sl,true);re(this,gs);re(this,al);j(this,al,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,gs)||this.setEventListener(g(this,al));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,gs))==null||t.call(this),j(this,gs,void 0));}setEventListener(t){var r;j(this,al,t),(r=g(this,gs))==null||r.call(this),j(this,gs,t(this.setOnline.bind(this)));}setOnline(t){g(this,sl)!==t&&(j(this,sl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,sl)}},sl=new WeakMap,gs=new WeakMap,al=new WeakMap,fy),my=new BT;function hy(e){return (e??"online")==="online"?my.isOnline():true}function gy(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hy(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var Lo,Ot,wc,ko,Ys,ll,Ri,ys,Cc,cl,dl,Js,Zs,bs,ul,Zt,bc,Rf,If,_f,Pf,Ff,Df,Vf,Cy,wy,Lf=(wy=class extends tl{constructor(t,r){super();re(this,Zt);re(this,Lo);re(this,Ot);re(this,wc);re(this,ko);re(this,Ys);re(this,ll);re(this,Ri);re(this,ys);re(this,Cc);re(this,cl);re(this,dl);re(this,Js);re(this,Zs);re(this,bs);re(this,ul,new Set);this.options=r,j(this,Lo,t),j(this,ys,null),j(this,Ri,vf()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(g(this,Ot).addObserver(this),yy(g(this,Ot),this.options)?yt(this,Zt,bc).call(this):this.updateResult(),yt(this,Zt,Pf).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Of(g(this,Ot),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Of(g(this,Ot),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,yt(this,Zt,Ff).call(this),yt(this,Zt,Df).call(this),g(this,Ot).removeObserver(this);}setOptions(t){let r=this.options,o=g(this,Ot);if(this.options=g(this,Lo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof qo(this.options.enabled,g(this,Ot))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");yt(this,Zt,Vf).call(this),g(this,Ot).setOptions(this.options),r._defaulted&&!gu(this.options,r)&&g(this,Lo).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,Ot),observer:this});let n=this.hasListeners();n&&by(g(this,Ot),o,this.options,r)&&yt(this,Zt,bc).call(this),this.updateResult(),n&&(g(this,Ot)!==o||qo(this.options.enabled,g(this,Ot))!==qo(r.enabled,g(this,Ot))||nl(this.options.staleTime,g(this,Ot))!==nl(r.staleTime,g(this,Ot)))&&yt(this,Zt,Rf).call(this);let s=yt(this,Zt,If).call(this);n&&(g(this,Ot)!==o||qo(this.options.enabled,g(this,Ot))!==qo(r.enabled,g(this,Ot))||s!==g(this,bs))&&yt(this,Zt,_f).call(this,s);}getOptimisticResult(t){let r=g(this,Lo).getQueryCache().build(g(this,Lo),t),o=this.createResult(r,t);return WT(this,o)&&(j(this,ko,o),j(this,ll,this.options),j(this,Ys,g(this,Ot).state)),o}getCurrentResult(){return g(this,ko)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,Ri).status==="pending"&&g(this,Ri).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){g(this,ul).add(t);}getCurrentQuery(){return g(this,Ot)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=g(this,Lo).defaultQueryOptions(t),o=g(this,Lo).getQueryCache().build(g(this,Lo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return yt(this,Zt,bc).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),g(this,ko)))}createResult(t,r){let o=g(this,Ot),n=this.options,s=g(this,ko),i=g(this,Ys),a=g(this,ll),c=t!==o?t.state:g(this,wc),{state:m}=t,h={...m},b=false,d;if(r._optimisticResults){let y=this.hasListeners(),D=!y&&yy(t,r),E=y&&by(t,o,r,n);(D||E)&&(h={...h,...gy(m.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:p,errorUpdatedAt:w,status:R}=h;d=h.data;let x=false;if(r.placeholderData!==void 0&&d===void 0&&R==="pending"){let y;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(y=s.data,x=true):y=typeof r.placeholderData=="function"?r.placeholderData(g(this,dl)?.state.data,g(this,dl)):r.placeholderData,y!==void 0&&(R="success",d=xf(s?.data,y,r),b=true);}if(r.select&&d!==void 0&&!x)if(s&&d===i?.data&&r.select===g(this,Cc))d=g(this,cl);else try{j(this,Cc,r.select),d=r.select(d),d=xf(s?.data,d,r),j(this,cl,d),j(this,ys,null);}catch(y){j(this,ys,y);}g(this,ys)&&(p=g(this,ys),d=g(this,cl),w=Date.now(),R="error");let k=h.fetchStatus==="fetching",v=R==="pending",T=R==="error",I=v&&k,f=d!==void 0,S={status:R,fetchStatus:h.fetchStatus,isPending:v,isSuccess:R==="success",isError:T,isInitialLoading:I,isLoading:I,data:d,dataUpdatedAt:h.dataUpdatedAt,error:p,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:k,isRefetching:k&&!v,isLoadingError:T&&!f,isPaused:h.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:T&&f,isStale:Bf(t,r),refetch:this.refetch,promise:g(this,Ri),isEnabled:qo(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let y=S.data!==void 0,D=S.status==="error"&&!y,E=M=>{D?M.reject(S.error):y&&M.resolve(S.data);},V=()=>{let M=j(this,Ri,S.promise=vf());E(M);},P=g(this,Ri);switch(P.status){case "pending":t.queryHash===o.queryHash&&E(P);break;case "fulfilled":(D||S.data!==P.value)&&V();break;case "rejected":(!D||S.error!==P.reason)&&V();break}}return S}updateResult(){let t=g(this,ko),r=this.createResult(g(this,Ot),this.options);if(j(this,Ys,g(this,Ot).state),j(this,ll,this.options),g(this,Ys).data!==void 0&&j(this,dl,g(this,Ot)),gu(r,t))return;j(this,ko,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!g(this,ul).size)return true;let i=new Set(s??g(this,ul));return this.options.throwOnError&&i.add("error"),Object.keys(g(this,ko)).some(a=>{let l=a;return g(this,ko)[l]!==t[l]&&i.has(l)})};yt(this,Zt,Cy).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&yt(this,Zt,Pf).call(this);}},Lo=new WeakMap,Ot=new WeakMap,wc=new WeakMap,ko=new WeakMap,Ys=new WeakMap,ll=new WeakMap,Ri=new WeakMap,ys=new WeakMap,Cc=new WeakMap,cl=new WeakMap,dl=new WeakMap,Js=new WeakMap,Zs=new WeakMap,bs=new WeakMap,ul=new WeakMap,Zt=new WeakSet,bc=function(t){yt(this,Zt,Vf).call(this);let r=g(this,Ot).fetch(this.options,t);return t?.throwOnError||(r=r.catch(ol)),r},Rf=function(){yt(this,Zt,Ff).call(this);let t=nl(this.options.staleTime,g(this,Ot));if(il.isServer()||g(this,ko).isStale||!kf(t))return;let o=uy(g(this,ko).dataUpdatedAt,t)+1;j(this,Js,gc.setTimeout(()=>{g(this,ko).isStale||this.updateResult();},o));},If=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,Ot)):this.options.refetchInterval)??false},_f=function(t){yt(this,Zt,Df).call(this),j(this,bs,t),!(il.isServer()||qo(this.options.enabled,g(this,Ot))===false||!kf(g(this,bs))||g(this,bs)===0)&&j(this,Zs,gc.setInterval(()=>{(this.options.refetchIntervalInBackground||iy.isFocused())&&yt(this,Zt,bc).call(this);},g(this,bs)));},Pf=function(){yt(this,Zt,Rf).call(this),yt(this,Zt,_f).call(this,yt(this,Zt,If).call(this));},Ff=function(){g(this,Js)!==void 0&&(gc.clearTimeout(g(this,Js)),j(this,Js,void 0));},Df=function(){g(this,Zs)!==void 0&&(gc.clearInterval(g(this,Zs)),j(this,Zs,void 0));},Vf=function(){let t=g(this,Lo).getQueryCache().build(g(this,Lo),this.options);if(t===g(this,Ot))return;let r=g(this,Ot);j(this,Ot,t),j(this,wc,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Cy=function(t){yc.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(g(this,ko));}),g(this,Lo).getQueryCache().notify({query:g(this,Ot),type:"observerResultsUpdated"});});},wy);function AT(e,t){return qo(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&qo(t.retryOnMount,e)===false)}function yy(e,t){return AT(e,t)||e.state.data!==void 0&&Of(e,t,t.refetchOnMount)}function Of(e,t,r){if(qo(t.enabled,e)!==false&&nl(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Bf(e,t)}return false}function by(e,t,r,o){return (e!==t||qo(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Bf(e,r)}function Bf(e,t){return qo(t.enabled,e)!==false&&e.isStaleByTime(nl(t.staleTime,e))}function WT(e,t){return !gu(e.getCurrentResult(),t)}var ET=ws__namespace.createContext(void 0),Sy=e=>{let t=ws__namespace.useContext(ET);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var Ty=ws__namespace.createContext(false),ky=()=>ws__namespace.useContext(Ty);Ty.Provider;function MT(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var zT=ws__namespace.createContext(MT()),xy=()=>ws__namespace.useContext(zT);var Ry=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?yu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Iy=e=>{ws__namespace.useEffect(()=>{e.clearReset();},[e]);},_y=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||yu(r,[e.error,o]));var Py=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));}},Fy=(e,t)=>e.isLoading&&e.isFetching&&!t,Dy=(e,t)=>e?.suspense&&t.isPending,Af=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Vy(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=ky(),n=xy(),s=Sy(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,Py(i),Ry(i,n,a),Iy(n);let c=!s.getQueryCache().get(i.queryHash),[m]=ws__namespace.useState(()=>new t(s,i)),h=m.getOptimisticResult(i),b=!o&&l;if(ws__namespace.useSyncExternalStore(ws__namespace.useCallback(d=>{let p=b?m.subscribe(yc.batchCalls(d)):ol;return m.updateResult(),p},[m,b]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),ws__namespace.useEffect(()=>{m.setOptions(i);},[i,m]),Dy(i,h))throw Af(i,m,n);if(_y({result:h,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw h.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,h),i.experimental_prefetchInRender&&!il.isServer()&&Fy(h,o)&&(c?Af(i,m,n):a?.promise)?.catch(ol).finally(()=>{m.updateResult();}),i.notifyOnChangeProps?h:m.trackResult(h)}function Ii(e,t){return Vy(e,Lf)}function wu(e,t=true){return Ii({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>qc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Wf(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return Ii({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await ai(s),c=null,m=null,h=null,b=null,d,p,w,R=l.data.some(x=>x.chains.some(k=>{let v=k.chain_type===t&&k.chain_id===r&&k.token_address.toLowerCase()===o.toLowerCase();return v&&(c=k.minimum_deposit_amount_usd,m=k.estimated_processing_time,h=k.max_slippage_percent,b=k.estimated_price_impact_percent,w=k.chain_name,p=x),v}));if(p){let x=We(p,"png");x&&(d=ne(x));}return {isSupported:R,minimumAmountUsd:c,estimatedProcessingTime:m,maxSlippagePercent:h,priceImpactPercent:b,errorMessage:R?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Ef(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return Ii({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Qc(t,r,o,n,s);if(l.balance){let c=l.balance.token?.decimals??6,m=l.balance.token?.symbol??"",h=l.balance.amount,b=BigInt(h),d=BigInt(10**c),p=b/d,R=(b%d).toString().padStart(c,"0").replace(/0+$/,""),x=R?`${p}.${R}`:p.toString();return {balanceBaseUnit:h,balanceHuman:x,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:m}}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 UT=2500,NT=3e3,HT=6e4;function Mf({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=ws.useState([]),[l,c]=ws.useState(false),m=ws.useRef(new Date),h=ws.useRef(new Map),b=ws.useRef(false),d=ws.useRef(n),p=ws.useRef(s);return ws.useEffect(()=>{d.current=n;},[n]),ws.useEffect(()=>{p.current=s;},[s]),ws.useEffect(()=>{o&&!b.current&&(m.current=new Date,h.current.clear()),o||h.current.clear(),b.current=o;},[o]),ws.useEffect(()=>{if(!e||!o)return;let w=m.current,R=async()=>{try{let k=await fn(e,t,"withdraw"),v=new Date(w.getTime()-HT),T=[...k.data].sort((S,y)=>{let D=S.created_at?new Date(S.created_at).getTime():0;return (y.created_at?new Date(y.created_at).getTime():0)-D}),I=["pending","waiting","delayed"],f=["succeeded","failed"],u=null;for(let S of T){let y=S.created_at?new Date(S.created_at):null;if(!y||y<v)continue;let D=h.current.get(S.id);if(!D){u=S;break}if(I.includes(D)&&f.includes(S.status)){u=S;break}}if(u){let S=u,y=S.created_at?new Date(S.created_at):null;if(!y||y<m.current)return;let D=h.current.get(S.id);h.current.set(S.id,S.status),a(E=>{let V=E.findIndex(P=>P.id===S.id);if(V>=0){let P=[...E];return P[V]=S,P}return [...E,S]}),S.status==="succeeded"&&(!D||I.includes(D))?d.current?.({message:"Withdrawal completed successfully",transaction:S}):S.status==="failed"&&D!=="failed"&&p.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:S});}}catch(k){console.error("Failed to fetch withdraw executions:",k),p.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:k});}};R();let x=setInterval(R,UT);return c(true),()=>{clearInterval(x),c(false);}},[e,t,o]),ws.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await Gu({deposit_wallet_id:r},t);}catch{}};w();let R=setInterval(w,NT);return ()=>clearInterval(R)},[o,r,t]),{executions:i,isPolling:l}}var zf=(e,t)=>`${t}:${e}`;function vc({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:m,chainPickerBorderTopRightRadius:h}){let{colors:b,fonts:d,components:p}=B(),[w,R]=ws.useState(false),[x,k]=ws.useState(false),v=p.card,T=t?e.find(S=>S.symbol===t):void 0,I=T?.chains||[],f=r?I.find(S=>zf(S.chain_id,S.chain_type)===r):void 0,u={backgroundColor:v.backgroundColor,borderRadius:v.borderRadius,borderWidth:v.borderWidth||1,borderColor:v.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Mt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.label,{color:v.labelColor,fontFamily:d.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.selectButton,u],onPress:()=>!s&&e.length>0&&R(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[Mt.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):T?jsxRuntime.jsxs(reactNative.View,{style:Mt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(T,"png"))},style:Mt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.selectedText,{color:v.titleColor,fontFamily:d.medium}],numberOfLines:1,children:T.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Mt.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsxRuntime.jsx(ar,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Mt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.label,{color:v.labelColor,fontFamily:d.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.selectButton,u,(!T||I.length===0)&&Mt.disabled],onPress:()=>!s&&T&&I.length>0&&k(true),activeOpacity:.7,disabled:s||!T||I.length===0,children:[f?jsxRuntime.jsxs(reactNative.View,{style:Mt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(f,"png"))},style:Mt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.selectedText,{color:v.titleColor,fontFamily:d.medium}],numberOfLines:1,children:f.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Mt.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsxRuntime.jsx(ar,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Wt,{visible:w,onClose:()=>R(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Mt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.pickerTitle,{color:b.foreground,fontFamily:d.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mt.pickerHeaderClose,onPress:()=>R(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tt,{size:20,color:b.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ua,{data:e,keyExtractor:S=>S.symbol,contentContainerStyle:Mt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.pickerItem,{backgroundColor:S.symbol===t?b.cardHover:"transparent"}],onPress:()=>{o(S.symbol),R(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(S,"png"))},style:Mt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.pickerItemText,{color:b.foreground,fontFamily:d.medium}],children:S.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.pickerItemSub,{color:b.foregroundMuted,fontFamily:d.regular}],children:S.name}),S.symbol===t&&jsxRuntime.jsx(lt,{size:18,color:b.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Wt,{visible:x,onClose:()=>k(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:m,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Mt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.pickerTitle,{color:b.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mt.pickerHeaderClose,onPress:()=>k(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tt,{size:20,color:b.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ua,{data:I,keyExtractor:S=>zf(S.chain_id,S.chain_type),contentContainerStyle:Mt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>{let y=zf(S.chain_id,S.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.pickerItem,{backgroundColor:y===r?b.cardHover:"transparent"}],onPress:()=>{n(y),k(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(We(S,"png"))},style:Mt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.pickerItemText,{color:b.foreground,fontFamily:d.medium}],children:S.chain_name}),y===r&&jsxRuntime.jsx(lt,{size:18,color:b.primary,strokeWidth:2.5})]})}})]})]})}var Mt=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function Uf(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return Ii({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>Ku({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function QT(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function KT(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function GT(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Su({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:m,isLoadingBalance:h,minimumWithdrawAmountUsd:b,estimatedProcessingTime:d,maxSlippagePercent:p,priceImpactPercent:w,canWithdraw:R,onDepositWalletCreation:x,onWithdraw:k,onWithdrawError:v,onWithdrawSubmitted:T,onViewTracker:I}){let f="https://unifold.io/terms",u="https://unifold.io/support",{colors:S,fonts:y,components:D}=B(),[E,V]=ws.useState(a||""),[P,M]=ws.useState(""),[W,G]=ws.useState(false),[Ne,te]=ws.useState(null),[$e,X]=ws.useState(false),[de,$]=ws.useState(""),Q=ws.useRef(null);ws.useEffect(()=>{V(a||""),M(""),te(null);},[a]);let ue=E.trim();ws.useEffect(()=>{let ge=setTimeout(()=>$(ue),500);return ()=>clearTimeout(ge)},[ue]);let{data:Z,isLoading:ke,error:qe}=Uf({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:de,publishableKey:e,enabled:de.length>5&&!!c}),Ce=ue!==de,se=ws.useMemo(()=>!ue||ue.length<=5||Ce||ke?null:qe?"Invalid address":Z&&!Z.valid?Z.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:Z.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[ue,Ce,ke,qe,Z,c,l]),Ye=!Ce&&!!Z?.valid&&!se,He=ws.useMemo(()=>m?.exchangeRate?parseFloat(m.exchangeRate):0,[m]),Je=ws.useMemo(()=>m?.balanceHuman?parseFloat(m.balanceHuman):0,[m]),tt=n||m?.symbol||"TOKEN",Be=m?.decimals??6,Ue=ws.useMemo(()=>{let ge=parseFloat(P);return !ge||ge<=0?0:ge},[P]),De=ws.useMemo(()=>{let ge=parseFloat(P);return !ge||ge<=0?0:ge*He},[P,He]),xe=ws.useCallback(async()=>{try{let ye=await Zy("expo-clipboard").getStringAsync();ye&&(V(ye.trim()),te(null));}catch{}},[]),Ie=ws.useCallback(()=>{Je<=0||M(m?.balanceHuman??"0");},[Je,m]),st=b!==null&&De>0&&De<b,le=Ue>0&&Je>0&&Ue>Je,Ze=ue.length>0&&P.trim().length>0&&Ue>0&&Ye&&!st&&!le&&!!m,pr=ws.useCallback(async()=>{if(!(!l||!c||!Ze||!R)){G(true),te(null);try{let ge=await x({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:ue}),ye=KT(Ue,Be),Bt=GT(Ue,Be),zt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:tt,sourceTokenIconUrl:i,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ne(We(l,"png")):void 0,amount:Bt,amountBaseUnit:ye,submittedAt:new Date,withdrawIntentAddress:ge.address,recipientAddress:ue};await k(zt),T(zt);}catch(ge){let ye=ge instanceof Error?ge.message:"Withdrawal failed. Please try again.",Bt=ye.length>120?"Withdrawal failed. Please try again.":ye;te(Bt),v?.({message:ye,error:ge,code:"WITHDRAW_FAILED"});}finally{G(false);}}},[l,c,Ze,R,ue,t,r,o,tt,i,P,Je,m,Ue,Be,De,x,k,v,T]),Ve=D.input,Oe=D.card,Ae=D.button,rt=se?S.error:Ve.borderColor,Me=ws.useMemo(()=>W?"Processing...":le?"Insufficient balance":st?`Minimum $${b?.toFixed(2)}`:Ne?"Withdrawal failed \u2014 try again":"Withdraw",[W,le,st,b,Ne]);return jsxRuntime.jsxs(reactNative.View,{style:Lt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Lt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Lt.label,{color:Oe.labelColor,fontFamily:y.medium}],children:"Recipient address"}),(Ce||ke)&&ue.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:xe,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(Xf,{size:16,color:S.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Lt.inputRow,{backgroundColor:Ve.backgroundColor,borderRadius:Ve.borderRadius,borderWidth:Ve.borderWidth,borderColor:rt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Lt.textInput,{color:Ve.textColor,fontFamily:y.regular}],placeholder:"Enter wallet address",placeholderTextColor:Ve.placeholderColor,value:E,onChangeText:ge=>{V(ge),te(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Q.current?.focus()})}),se?jsxRuntime.jsx(reactNative.Text,{style:[Lt.errorText,{color:S.error,fontFamily:y.regular}],children:se}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Lt.label,{color:Oe.labelColor,fontFamily:y.medium,paddingBottom:8}],children:["Amount",b!=null&&b>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:S.warning,fontFamily:y.regular},children:` ($${b.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Lt.amountRow,{backgroundColor:Ve.backgroundColor,borderRadius:Ve.borderRadius,borderWidth:Ve.borderWidth,borderColor:Ve.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Q,style:[Lt.amountInput,{color:Ve.textColor,fontFamily:y.regular}],placeholder:"0.00",placeholderTextColor:Ve.placeholderColor,value:P,onChangeText:ge=>{(ge===""||/^\d*\.?\d*$/.test(ge))&&(M(ge),te(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.unitLabel,{color:S.foregroundMuted,fontFamily:y.medium}],children:tt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Lt.maxButton,{backgroundColor:`${S.primary}20`}],onPress:Ie,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.maxText,{color:S.primary,fontFamily:y.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Lt.detailsCard,{marginTop:24,backgroundColor:Oe.backgroundColor,borderRadius:Oe.borderRadius,borderWidth:Oe.borderWidth||1,borderColor:Oe.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Lt.detailsToggle,onPress:()=>X(!$e),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Lt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Lt.detailIcon,{backgroundColor:Oe.iconBackgroundColor,borderRadius:Oe.iconContainerBorderRadius}],children:jsxRuntime.jsx(mo,{size:12,color:Oe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Lt.detailsLabel,{color:Oe.titleColor,fontFamily:y.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:y.medium},children:QT(d)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:$e?"180deg":"0deg"}]},children:jsxRuntime.jsx(ar,{size:16,color:Oe.actionColor,strokeWidth:2})})]})}),$e&&jsxRuntime.jsxs(reactNative.View,{style:Lt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Lt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Lt.detailIcon,{backgroundColor:Oe.iconBackgroundColor,borderRadius:Oe.iconContainerBorderRadius}],children:jsxRuntime.jsx(Co,{size:12,color:Oe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Lt.detailsLabel,{color:Oe.titleColor,fontFamily:y.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:y.medium},children:["Auto \u2022 ",(p??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Lt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Lt.detailIcon,{backgroundColor:Oe.iconBackgroundColor,borderRadius:Oe.iconContainerBorderRadius}],children:jsxRuntime.jsx(un,{size:12,color:Oe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Lt.detailsLabel,{color:Oe.titleColor,fontFamily:y.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:y.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Ne&&jsxRuntime.jsx(reactNative.Text,{style:[Lt.errorText,{color:S.error,fontFamily:y.regular,textAlign:"center"}],children:Ne}),jsxRuntime.jsxs(reactNative.View,{style:Lt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Lt.withdrawButton,{backgroundColor:Ae.primaryBackground,borderRadius:Ae.borderRadius,borderWidth:Ae.borderWidth,borderColor:Ae.borderColor,opacity:!Ze||!R||W?.5:1}],onPress:pr,disabled:!Ze||!R||W,activeOpacity:.8,children:[W&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Ae.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.withdrawButtonText,{color:Ae.primaryText,fontFamily:y.medium}],children:Me})]}),jsxRuntime.jsxs(reactNative.View,{style:Lt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Lt.historyLink,onPress:I,activeOpacity:.7,children:[jsxRuntime.jsx(mo,{size:14,color:S.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.historyText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Lt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(f),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.legalSeparator,{color:S.foregroundMuted,fontFamily:y.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Help"})})]})]})]})]})}var Lt=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function ZT(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 XT(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function xu({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=B(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,c=ne(We(e.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),m=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=ZT(e.created_at||new Date().toISOString()),b=XT(e.source_amount_usd);return jsxRuntime.jsxs(Vr,{cardTokens:s,onPress:t,contentStyle:Pi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Pi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Pi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Pi.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Bi,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.title,{color:s.titleColor,fontFamily:o.medium}],children:m}),jsxRuntime.jsx(reactNative.Text,{style:[Pi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:Pi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:b}),jsxRuntime.jsx(Br,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Pi=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function jf(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${c} ${l}`}catch{return e}}function Hy(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 tk(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 jy(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function $y(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Rc({label:e,value:t,isLast:r}){let{fonts:o,components:n}=B(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:St.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[St.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[St.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[St.divider,{backgroundColor:s.borderColor}]})]})}function qf({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=B(),[c,m]=ws.useState([]),[h,b]=ws.useState(!!n),d=l.card,p=l.button,w=l.header,R=l.container;ws.useEffect(()=>{Qu().then(G=>m(G.data)).catch(()=>{});},[]),ws.useEffect(()=>{b(!!n);},[e?.id]);let x=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,k=e?e.status==="failed"||e.status==="refunded":false,v=k?i.error:x?i.warning:i.success,T=k?"Failed":x?"Processing":"Completed",I=e?.destination_token_metadata?ne(We(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ne(t.destinationTokenIconUrl):ne(er("/icons/tokens/png/usdc.png")),f=e?.created_at?jf(e.created_at):t.submittedAt?jf(t.submittedAt.toISOString()):jf(new Date().toISOString()),u=e?`${Hy(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${jy(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,S=e?`${Hy(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${jy(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,y=e?tk(e.source_amount_usd,e.source_amount_base_unit):"$0.00",D=e?$c(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,E=e?$c(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,P=e?.explorer_url,M=e?.destination_transaction_hashes?.[0],W=e?.destination_explorer_url;return jsxRuntime.jsxs(Dt,{style:St.scroll,contentContainerStyle:St.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:St.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(aa,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:St.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[St.headerTitle,{color:w.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:St.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:St.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:I},style:St.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[St.statusBadge,{backgroundColor:v}],children:k?jsxRuntime.jsx(Bi,{size:10,color:"#FFFFFF",strokeWidth:3}):x?jsxRuntime.jsx(reactNative.View,{style:St.spinnerDot}):jsxRuntime.jsx(lt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:St.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[St.statusDot,{backgroundColor:v}]}),jsxRuntime.jsx(reactNative.Text,{style:[St.statusText,{color:v,fontFamily:a.medium}],children:T})]}),jsxRuntime.jsx(reactNative.Text,{style:[St.dateText,{color:R.subtitleColor,fontFamily:a.regular}],children:f}),jsxRuntime.jsxs(reactNative.View,{style:[St.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsxRuntime.jsx(Rc,{label:"Amount Sent",value:u}),jsxRuntime.jsx(Rc,{label:"Amount Received",value:S}),jsxRuntime.jsx(Rc,{label:"USD Value",value:y}),jsxRuntime.jsx(Rc,{label:"Source Network",value:D}),jsxRuntime.jsx(Rc,{label:"Destination Network",value:E,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:St.moreDetailsRow,onPress:()=>b(G=>!G),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[St.moreDetailsText,{color:R.actionTitle,fontFamily:a.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(_n,{size:16,color:R.actionColor,strokeWidth:2}):jsxRuntime.jsx(ar,{size:16,color:R.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[St.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:V&&P?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:St.txRow,onPress:()=>reactNative.Linking.openURL(P),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[St.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[St.txHash,{color:d.titleColor,fontFamily:a.regular}],children:$y(V)}),jsxRuntime.jsx(Yo,{size:14,color:d.actionColor,strokeWidth:2})]}),!x&&M&&W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[St.divider,{backgroundColor:d.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:St.txRow,onPress:()=>reactNative.Linking.openURL(W),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[St.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[St.txHash,{color:d.titleColor,fontFamily:a.regular}],children:$y(M)}),jsxRuntime.jsx(Yo,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:St.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[St.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:St.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[St.button,St.halfButton,{backgroundColor:p.secondaryBackground,borderRadius:p.borderRadius,borderWidth:p.borderWidth,borderColor:p.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[St.buttonText,{color:p.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[St.button,St.halfButton,{backgroundColor:p.primaryBackground,borderRadius:p.borderRadius,borderWidth:p.borderWidth,borderColor:p.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[St.buttonText,{color:p.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var St=reactNative.StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:reactNative.StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function qy(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function vu({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=B(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",m={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:ur.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.closeButton,onPress:r,children:jsxRuntime.jsx(Tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[ur.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(lt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ur.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ur.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",qy(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:ur.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ur.button,ur.halfButton,m,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ur.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ur.button,ur.halfButton,m,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ur.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:ur.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.closeButton,onPress:r,children:jsxRuntime.jsx(Tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[ur.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(Tt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ur.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[ur.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ur.button,ur.fullButton,m,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ur.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:ur.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.closeButton,onPress:r,children:jsxRuntime.jsx(Tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(wt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(e.sourceTokenIconUrl)},style:ur.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[ur.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[ur.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[ur.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",qy(e.recipientAddress)]})]})}var ur=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function ak(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:ne(We(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:ne(We(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var Qy=(e,t)=>`${t}:${e}`;function lk(){let{colors:e}=B(),t=ws.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ws.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function _u({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:m,onWithdrawSuccess:h,onWithdrawError:b,heightPercent:d=.94,sheetBorderRadius:p,sourceChainType:w,sourceChainId:R,sourceTokenAddress:x,sourceTokenSymbol:k,sourceChainName:v,sourceTokenIconUrl:T}){let{colors:I,fonts:f}=B(),[u,S]=ws.useState("form"),[y,D]=ws.useState(w),[E,V]=ws.useState(R),[P,M]=ws.useState(x),[W,G]=ws.useState(k),[Ne,te]=ws.useState(v),[$e,X]=ws.useState(T),[de,$]=ws.useState(null),[Q,ue]=ws.useState(null),[Z,ke]=ws.useState(null),[qe,Ce]=ws.useState(),[se,Ye]=ws.useState([]),[He,Je]=ws.useState(null),[tt,Be]=ws.useState("form"),Ue=ws.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,De=ws.useRef(null),xe=!!y&&!!E&&!!P,{data:Ie,isLoading:st}=wu(r,e&&u==="form"),le=Ie?.data??[],{data:Ze,isLoading:pr}=Wf({sourceChainType:y,sourceChainId:E,sourceTokenAddress:P,sourceTokenSymbol:W,publishableKey:r,enabled:e&&xe&&u==="form"}),{data:Ve,isLoading:Oe}=Ef({address:n,chainType:y,chainId:E,tokenAddress:P,publishableKey:r,enabled:e&&xe}),{executions:Ae}=Mf({userId:o,publishableKey:r,depositWalletId:qe,enabled:!!qe&&e,onWithdrawSuccess:h,onWithdrawError:b});ws.useEffect(()=>{if(!e||u!=="tracker")return;let O=false;return fn(o,r,"withdraw").then(H=>{O||Ye(H.data);}).catch(console.error),()=>{O=true;}},[e,u,o,r]),ws.useEffect(()=>{e&&(De.current&&(clearTimeout(De.current),De.current=null),S("form"),D(w),V(R),M(x),G(k),te(v),X(T),$(null),ue(null),ke(null),Ce(void 0),Ye([]),Je(null),Be("form"),Ue.setValue(reactNative.Dimensions.get("window").width));},[e]),ws.useEffect(()=>()=>{De.current&&clearTimeout(De.current);},[]),ws.useEffect(()=>{$e||Ze?.iconUrl&&X(Ze.iconUrl);},[Ze?.iconUrl,$e]),ws.useEffect(()=>{Ne||Ze?.chainName&&te(Ze.chainName);},[Ze?.chainName,Ne]),ws.useEffect(()=>{if(!le.length||de)return;let O,H;if(i&&a)if(l)for(let U of le){let ve=U.chains.find(me=>me.chain_type===i&&me.chain_id===a&&me.token_address.toLowerCase()===l.toLowerCase());if(ve){O=U,H=ve;break}}else for(let U of le){let ve=U.chains.find(me=>me.chain_type===i&&me.chain_id===a);if(ve){O=U,H=ve;break}}O||(O=le[0]),O&&($(O),ue(H??O.chains[0]??null));},[le,de,i,a,l]),ws.useEffect(()=>{u==="confirming"&&Ae.length>0&&S("details");},[u,Ae]);let rt=ws.useCallback(()=>{t(),De.current=setTimeout(()=>{S("form"),D(w),V(R),M(x),G(k),te(v),X(T),$(null),ue(null),ke(null),Ce(void 0),Ye([]),Je(null),Be("form"),De.current=null;},300);},[t,w,R,x,k,v,T]),Me=ws.useCallback(O=>{let H=le.find(U=>U.symbol===O);H&&($(H),H.chains.length>0&&ue(H.chains[0]));},[le]),ge=ws.useCallback(O=>{if(!de)return;let H=de.chains.find(U=>Qy(U.chain_id,U.chain_type)===O);H&&ue(H);},[de]),ye=ws.useCallback(async O=>{let H=await Eo({external_user_id:o,destination_chain_type:O.destinationChainType,destination_chain_id:O.destinationChainId,destination_token_address:O.destinationTokenAddress,recipient_address:O.recipientAddress,action_type:"withdraw"},r),U=vo(H.data,y??"");if(!U)throw new Error(`No deposit wallet found for chain type: ${y}`);return Ce(U.id),{id:U.id,address:U.address}},[o,r,y]),Bt=ws.useCallback(O=>{ke(O),S("confirming");},[]),zt=ws.useCallback(O=>{Je(O),Ue.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ue,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ue]),Rt=ws.useCallback(()=>{reactNative.Animated.timing(Ue,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Je(null));},[Ue]),ht=st||pr,sr=Ze?.isSupported??null,ze=u==="confirming"?"Withdrawal Status":c,gt=p?.globalBorderTopLeftRadius,Ke=p?.globalBorderTopRightRadius,_e=p?.main?.borderTopLeftRadius??gt,ot=p?.main?.borderTopRightRadius??Ke,Y=p?.tokenSelector?.borderTopLeftRadius??gt,Pe=p?.tokenSelector?.borderTopRightRadius??Ke,_=p?.chainSelector?.borderTopLeftRadius??gt,C=p?.chainSelector?.borderTopRightRadius??Ke,L=(()=>{if(u!=="form"||!xe||Oe||!Ve)return;let O=W||Ve.symbol,H=Ve.balanceUsd;if(H!=null){let me=`$${parseFloat(H).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return O?`Balance: ${me} ${O}`:`Balance: ${me}`}let U=Ve.balanceHuman;if(!(!U||U==="0"))return O?`Balance: ${U} ${O}`:`Balance: ${U}`})();return jsxRuntime.jsx(Wt,{visible:e,onClose:rt,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:_e,borderTopRightRadius:ot,children:u==="confirming"&&Z?jsxRuntime.jsx(vu,{txInfo:Z,executions:Ae,onClose:rt,onViewTracker:()=>{Be("confirming"),S("tracker");}}):u==="details"&&Z?jsxRuntime.jsx(qf,{execution:Ae.length>0?Ae[Ae.length-1]:null,txInfo:Z,onClose:rt,onViewHistory:()=>{Be("details"),S("tracker");},onHeaderClose:()=>S("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:ti.trackerContainer,children:[jsxRuntime.jsx(Qr,{title:"Withdrawal History",onClose:()=>S(tt)}),se.length===0?jsxRuntime.jsx(reactNative.View,{style:ti.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ti.emptyText,{color:I.foregroundMuted,fontFamily:f.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(ua,{data:se,keyExtractor:O=>O.id,contentContainerStyle:ti.listContent,showsVerticalScrollIndicator:false,renderItem:({item:O})=>jsxRuntime.jsx(xu,{execution:O,onPress:()=>zt(O)})}),He&&jsxRuntime.jsx(reactNative.Animated.View,{style:[ti.historyDetailOverlay,{backgroundColor:I.background,transform:[{translateX:Ue}]}],children:jsxRuntime.jsx(qf,{execution:He,txInfo:ak(He),onClose:rt,onBack:Rt,onViewHistory:Rt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qr,{title:ze,subtitle:L,onClose:rt}),ht?jsxRuntime.jsx(lk,{}):sr===false?jsxRuntime.jsxs(reactNative.View,{style:ti.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ti.unsupportedTitle,{color:I.foreground,fontFamily:f.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[ti.unsupportedMessage,{color:I.foregroundMuted,fontFamily:f.regular}],children:Ze?.errorMessage})]}):jsxRuntime.jsx(ck,{publishableKey:r,sourceChainType:y??"",sourceChainId:E??"",sourceTokenAddress:P??"",sourceTokenSymbol:W,sourceChainName:Ne,sourceTokenIconUrl:$e,recipientAddressProp:s,destinationTokens:le,selectedToken:de,selectedChain:Q,selectedChainKey:Q?Qy(Q.chain_id,Q.chain_type):null,onTokenChange:Me,onChainChange:ge,tokensLoading:st,balanceData:Ve??null,isLoadingBalance:Oe,sourceValidation:Ze??null,onDepositWalletCreation:ye,onWithdraw:m,onWithdrawError:b,onWithdrawSubmitted:Bt,onViewTracker:()=>{Be("form"),S("tracker");},tokenSelectorLeft:Y,tokenSelectorRight:Pe,chainSelectorLeft:_,chainSelectorRight:C})]})})}function ck({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:m,selectedChainKey:h,onTokenChange:b,onChainChange:d,tokensLoading:p,balanceData:w,isLoadingBalance:R,sourceValidation:x,onDepositWalletCreation:k,onWithdraw:v,onWithdrawError:T,onWithdrawSubmitted:I,onViewTracker:f,tokenSelectorLeft:u,tokenSelectorRight:S,chainSelectorLeft:y,chainSelectorRight:D}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Dt,{style:{flex:1,paddingTop:16},contentContainerStyle:ti.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:ti.doubleInputWrapper,children:jsxRuntime.jsx(vc,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:h,onTokenChange:b,onChainChange:d,isLoading:p,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:S,chainPickerBorderTopLeftRadius:y,chainPickerBorderTopRightRadius:D})}),jsxRuntime.jsx(Su,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:c,selectedChain:m,balanceData:w,isLoadingBalance:R,minimumWithdrawAmountUsd:x?.minimumAmountUsd??null,estimatedProcessingTime:x?.estimatedProcessingTime??null,maxSlippagePercent:x?.maxSlippagePercent??null,priceImpactPercent:x?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:k,onWithdraw:v,onWithdrawError:T,onWithdrawSubmitted:I,onViewTracker:f})]})})}var ti=reactNative.StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});reactNative.StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Yy=ws.createContext(null);function wk({children:e,publishableKey:t,config:r}){let[o]=ws.useState(()=>new Ap({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=ws.useState(false),[i,a]=ws.useState(null),[l,c]=ws.useState(false),[m,h]=ws.useState(null),b=reactNative.useColorScheme(),d=ws.useRef(false);d.current||(Uc({publishableKey:t}),d.current=true);let p=ws.useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?b==="dark"?"dark":"light":P},[r?.appearance,b]);ws.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Uc({publishableKey:t});},[t]),ws.useEffect(()=>()=>{R.current&&clearTimeout(R.current),f.current&&clearTimeout(f.current);},[]);let w=ws.useRef(null),R=ws.useRef(null),x=ws.useCallback(P=>{R.current&&(clearTimeout(R.current),R.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 M=new Promise((W,G)=>{w.current={resolve:W,reject:G};});return a(P),s(true),M},[]),k=ws.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),s(false),R.current=setTimeout(()=>{a(null),R.current=null;},200);},[]),v=ws.useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),T=ws.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),I=ws.useRef(null),f=ws.useRef(null),u=ws.useRef(void 0),S=ws.useCallback(P=>{f.current&&(clearTimeout(f.current),f.current=null),I.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),I.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),I.current=null);let M=new Promise((W,G)=>{I.current={resolve:W,reject:G};});return u.current=P.onClose,h(P),c(true),M},[]),y=ws.useCallback(()=>{I.current&&(I.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),I.current=null),u.current?.(),u.current=void 0,c(false),f.current=setTimeout(()=>{h(null),f.current=null;},200);},[]),D=ws.useCallback(P=>{m?.onSuccess&&m.onSuccess(P),I.current&&(I.current.resolve(P),I.current=null);},[m]),E=ws.useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),m?.onError&&m.onError(P),I.current&&(I.current.reject(P),I.current=null);},[m]),V=ws.useMemo(()=>({publishableKey:t,beginDeposit:x,closeDeposit:k,beginWithdraw:S,closeWithdraw:y}),[t,x,k,S,y]);return jsxRuntime.jsx(Wp,{client:o,children:jsxRuntime.jsx(Yy.Provider,{value:V,children:jsxRuntime.jsxs(da,{mode:p,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(mu,{visible:n,onClose:k,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:p,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLinkPay:r?.enableStripeLinkPay,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?fh():void 0,onDepositSuccess:v,onDepositError:T,theme:p,sheetBorderRadius:r?.sheetBorderRadius}),m&&jsxRuntime.jsx(_u,{visible:l,onClose:y,publishableKey:t,externalUserId:m.externalUserId,senderAddress:m.senderAddress,recipientAddress:m.recipientAddress,sourceChainType:m.sourceChainType,sourceChainId:m.sourceChainId,sourceTokenAddress:m.sourceTokenAddress,sourceTokenSymbol:m.sourceTokenSymbol,defaultDestinationChainType:m.defaultDestinationChainType,defaultDestinationChainId:m.defaultDestinationChainId,defaultDestinationTokenAddress:m.defaultDestinationTokenAddress,onWithdraw:m.withdraw,onWithdrawSuccess:D,onWithdrawError:E,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Ck(){let e=ws.useContext(Yy);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
+ exports.AmountScreen=ad;exports.BottomSheet=Wt;exports.KYCWizardScreen=ld;exports.OnrampScreen=bd;exports.StripeOnramp=wd;exports.StripeOnrampPreconfigure=uh;exports.UnifoldProvider=wk;exports.getPreferredIcon=We;exports.getStripePublishableKey=rd;exports.getSupportedDestinationTokens=qc;exports.normalizeIconUrl=ne;exports.registerStripeOnramp=Cd;exports.setDevApiUrl=cm;exports.setStripeOnrampApiUrl=td;exports.setStripeOnrampPublishableKey=ed;exports.useAllowedCountry=pc;exports.useStripeOnramp=cd;exports.useTheme=B;exports.useUnifold=Ck;