@unifold/connect-react-native 0.1.55 → 0.1.57
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.d.mts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var ta=require('react'),reactNative=require('react-native'),Ir=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),Sh=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Tf=require('@react-native-async-storage/async-storage'),reactNativeWebview=require('react-native-webview'),Sx=require('react-native-qrcode-svg/src/genMatrix');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 ta__namespace=/*#__PURE__*/_interopNamespace(ta);var Ir__default=/*#__PURE__*/_interopDefault(Ir);var Sh__default=/*#__PURE__*/_interopDefault(Sh);var Tf__default=/*#__PURE__*/_interopDefault(Tf);var Sx__default=/*#__PURE__*/_interopDefault(Sx);var dh=e=>{throw TypeError(e)};var eC=(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 Ap=(e,t,r)=>t.has(e)||dh("Cannot "+r);var y=(e,t,r)=>(Ap(e,t,"read from private field"),r?r.call(e):t.get(e)),pe=(e,t,r)=>t.has(e)?dh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,o)=>(Ap(e,t,"write to private field"),t.set(e,r),r),Wt=(e,t,r)=>(Ap(e,t,"access private method"),r);var sc=(e,t,r,o)=>({set _(n){G(e,t,n);},get _(){return y(e,t,o)}});var Op={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)"}},Vp=Op;function vd(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ac(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,k)=>{let d=o?.[p]?.[g];if(d!==void 0)return d;let f=t?.[p]?.[g];return f!==void 0?f:k},i={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:i,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:vd(i,s)},transferCrypto:{depositAddress:{card:vd(i,a)}},depositCard:{quoteProvider:{card:vd(i,l)}},depositTracker:{executionRow:{card:vd(i,c)}}}}function Lp(e,t,r){let n={...Op[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Bp=ta.createContext(null);function z(){let e=ta.useContext(Bp);if(!e){let t=Vp.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ac(t,void 0,"dark"),isDark:true}}return e}function Ct({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=z(),l=i??a.primary,c=s??a.primary,p=ta.useRef(new reactNative.Animated.Value(0)).current,g=ta.useId(),k=ta.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),d=(e-t)/2,f=2*Math.PI*d,S=e/2,h=o??Math.max(0,Math.round(e-t*2-8)),w=(e-h)/2;ta.useEffect(()=>{let I=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),x=requestAnimationFrame(()=>I.start());return ()=>{cancelAnimationFrame(x),I.stop();}},[p]);let v=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:v}]},children:jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ir.Defs,{children:jsxRuntime.jsxs(Ir.LinearGradient,{id:k,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Ir.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(Ir.Circle,{cx:S,cy:S,r:d,stroke:`url(#${k})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${S}, ${S}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:w+1.5,left:w,width:h,height:h,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Wp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Qa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $o({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $t({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ka({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.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(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.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 It({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function gs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function En({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function di({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.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 Jn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Id({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.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(Ir.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function hh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ir.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ir.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function gh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bh({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Ir__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ir.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 wh({size:e=24}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ir.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 Ja({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=ta.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=ta.useMemo(()=>{let d=o?.[l];return Lp(l,d,r)},[l,o,r]),p=ta.useMemo(()=>ac(c,s,l),[c,s,l]),g=ta.useMemo(()=>i?{regular:i.regular||n,medium:i.medium||n,semibold:i.semibold||n,bold:i.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,i]),k=ta.useMemo(()=>({mode:l,colors:c,fonts:g,components:p,isDark:l==="dark"}),[l,c,g,p]);return jsxRuntime.jsx(Bp.Provider,{value:k,children:e})}var mc={damping:28,stiffness:300,mass:.8},PC=80,FC=500;function rr({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,onBackdropPress:n,enablePanDownToClose:i=true,showHandle:s=true,heightPercent:a,maxHeightPercent:l,startExpanded:c=false,noPadding:p=false,borderTopLeftRadius:g=24,borderTopRightRadius:k=24,marginHorizontal:d,marginBottom:f,overlay:S,useModal:h=true}){let{colors:w}=z(),{height:v}=reactNative.useWindowDimensions(),I=ta.useRef(v);v>I.current&&(I.current=v);let x=reactNative.Platform.OS==="android"?I.current:v,[P,m]=ta.useState(false),u=ta.useRef(e);u.current=e;let T=ta.useRef(0),b=a!=null&&a>=1,A=b||p?0:reactNative.Platform.OS==="ios"?34:24,O=l!=null&&a!=null&&l>a,F=a!=null?(O?l:a)*x:void 0,B=O?(l-a)*x:0,W=c?0:B,N=Sh.useSharedValue(x),Z=ta.useRef(null),je=ta.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),u.current||m(false);},[]);ta.useEffect(()=>{e?(Z.current&&(clearTimeout(Z.current),Z.current=null),m(true),N.value=Sh.withSpring(W,mc)):P&&(N.value=Sh.withTiming(x,{duration:250},te=>{te&&Sh.runOnJS(je)();}),Z.current=setTimeout(()=>{Z.current=null,je();},350));},[e]),ta.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current);},[]),ta.useEffect(()=>{P&&e&&(N.value=Sh.withSpring(W,mc));},[W,O]);let Y=ta.useCallback(()=>{o&&(n??t)();},[o,n,t]),rt=ta.useMemo(()=>{if(!(!i&&!O))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{T.current=N.value;},onPanResponderMove:(te,ke)=>{if(Math.abs(ke.dy)<4)return;let j=T.current+ke.dy;N.value=Math.max(0,j);},onPanResponderRelease:(te,ke)=>{if(!(Math.abs(ke.dy)<4)){if(i&&(ke.dy>PC||ke.vy>FC)){t();return}if(O){let j=B/2,Ie=N.value<j?0:B;N.value=Sh.withSpring(Ie,mc);}else N.value=Sh.withSpring(W,mc);}},onPanResponderTerminate:()=>{N.value=Sh.withSpring(W,mc);}}).panHandlers},[i,O,B,W,N,t]),oe=Sh.useAnimatedStyle(()=>({transform:[{translateY:N.value}]})),ce=Sh.useAnimatedStyle(()=>({opacity:Sh.interpolate(N.value,[0,x*.5,x],[.5,.25,0],Sh.Extrapolation.CLAMP)}));if(!P)return null;let ae=jsxRuntime.jsxs(reactNative.View,{style:[Ei.root,!h&&Ei.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(Sh__default.default.View,{style:[Ei.backdrop,ce],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:Y})}),jsxRuntime.jsxs(Sh__default.default.View,{style:[Ei.sheet,oe,{height:F,backgroundColor:w.background,borderTopLeftRadius:b?0:g,borderTopRightRadius:b?0:k,...d?{marginHorizontal:d,marginBottom:f??d+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:g,borderBottomRightRadius:k}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:F!=null?Ei.gestureRoot:Ei.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Ei.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Ei.handle,{backgroundColor:w.foreground+"33"}]})}),r,A>0&&jsxRuntime.jsx(reactNative.View,{style:{height:A}})]}),rt&&jsxRuntime.jsx(reactNative.View,{...rt,style:Ei.dragOverlay})]})]});return h?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[ae,S]}):ae}var kh={position:"absolute",left:0,right:0,top:0,bottom:0},Ei=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...kh,zIndex:9999},backdrop:{...kh,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}}),Yt=ta__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Yt.displayName="BottomSheetScrollView";function Za(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var DC="https://api.unifold.io",Up="__UnifoldDevApiBaseUrl__",Sr="pk_test_123",Dd={},gc=["ethereum","solana","bitcoin","n1"];function AC(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Up];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function or(){return AC()??DC}function Ad(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Sr=e.publishableKey;}e.defaultConfig&&(Dd=e.defaultConfig);}function _h(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[Up]=t:delete globalThis[Up];}function sa(){return or()}function Od(){return Sr}function Pr(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 kr(e){let t=e.startsWith("/")?e:`/${e}`;return `${or()}/api/public${t}`}function ye(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,or()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${or()}${e}`:`${or()}/api/public${e}`:""}async function Zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Dd.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||Dd.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Dd.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Sr;Pr(n);let i=await fetch(`${or()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function an(e,t){return e.find(r=>r.chain_type===t)}async function ln(e,t,r){let o=t||Sr;Pr(o);let n=await fetch(`${or()}/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 Vd(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 it(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 Wi(e,t){let r=e||Sr;Pr(r);let o=`${or()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Np(e,t){let r=t||Sr;Pr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${or()}/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 Ld(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Hp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 $p(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 yc(e,t){let r=t||Sr;Pr(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(`${or()}/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 bc(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 ui(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 wc(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 jp(){let e=await fetch(`${or()}/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 Bd(e,t,r){let o=e.find(i=>i.chain_id===r);if(o)return o.chain_name;let n=e.find(i=>i.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function aa(){let e=await fetch(`${or()}/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 Ed(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 qp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Cc(e,t){return Vd(e.deposit_wallet_id,t)}async function Wd(e,t,r,o,n){let i=n||Sr;Pr(i);let s=await fetch(`${or()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}async function Qp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Kp(e="usd",t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Gp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Yp(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 Jp(e,t,r){let o=r||Sr;Pr(o);let n=await fetch(`${or()}/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()}var hc=class extends Error{constructor(t,r,o){super(t),this.name="CoinbaseApiError",this.status=r,this.body=o;}};async function Mi(e,t){let r="";try{r=await e.text();}catch{}let o=t;if(r)try{let n=JSON.parse(r),i=typeof n.message=="string"&&n.message||typeof n.detail=="string"&&n.detail||typeof n.error_description=="string"&&n.error_description||"",s=typeof n.error=="string"&&n.error||typeof n.error_type=="string"&&n.error_type||typeof n.code=="string"&&n.code||typeof n.type=="string"&&n.type||"",a=[];i&&a.push(i),s&&a.push(`[${s}]`),o=a.length?a.join(" "):r;}catch{o=r;}return new hc(o,e.status,r)}function Md(e){return e?.status==="verified"}async function vh(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/v1/public/onramps/apple_pay/providers`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw await Mi(r,`Failed to fetch Apple Pay providers: ${r.statusText}`);return r.json()}async function Rh(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/v1/public/onramps/headless/coinbase/legal_agreements`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw await Mi(r,`Failed to fetch legal agreements: ${r.statusText}`);return r.json()}async function Ih(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/v1/public/onramps/verification_sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw await Mi(o,`Failed to create verification session: ${o.statusText}`);return o.json()}async function zd(e,t,r,o){let n=o||Sr;Pr(n);let i=await fetch(`${or()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/${t}/send`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":n},body:JSON.stringify({client_secret:r})});if(!i.ok)throw await Mi(i,`Failed to send verification code: ${i.statusText}`);return i.json()}async function Zp(e,t,r,o,n){let i=n||Sr;Pr(i);let s=await fetch(`${or()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/${t}/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({client_secret:r,code:o})});if(!s.ok)throw await Mi(s,`Failed to verify code: ${s.statusText}`);return s.json()}async function Ph(e,t,r){let o=r||Sr;Pr(o);let n=await fetch(`${or()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/token`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({client_secret:t})});if(!n.ok)throw await Mi(n,`Failed to exchange verification token: ${n.statusText}`);return n.json()}async function Fh(e,t,r){let o=r||Sr;Pr(o);let n=await fetch(`${or()}/v1/public/onramps/headless/coinbase/apple_pay/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o,"x-onramp-token":t},body:JSON.stringify(e)});if(!n.ok)throw await Mi(n,`Failed to create Apple Pay session: ${n.statusText}`);return n.json()}async function Sc(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/v1/public/onramps/headless/coinbase/apple_pay/limits`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify({phone:e})});if(!o.ok)throw await Mi(o,`Failed to fetch Apple Pay limits: ${o.statusText}`);let n=await o.json(),i=n.limits??[],s=n.limit_upgrade_options??void 0,a=i.some(p=>{let g=Number(p.remaining);return Number.isFinite(g)?g<=0:p.remaining==="0"}),l=s?.[0]?.status;return {limits:i,limitUpgradeOptions:s,limitReached:a,upgradeStatus:typeof l=="string"&&l?l:void 0}}async function Dh(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/v1/public/onramps/headless/coinbase/apple_pay/limits/upgrade`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw await Mi(o,`Failed to request limit upgrade: ${o.statusText}`);return o.json()}function Oh({size:e=28}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Ir.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Ir.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Ir.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 Xa({size:e=28}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ir.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Ir.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(Ir.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Ir.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Ir.Defs,{children:jsxRuntime.jsx(Ir.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Ir.Rect,{width:28,height:28,fill:"white"})})})]})}function Eh({size:e=28}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ir.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.Defs,{children:jsxRuntime.jsx(Ir.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Ir.Rect,{width:28,height:28,fill:"white"})})})]})}function rl({size:e=28}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Ir.Defs,{children:[jsxRuntime.jsxs(Ir.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ir.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ir.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Ir.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Ir.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.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 Wh({size:e=28}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Ir.G,{children:[jsxRuntime.jsx(Ir.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Ir.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 Ud=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Oh},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Xa},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Eh},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:rl},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Wh}];function Nd(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Hd(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 ol(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ud.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ud.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function xr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:i}=z(),s=r==="back",a=s?jsxRuntime.jsx(Ka,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx($t,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:bs.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:s?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:bs.headerWithTitle,children:[s?l:o??jsxRuntime.jsx(reactNative.View,{style:bs.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[bs.headerTitleText,{color:n.header.titleColor},...i.bold?[{fontFamily:i.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),s?jsxRuntime.jsx(reactNative.View,{style:bs.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:s?bs.headerWithTitle:bs.header,children:[s?l:jsxRuntime.jsx(reactNative.View,{style:bs.headerSpacer}),!s&&l]})}var $d={paddingTop:8,paddingBottom:8},bs=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...$d},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...$d,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 Xo({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=z();return e?jsxRuntime.jsx(reactNative.Text,{style:[Mh.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Mh.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Mh=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function Zn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ta.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 nf({quote:e,label:t,address:r,last:o,hideDivider:n}){let[i,s]=ta.useState(false),{colors:a,components:l}=z(),c=()=>{reactNative.Clipboard.setString(r),s(true),setTimeout(()=>s(false),2e3);},p=Nd(r);return jsxRuntime.jsxs(ta.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:i?jsxRuntime.jsx(It,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(Gn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var jd={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function nl({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=z(),i=e.toLowerCase(),s=jd[i]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:s,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function qd({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:i}){let{colors:s,components:a,fonts:l}=z(),c=kr(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ol(r);return jsxRuntime.jsxs(reactNative.View,{style:[Wn.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},i],children:[jsxRuntime.jsxs(reactNative.View,{style:Wn.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Wn.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(co,{size:16,color:s.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Wn.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Wn.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Wn.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Wn.tokenIcon,{backgroundColor:jd[t.toLowerCase()]??s.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Wn.networkBadge,{borderColor:s.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Wn.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Wn=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 mi(){let{colors:e,fonts:t,components:r}=z(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return ta.useMemo(()=>{let l=s.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:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},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:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},g={heroBox:{backgroundColor:s.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:l,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},k=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:k,borderBottomRightRadius:k,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},f={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},S={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:g,pm:d,wallet:f,flow:S,amount:p}},[e,t,o,n,i,s,a])}var Nh="",Hh;function Qd(e){Nh=e;}function Kd(e){Hh=e;}function cn(){let e=Nh||Od();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function dn(){return Hh??sa()}async function _c(){let e=`${dn()}/v1/public/onramps/headless/stripe/config`,t=cn(),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");let n=typeof o.merchant_identifier=="string"&&o.merchant_identifier.trim().length>0?o.merchant_identifier.trim():null;return {publishableKey:o.publishable_key,merchantIdentifier:n}}async function $h(){return (await _c()).publishableKey}async function sf(e){let t=await fetch(`${dn()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":cn(),"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 jh(e,t){let r=await fetch(`${dn()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":cn(),"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 af(e,t){let r=await fetch(`${dn()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":cn(),"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 qh(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(`${dn()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":cn(),"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 Qh(e,t){let r=await fetch(`${dn()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":cn(),"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 zi(e,t){let r=`${dn()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":cn(),"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 Kh(e){let t=`${dn()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":cn(),"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 Gh(e,t){let r=`${dn()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":cn(),"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 lf(e,t){let r=await fetch(`${dn()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":cn(),"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 cf(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(`${dn()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":cn(),"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 df(e,t){let r=await fetch(`${dn()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":cn(),"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 Yh(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(`${dn()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":cn(),"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 ws(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 Jh(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${dn()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":cn()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function iS({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Ir__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Ir.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Ir.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Ir.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(Ir.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(Ir.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 sS({size:e=24}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Ir.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Ir.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Ir.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function aS({size:e=24}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Ir.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Ir.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Ir.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Ir.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 pf({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Qa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(iS,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(sS,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(aS,{size:t}):jsxRuntime.jsx(Qa,{size:t*.75,color:r,strokeWidth:1.75})}function Gd(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 mf={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function hf(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 rg({status:e,colors:t,fontFamily:r}){let o=hf(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:mf[e]??e})})}function og({count:e=4}){let{colors:t,components:r}=z(),o=ta.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,i=Math.min(r.card.borderRadius??12,14);return ta.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:il.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[il.row,{backgroundColor:t.card,borderRadius:i,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:il.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[il.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[il.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[il.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var il=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 ng({active:e,interval:t=15e3,color:r}){let o=ta.useRef(new reactNative.Animated.Value(0)).current;return ta.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:i})=>{i&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function ig({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=z(),[i,s]=ta.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),s(true),setTimeout(()=>s(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=hf(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",k=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,S=ws(f?.icon_urls,f?.icon_url),h=ol(l?.destination_network??""),w=l?.wallet_address?Nd(l.wallet_address):null,v=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,I=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,x=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase()):null,P=[{label:"Amount",value:g},{label:"Received",value:`${k} ${d}`},...x?[{label:"Payment",value:x}]:[],{label:"Network",value:h},...w?[{label:"Wallet",value:w}]:[],...v?[{label:"Network Fee",value:v}]:[],...I?[{label:"Transaction Fee",value:I}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(xr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Yt,{style:xo.scroll,contentContainerStyle:xo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xo.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(nl,{currency:d||"USD",tokenIconUrl:S,size:64}),jsxRuntime.jsx(reactNative.View,{style:[xo.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx($o,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx($t,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(It,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:xo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xo.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[xo.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:mf[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[xo.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Gd(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[xo.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xo.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xo.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:[xo.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),i?jsxRuntime.jsx(It,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Gn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),P.map(m=>jsxRuntime.jsx(ta__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:xo.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xo.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:m.label}),jsxRuntime.jsx(reactNative.Text,{style:[xo.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:m.value})]})},m.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[xo.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:xo.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xo.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[xo.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var xo=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 ag({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:i}=z(),[s,a]=ta.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:gi.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:gi.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(hh,{size:20,color:o.foreground,strokeWidth:2})}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:gi.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[gi.menu,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius??12,borderWidth:i.card.borderWidth,borderColor:i.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:gi.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx($o,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[gi.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:gi.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(Jo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[gi.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:gi.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(gh,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[gi.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var gi=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 SS=[50,100,500],TS=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function cg(e){return e.charAt(0).toUpperCase()+e.slice(1)}function kS(e){return e.card?`${cg(e.card.brand)} ${cg(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Xd({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:i,paymentSelectorPosition:s="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:k,onConfirm:d,onCancel:f,sheetBorderTopLeftRadius:S,sheetBorderTopRightRadius:h,accessToken:w,showHistoryProgressBar:v=true,onLogout:I,onRequestKYC:x,showSwitchAccount:P=true,inputDisabled:m=false}){let u=mi(),{colors:T,components:b,fonts:A}=z(),O=S??b.card.borderRadius,F=h??b.card.borderRadius,[B,W]=ta.useState(e),[N,Z]=ta.useState(r?"apple_pay":g.length>0?g[0].id:null),je=ta.useRef(false),Y=_=>{je.current=true,Z(_);};ta.useEffect(()=>{je.current||r||g.length>0&&Z(g[0].id);},[g,r]);let[rt,oe]=ta.useState(false),[ce,ae]=ta.useState("select"),[te,ke]=ta.useState(null),j=ta.useRef(false);ta.useEffect(()=>{l&&c&&/saving/i.test(c)&&ae("card");},[l,c]);let Ie=i,pt=Ie!=null&&Ie>0,Ge=ta.useMemo(()=>{if(o)return [];let _=SS.map(C=>({label:`$${C}`,amount:String(C),disabled:false}));return _.push({label:"MAX",amount:pt?String(Ie):"0",disabled:!pt}),_},[o,pt,Ie]),Se=_=>{if(_==="\u232B"){W(C=>C.slice(0,-1));return}if(_==="."){if(B.includes("."))return;W(C=>C===""?"0.":C+".");return}W(C=>{let M=C.indexOf(".");return M!==-1&&C.length-M>2?C:C==="0"&&_!=="."?_:C+_});},qe=B===""?"0":B,ot=parseFloat(B),Ye=n!=null&&!isNaN(ot)&&ot>0&&ot<n,dt=Ie!=null&&Ie>0&&!isNaN(ot)&&ot>Ie,st=B!==""&&!isNaN(ot)&&ot>0&&!Ye&&!dt,Me=r||g.length>0,be=s==="header",we=ta.useMemo(()=>{let _=[];r&&_.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let C of g)_.push({id:C.id,label:kS(C),hint:C.card?`Expires ${C.card.exp_month}/${C.card.exp_year}`:C.type,brand:C.card?.brand,isApplePay:false});return _},[r,g]),ze=we.find(_=>_.id===N),ht=N!=null&&N!=="apple_pay",xt=ze?ze.label:ht&&te?te:ht?"Card":"Pay With",lr=ze?!ze.isApplePay:ht,Ue=ze?.brand??te??void 0,[me,Je]=ta.useState(false),[Qe,Ve]=ta.useState([]),[he,Ne]=ta.useState(false),[vt,Vt]=ta.useState(null),[Ht,lt]=ta.useState(null),er=ta.useRef(null);er.current=Ht;let Xe=ta.useRef(false);Xe.current=me;let yt=ta.useCallback(async(_=false)=>{if(w){_||(Ne(true),Vt(null));try{let C=await Kh(w);if(!Xe.current)return;let M=Array.isArray(C.data)?C.data:Array.isArray(C)?C:[];Ve(M),_||Vt(null);let q=er.current?.id;if(q){let J=M.find(K=>K.id===q);J&<(J);}}catch(C){if(!Xe.current)return;_||Vt(C?.message??"Failed to load history");}finally{!_&&Xe.current&&Ne(false);}}},[w]),gt=ta.useCallback(()=>{Je(true),yt();},[yt]);ta.useEffect(()=>{if(!me||!w)return;let _=setInterval(()=>yt(true),15e3);return ()=>clearInterval(_)},[me,w,yt]);let De=ta.useCallback(_=>{switch(_){case "history":gt();break;case "kyc":x?.();break;case "logout":I?.();break}},[gt,x,I]),X=!!w||!!x||!!I?jsxRuntime.jsx(ag,{onSelect:De,showKycOption:!!x,showSwitchAccount:P&&!!I}):void 0,Pe=Me?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[be?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(ae("select"),oe(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[ze?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):lr?jsxRuntime.jsx(pf,{sublabel:Ue,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:xt}),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(xr,{onPress:f,title:"Enter amount",leftAction:X}),be&&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,qe==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",qe]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),Ye&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:T.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),dt&&Ie!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:T.warning}],children:["Maximum amount is $",Ie.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!be&&Pe,Ge.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Ge.map(_=>{let C=!_.disabled&&B===_.amount&&B!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,C&&{backgroundColor:T.primary},_.disabled&&{opacity:.4}],activeOpacity:.7,disabled:_.disabled||l,onPress:()=>W(_.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,C&&{color:T.primaryForeground}],children:_.label})},_.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:TS.map((_,C)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:_.map(M=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||m)&&{opacity:.3}],onPress:()=>Se(M),activeOpacity:.6,disabled:l||m,children:jsxRuntime.jsx(reactNative.Text,{style:M==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:M})},M))},C))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!st||l||m)&&u.form.continueBtnDisabled],onPress:()=>st&&!l&&!m&&d(B,N),disabled:!st||l||m,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!st||m)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!rt&&p?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:p}):!rt&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(rr,{visible:rt,onClose:()=>{l||(oe(false),ae("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:O,borderTopRightRadius:F,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:ce==="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:()=>oe(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx($t,{size:16,color:T.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Yt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[we.map(_=>{let C=N===_.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,C&&{borderColor:T.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{Y(_.id),ke(_.isApplePay?null:_.label),oe(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(pf,{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(It,{size:18,color:T.primary,strokeWidth:2.5})]},_.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!j.current){j.current=true;try{let _=await k?.();_&&(Y(_.token),ke(_.sublabel),oe(!1));}finally{j.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||ae("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(Ka,{size:20,color:T.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:T.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&st&&a(false,B);},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:T.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(rr,{visible:me,onClose:()=>{Je(false),lt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:O,borderTopRightRadius:F,children:Ht?jsxRuntime.jsx(ig,{session:Ht,onBack:()=>lt(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(xr,{onPress:()=>Je(false),title:"Purchase History"}),v&&jsxRuntime.jsx(ng,{active:me&&!he&&Qe.length>0,color:T.primary}),he?jsxRuntime.jsx(og,{}):vt?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:vt})}):Qe.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:T.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Yt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:Qe.map(_=>{let C=_.transaction_details,M=C?.source_amount?`$${parseFloat(C.source_amount).toFixed(2)}`:"\u2014",q=(C?.destination_currency??"").toUpperCase(),J=C?.destination_amount?`${parseFloat(C.destination_amount).toFixed(2)} ${q}`:"",K=Gd(_.created),_e=_.destination_token_metadata,et=ws(_e?.icon_urls,_e?.icon_url),L=ws(_e?.chain?.icon_urls,_e?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>lt(_),children:[jsxRuntime.jsx(nl,{currency:q||"USD",tokenIconUrl:et,networkIconUrl:L,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:M}),J?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:J}):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(rg,{status:_.status,colors:T,fontFamily:A.regular}),K?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:T.foregroundMuted,fontFamily:A.regular},children:K}):null]}),jsxRuntime.jsx(co,{size:14,color:T.foregroundMuted,strokeWidth:2})]})]},_.id)})})]})})]})}function eu({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let i=mi(),{colors:s,fonts:a,components:l}=z(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[k,d]=ta.useState(1),[f,S]=ta.useState(e.firstName??""),[h,w]=ta.useState(e.lastName??""),[v,I]=ta.useState(e.dobMonth??""),[x,P]=ta.useState(e.dobDay??""),[m,u]=ta.useState(e.dobYear??""),[T,b]=ta.useState(e.addressLine1??""),[A,O]=ta.useState(e.addressLine2??""),[F,B]=ta.useState(e.city??""),[W,N]=ta.useState(e.state??""),[Z,je]=ta.useState(e.postalCode??""),[Y,rt]=ta.useState(e.country??"US"),[oe,ce]=ta.useState(e.idNumber??""),ae=ta.useRef(null),te=ta.useRef(null),ke=ta.useRef(null),j=ta.useRef(null),Ie=ta.useRef(null),pt=ta.useRef(null),Ge=ta.useRef(null),Se=ta.useRef(null),qe=p[k-1],ot=()=>{switch(qe){case "name":return f.trim().length>0&&h.trim().length>0;case "dob":return v.length===2&&x.length===2&&m.length===4;case "address":return T.trim().length>0&&F.trim().length>0&&W.trim().length>0&&Z.trim().length>0;case "ssn":return oe.trim().length>0;default:return false}},Ye=()=>{ot()&&(k<g?d(we=>we+1):o({firstName:f,lastName:h,idNumber:oe,dobMonth:v,dobDay:x,dobYear:m,addressLine1:T,addressLine2:A,city:F,state:W,postalCode:Z,country:Y}));},dt=()=>{k>1?d(we=>we-1):n();},st={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:Me}=st[qe],be=[oo.stepCounter,{color:s.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:oo.header,children:[jsxRuntime.jsx(reactNative.View,{style:oo.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:oo.iconButton,onPress:dt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:k>1?"Back":"Cancel",children:jsxRuntime.jsx(lc,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:oo.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:be,children:[k," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:oo.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:oo.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx($t,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:oo.progressTrack,children:Array.from({length:g}).map((we,ze)=>jsxRuntime.jsx(reactNative.View,{style:[oo.progressSegment,{backgroundColor:ze<k||ze+1===k?s.primary:s.border}]},ze))}),jsxRuntime.jsx(Yt,{style:i.form.flex,contentContainerStyle:oo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[i.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:Me}),qe==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ni,{form:i.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ae.current?.focus()})}),jsxRuntime.jsx(Ni,{form:i.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ae,style:i.form.input,placeholder:"Doe",placeholderTextColor:c,value:h,onChangeText:w,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ye})})]}),qe==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:oo.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:oo.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,oo.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,oo.dobInput],placeholder:"MM",placeholderTextColor:c,value:v,onChangeText:we=>{let ze=we.replace(/\D/g,"").slice(0,2);I(ze),ze.length===2&&te.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:oo.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,oo.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:[i.form.input,oo.dobInput],placeholder:"DD",placeholderTextColor:c,value:x,onChangeText:we=>{let ze=we.replace(/\D/g,"").slice(0,2);P(ze),ze.length===2&&ke.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:oo.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,oo.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ke,style:[i.form.input,oo.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:m,onChangeText:we=>{let ze=we.replace(/\D/g,"").slice(0,4);u(ze);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ye})]})]}),qe==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ni,{form:i.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:T,onChangeText:b,returnKeyType:"next",onSubmitEditing:()=>j.current?.focus()})}),jsxRuntime.jsx(Ni,{form:i.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:j,style:i.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:A,onChangeText:O,returnKeyType:"next",onSubmitEditing:()=>Ie.current?.focus()})}),jsxRuntime.jsx(Ni,{form:i.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ie,style:i.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:F,onChangeText:B,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>pt.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:oo.row,children:[jsxRuntime.jsx(reactNative.View,{style:[i.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Ni,{form:i.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:pt,style:i.form.input,placeholder:"CA",placeholderTextColor:c,value:W,onChangeText:we=>N(we.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ge.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:i.form.flex,children:jsxRuntime.jsx(Ni,{form:i.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:i.form.input,placeholder:"94001",placeholderTextColor:c,value:Z,onChangeText:je,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Se.current?.focus()})})})]}),jsxRuntime.jsx(Ni,{form:i.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:i.form.input,placeholder:"US",placeholderTextColor:c,value:Y,onChangeText:we=>rt(we.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ye})})]}),qe==="ssn"&&jsxRuntime.jsxs(Ni,{form:i.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:oe,onChangeText:ce,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ye}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,oo.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t&&k>=g?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!ot()&&i.form.continueBtnDisabled],onPress:Ye,disabled:!ot(),children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!ot()&&i.form.continueBtnTextDisabled],children:k>=g?"Submit":"Continue"})})})]})})}function Ni({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 oo=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 kf="@unifold/stripe_oauth";async function ug(){try{let e=await Tf__default.default.getItem(kf);return e?JSON.parse(e):null}catch{return null}}async function xf(e){try{await Tf__default.default.setItem(kf,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ll(){try{await Tf__default.default.removeItem(kf);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var DS=5,vs=null,_f=false,vf={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function tu(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:i,authorize:s,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:k}=stripeReactNative.useOnramp(),[d,f]=ta.useState(r),[S,h]=ta.useState(!!e?.externalUserId),[w,v]=ta.useState(false),[I,x]=ta.useState(false),[P,m]=ta.useState(""),[u,T]=ta.useState(null),[b,A]=ta.useState(e?.email??""),[O,F]=ta.useState(e?.phone??""),[B,W]=ta.useState(""),[N,Z]=ta.useState("US"),[je,Y]=ta.useState(""),[rt,oe]=ta.useState(""),ce=ta.useRef(""),ae=ta.useRef(""),te=ta.useRef(""),[ke,j]=ta.useState(false),[Ie,pt]=ta.useState(false),Ge=ta.useRef(0),Se=ta.useRef(false),qe=ta.useRef(false),ot=ta.useRef(false),Ye=ta.useRef(false),dt=ta.useRef(e?.email??""),st=ta.useRef(false),Me=ta.useRef(null),be=ta.useRef(""),we=ta.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ze=ta.useRef(null),[ut,ht]=ta.useState(0),[xt,lr]=ta.useState(vf),[Ue,me]=ta.useState(e?.defaultWalletAddress??""),[Je,Qe]=ta.useState(""),[Ve,he]=ta.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ne,vt]=ta.useState(e?.defaultSourceAmount??"100"),[Vt,Ht]=ta.useState(e?.defaultSourceCurrency??"usd"),[lt,er]=ta.useState(e?.defaultDestinationCurrency??"usdc"),[Xe,yt]=ta.useState(null),[gt,De]=ta.useState(),[at,X]=ta.useState(),[Pe,_]=ta.useState(false),C=ta.useRef(null),M=ta.useRef(false),q=ta.useRef(0),J=ta.useRef(e?.onComplete),K=ta.useRef(e?.onError),_e=ta.useRef(e?.onStepChange),et=ta.useRef(r);ta.useEffect(()=>{J.current=e?.onComplete;},[e?.onComplete]),ta.useEffect(()=>{K.current=e?.onError;},[e?.onError]),ta.useEffect(()=>{_e.current=e?.onStepChange;},[e?.onStepChange]);let L=ta.useRef(r);ta.useEffect(()=>{d!==L.current&&(_e.current?.(d,L.current),L.current=d),et.current=d;},[d]),ta.useEffect(()=>{I&&d!=="email"&&x(false);},[I,d]),ta.useEffect(()=>{S&&d!==r&&h(false);},[S,d,r]);let U=ta.useCallback((D,$,Te)=>{let Ae={code:D,message:$,step:et.current,stripeErrorCode:Te};T(Ae),m(""),K.current?.(Ae);},[]),kt=ta.useCallback(D=>{let $={sessionId:D.id,status:D.status,sourceAmount:D.transaction_details.source_amount,sourceCurrency:D.transaction_details.source_currency,destinationAmount:D.transaction_details.destination_amount,destinationCurrency:D.transaction_details.destination_currency,destinationNetwork:D.transaction_details.destination_network,walletAddress:D.transaction_details.wallet_address,fees:{networkFee:D.transaction_details.fees.network_fee_amount,transactionFee:D.transaction_details.fees.transaction_fee_amount}};return J.current?.($),$},[]),Le=ta.useCallback(()=>T(null),[]),Fe=D=>D.refresh_token??D.refresh?.refresh_token??"",bt=ta.useCallback((D,$,Te,Ae,He)=>{ae.current=$,ce.current=Te,e?.externalUserId&&xf({accessToken:$,refreshToken:Te,customerId:D,externalUserId:e.externalUserId,email:He||b,expiresAt:Date.now()+Ae*1e3});},[e?.externalUserId,b]),nt=ta.useCallback(async()=>{let D=ce.current;if(!D)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let $=await af(D,te.current??void 0),Te=$.access_token,Ae=Fe($)||D;return oe(Te),bt(te.current,Te,Ae,$.expires_in??3600),Te}catch($){return console.error("[tryRefreshAccessToken] refresh failed:",$?.message),await ll(),vs=null,ze.current=null,ae.current="",ce.current="",te.current="",oe(""),Y(""),null}},[bt]),ee=ta.useCallback(async D=>{try{return await D(ae.current)}catch($){let Te=$?.message??"";if(Te.includes("stripe_onramp_forbidden")||Te.includes("403")){let Ae=await nt();if(!Ae)throw U("authorization_error","Session expired. Please sign in again."),f("email"),$;return await D(Ae)}throw $}},[nt,U]);ta.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){_(false);return}let $=false;return stripeReactNative.isPlatformPaySupported().then(Te=>{$||_(Te);}),()=>{$=true;}},[e?.merchantIdentifier]),ta.useEffect(()=>(M.current=false,()=>{M.current=true,C.current&&clearTimeout(C.current);}),[]);let vr=ta.useRef(false);ta.useEffect(()=>{if(vr.current)return;if(!e?.externalUserId){ll(),vs=null,ze.current=null,h(false);return}let D=false;return (async()=>{try{let $=await ug();if(D||!$){D||h(!1);return}if($.externalUserId!==e.externalUserId){await ll(),vs=null,ze.current=null,D||h(!1);return}let Te=Date.now()>=$.expiresAt,Ae=$.accessToken,He=$.refreshToken;if(Te)try{let Rt=await af($.refreshToken,$.customerId);if(D)return;Ae=Rt.access_token,He=Rt.refresh_token??Rt.refresh?.refresh_token??$.refreshToken,await xf({accessToken:Ae,refreshToken:He,customerId:$.customerId,externalUserId:e.externalUserId,email:$.email,expiresAt:Date.now()+(Rt.expires_in??3600)*1e3});}catch(Rt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Rt?.message),await ll(),vs=null,ze.current=null,D||h(!1);return}if(D)return;if(vr.current=!0,Y($.customerId),te.current=$.customerId,oe(Ae),ae.current=Ae,ce.current=He,$.email&&(A($.email),dt.current=$.email),vs===$.customerId)ze.current=Promise.resolve({error:void 0});else {let Rt=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:$.customerId});Rt.error?console.error("[useStripeOnramp] restore configureSDK error:",Rt.error.message):vs=$.customerId,ze.current=Promise.resolve(Rt);}if(D)return;let Ze=()=>new Promise(Rt=>{let Tr=()=>{st.current&&be.current?Rt():setTimeout(Tr,200);};Tr();});try{if(await Promise.race([Ze(),new Promise((Tr,Bt)=>setTimeout(()=>Bt(new Error("timeout")),1e4))]),D)return;let Rt=be.current.toLowerCase();await p(Rt,we.current);}catch(Rt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Rt?.message);}if(D)return;try{let Tr=(await zi(te.current,ae.current)).kyc_tiers??[],Bt=Tr.find(Yo=>Yo.tier==="l0"),Kr=Tr.find(Yo=>Yo.tier==="l1"),wo=Tr.find(Yo=>Yo.tier==="l2"),eo=Bt?.verification_status==="verified",wn=Kr?.verification_status==="verified",Rr=wo?.verification_status==="verified",Ln=!!Bt?.verification_status&&Bt.verification_status!=="not_started";f(eo||wn||Rr?"session_params":Ln?"kyc_offer":"kyc");}catch{f("kyc");}}finally{D||h(false);}})(),()=>{D=true;}},[]),ta.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ke)return;let D=false;pt(true);async function $(){try{let[Te,Ae]=await Promise.all([Yh({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?Jh({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Rr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Rr?.message),null)):Promise.resolve(null)]);if(D)return;let He=e?.destinationChainType??"ethereum",Ze=Te.data.find(Rr=>Rr.chain_type===He);if(Ze?.address){let Rr=Ze.address.toLowerCase();me(Rr),be.current=Rr,Ze.recipient_address&&Qe(Ze.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",He,"in",Te.data?.length,"wallets");let Rt={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},Tr={8453:"base",1:"ethereum",137:"polygon"},Bt=Ae?.destination_network,Kr="none";if(Bt&&Rt[Bt])he(Rt[Bt]),we.current=Rt[Bt],Kr=Bt+" (from default_token API)";else if(e?.destinationChainId&&Tr[e.destinationChainId]){let Rr=Tr[e.destinationChainId];Rt[Rr]&&(he(Rt[Rr]),we.current=Rt[Rr]),Kr=Rr+" (from chain_id "+e.destinationChainId+")";}else Rt[He]&&(he(Rt[He]),we.current=Rt[He],Kr=He+" (from chain_type fallback)");Ae?.destination_currency&&er(Ae.destination_currency.toLowerCase());let wo=Ae?.destination_token_metadata,eo=ws(wo?.icon_urls,wo?.icon_url),wn=ws(wo?.chain?.icon_urls,wo?.chain?.icon_url);eo&&De(eo),wn&&X(wn),j(!0),st.current=!0;}catch(Te){if(D)return;console.error("[resolveWallet] Failed to resolve wallet:",Te?.message),j(true),st.current=true;}finally{D||pt(false);}}return Me.current=$(),()=>{D=true;}},[e?.publishableKey,e?.externalUserId,ut]);let ft=ta.useCallback(async()=>{if(ze.current)return ze.current;let D=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($=>($.error&&(console.error("[useStripeOnramp] configureSDK error:",$.error.message,$.error.code),ze.current=null),$)).catch($=>{throw console.error("[useStripeOnramp] configureSDK threw:",$?.message??$),ze.current=null,$});return ze.current=D,D},[o,e?.merchantDisplayName]);ta.useEffect(()=>{e?.externalUserId||ft();},[]);let tr=ta.useCallback(async D=>{if(!Se.current){Se.current=true,v(true),Le(),m("Creating auth intent...");try{let $=await sf(D);m("Waiting for authorization...");let Te=await s($);if(Te?.error){U("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(Te?.status==="Denied"){U("authorization_error","Authorization denied by user."),f("email");return}if(Te?.status!=="Consented"||!Te.customerId){U("authorization_error","Authorization was canceled."),f("email");return}m("Exchanging tokens...");let Ae=Te.customerId,He=await jh($,Ae),Ze=He.access_token,Rt=Fe(He);A(D),dt.current=D,Y(Ae),te.current=Ae,vs=Ae,oe(Ze),bt(Ae,Ze,Rt,He.expires_in??3600,D),m("Checking verification status...");try{let Bt=(await zi(Ae,Ze)).kyc_tiers??[],Kr=Bt.find(Eo=>Eo.tier==="l0"),wo=Bt.find(Eo=>Eo.tier==="l1"),eo=Bt.find(Eo=>Eo.tier==="l2"),wn=Kr?.verification_status==="verified",Rr=wo?.verification_status==="verified",Ln=eo?.verification_status==="verified",Yo=!!Kr?.verification_status&&Kr.verification_status!=="not_started";if(m(""),wn||Rr||Ln){Me.current&&(m("Resolving wallet..."),await Me.current,m(""));let Eo=be.current;if(Eo)try{let Cn=Eo.toLowerCase(),fs=we.current,Bn=await p(Cn,fs);Bn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",Bn.error.message),U("wallet_error",Bn.error.message,Bn.error.code),f("wallet")):f("session_params");}catch(Cn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Cn?.message),f("wallet");}else f("wallet");}else Yo?(await Mr(),m(""),f("kyc_offer")):f("kyc");}catch(Tr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",Tr?.message),m(""),f("kyc");}}catch($){U("authorization_error",$?.message??String($)),f("email");}finally{Se.current=false,v(false);}}},[s,Le,U,bt,p,Ve]),Mt=ta.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!b){U("validation_error","Please enter an email address.");return}v(true),Le(),m("");try{m("Configuring...");let D=await ft();if(D.error){U("configuration_error",D.error.message,D.error.code);return}m("Checking Link account...");let $=await n(b);if($.error){U("authorization_error",$.error.message,$.error.code);return}$.hasLinkAccount?await tr(b):(m(""),f("disclaimer"));}catch(D){U("unknown_error",D?.message??String(D));}finally{v(false);}},[Le,ft,b,U,n,tr]),qr=ta.useCallback(async()=>{if(!ot.current){if(!O){U("validation_error","Please enter your phone number.");return}ot.current=true,v(true),Le(),m("");try{m("Creating Link account...");let D=await i({email:b,phone:O,fullName:B||b,country:N||"US"});if(D.error){U("registration_error",D.error.message,D.error.code);return}await tr(b);}catch(D){U("registration_error",D?.message??String(D));}finally{ot.current=false,v(false);}}},[Le,N,b,U,B,O,i,tr]);ta.useEffect(()=>{if(d!=="email")return;let D=Ye.current||_f;if(D&&(Ye.current=false,_f=false),!e?.email||S)return;if(D){x(true);return}let $=++Ge.current,Te=false,Ae=()=>Te||Ge.current!==$;return e?.phone?(async()=>{v(true),Le();try{m("Configuring...");let He=await ft();if(Ae())return;if(He.error){U("configuration_error",He.error.message,He.error.code);return}m("Checking Link account...");let Ze=await n(e.email);if(Ae())return;if(Ze.error){U("authorization_error",Ze.error.message,Ze.error.code);return}if(Ze.hasLinkAccount){if(Ae())return;await tr(e.email);}else {if(Ae())return;m(""),f("disclaimer");}}catch(He){Ae()||U("unknown_error",He?.message??String(He));}finally{v(false);}})():(async()=>{v(true),Le();try{m("Configuring...");let He=await ft();if(Ae())return;if(He.error){U("configuration_error",He.error.message,He.error.code);return}m("Checking Link account...");let Ze=await n(e.email);if(Ae())return;if(Ze.error){U("authorization_error",Ze.error.message,Ze.error.code);return}if(Ze.hasLinkAccount){if(Ae())return;await tr(e.email);}else {if(Ae())return;m(""),f("disclaimer");}}catch(He){Ae()||U("unknown_error",He?.message??String(He));}finally{v(false);}})(),()=>{Te=true;}},[d,e?.email,e?.phone,S]);let Mr=ta.useCallback(async()=>{Me.current&&(m("Resolving wallet..."),await Me.current);let D=be.current;if(D)try{m("Registering wallet...");let $=D.toLowerCase(),Te=we.current;await p($,Te);}catch($){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",$?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),li=ta.useCallback(async(D,$)=>{v(true),Le(),m(""),lr(Ze=>({...Ze,...D}));let Te=!$,Ae=$??"kyc_offer",He=$?"kyc_l1":"kyc";try{let Ze=D.dobDay&&D.dobMonth&&D.dobYear,Rt=D.firstName&&D.lastName,Tr={};Rt&&(Tr.firstName=D.firstName,Tr.lastName=D.lastName),D.addressLine1&&(Tr.address={line1:D.addressLine1,line2:D.addressLine2||void 0,city:D.city,state:D.state,postalCode:D.postalCode,country:D.country}),D.idNumber&&(Tr.idNumber=D.idNumber),Ze&&(Tr.dateOfBirth={day:parseInt(D.dobDay,10),month:parseInt(D.dobMonth,10),year:parseInt(D.dobYear,10)});let Bt=await a(Tr);if(Bt?.error?.message&&(/no active link consumer/i.test(Bt.error.message)||/not be verified/i.test(Bt.error.message))){if(m("Verifying identity..."),!await on()){U("kyc_error","Please verify your identity to continue."),f(He);return}Bt=await a(Tr);}if(Bt?.error){let Rr=Te?"l0":"l1";try{let Yo=(await zi(te.current,ae.current)).kyc_tiers?.find(Eo=>Eo.tier===Rr);if(Yo?.verification_status==="verified"){let Eo=Te?"session_params":Ae;await Mr(),m(""),f(Eo);return}if(Yo?.verification_status==="rejected"){if(Te){await Mr(),m(""),f(Ae);return}U("kyc_error","Something went wrong. Please try again."),f(He);return}}catch(Ln){console.warn("[attachKyc] could not fetch verification status:",Ln?.message);}if(Te){await Mr(),m(""),f(Ae);return}U("kyc_error",Bt.error.message,Bt.error.stripeErrorCode??Bt.error.code),f(He);return}if(!(Bt&&Object.keys(Bt).length>0&&!Bt.error)){let Rr=Te?"l0":"l1";if(m("Verifying identity..."),(!te.current||!ae.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${Rr} \u2014 missing customerIdRef or accessTokenRef`),!Te)){U("kyc_error","Unable to verify identity. Please try again."),f(He);return}let Ln=te.current,Yo=ae.current,Eo=10,Cn=!1;if(Ln&&Yo)for(let fs=0;fs<Eo;fs++){try{let ia=(await zi(Ln,Yo)).kyc_tiers?.find(vp=>vp.tier===Rr);if(ia?.verification_status==="verified"){Cn=!0;break}if(ia?.verification_status==="rejected"){if(Te)break;console.warn(`[attachKyc] \u274C ${Rr} rejected:`,ia?.verification_errors),U("kyc_error","KYC verification was rejected. Please try again."),f(He);return}}catch(Bn){console.warn(`[attachKyc] ${Rr} poll error:`,Bn?.message);}await new Promise(Bn=>setTimeout(Bn,2e3));}if(!Cn&&!Te){console.warn(`[attachKyc] \u274C ${Rr} verification timed out after`,Eo,"attempts"),U("kyc_error","Identity verification is taking longer than expected. Please try again."),f(He);return}await Mr(),m(""),f(Te&&Cn?"session_params":Ae);return}m("Please review your KYC information...");let eo=await l(null);if(eo?.error){U("kyc_error",eo.error.message,eo.error.stripeErrorCode??eo.error.code),f(He);return}if(eo?.status==="UpdateAddress"){U("kyc_error","Please update your address and resubmit."),f(He);return}await Mr(),m(""),f(Te?"session_params":Ae);}catch(Ze){U("kyc_error",Ze?.message??String(Ze)),f(He);}finally{v(false);}},[a,Le,U,l,Mr]),on=ta.useCallback(async()=>{let D=dt.current||e?.email;if(!D)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(dt.current),"config.email:",e?.email),false;try{let $=await sf(D),Te=await s($);return Te?.status==="Consented"&&Te.customerId?(te.current=Te.customerId,Y(Te.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",Te?.status),!1)}catch($){return console.warn("[reestablishLinkSession] failed:",$?.message),false}},[s,e?.email]),yo=ta.useCallback(async()=>{if(!qe.current){qe.current=true,v(true),Le(),m("Launching identity verification...");try{let D=await c();if(D?.error?.message&&(/no active link consumer/i.test(D.error.message)||/not be verified/i.test(D.error.message))){if(m("Verifying identity..."),!await on()){U("identity_error","Please verify your identity to continue.");return}D=await c();}if(D?.error){let Te=D.error.message??"";if(/cancel/i.test(Te)){m("");return}U("identity_error",Te,D.error.code);return}m(""),Bo.current?(Bo.current=!1,f("session_params")):f("wallet");}catch(D){U("identity_error",D?.message??String(D));}finally{qe.current=false,v(false);}}},[Le,U,on,c]),Bo=ta.useRef(false);ta.useEffect(()=>{d==="identity"&&!w&&yo();},[d]);let nn=ta.useCallback(async()=>{if(!Ue){U("validation_error","Please enter a wallet address.");return}v(true),Le(),m("");try{let D=Ue.toLowerCase(),$=await p(D,Ve);if($?.error){console.warn("[registerWallet] error:",$.error.message),U("wallet_error",$.error.message,$.error.code);return}m(""),f("kyc_offer");}catch(D){console.error("[registerWallet] exception:",D?.message??String(D)),U("wallet_error",D?.message??String(D));}finally{v(false);}},[Le,U,Ue,Ve,p]);ta.useEffect(()=>{d==="wallet"&&ke&&Ue&&nn();},[d,ke,Ue]);let ko=ta.useCallback(D=>{M.current=false,q.current=0;let $=0,Te=async()=>{$+=1;let Ae=ae.current;try{let He=await Gh(D,Ae);if(M.current)return;q.current=0,He.status==="fulfillment_complete"?(yt(He),f("success")):C.current=setTimeout(Te,3e3);}catch(He){if(M.current)return;let Ze=He?.message??"";if((Ze.includes("stripe_onramp_forbidden")||Ze.includes("403"))&&await nt()&&!M.current){C.current=setTimeout(Te,1e3);return}if(q.current+=1,console.error(`[pollSessionStatus] poll #${$} error:`,Ze),q.current>=DS){U("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(Te,5e3);}};C.current=setTimeout(Te,3e3);},[U,nt]),na=ta.useCallback(()=>{if(et.current==="processing"&&Xe?.id){if(!ae.current){U("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Le(),q.current=0,C.current&&(clearTimeout(C.current),C.current=null),ko(Xe.id);}},[Le,U,ko,Xe?.id]),bo=ta.useCallback(async D=>{v(true),Le(),m("");try{m("Confirming purchase...");let $=await ee(Te=>Qh(D,Te));yt($),f("processing"),m(""),ko($.id);}finally{v(false);}},[Le,ko,ee]),Lt=ta.useRef(false),Qr=ta.useCallback(async()=>{if(!(!Xe||Lt.current)){Lt.current=true;try{v(!0),Le(),m("Refreshing quote...");let D=await ee($=>lf(Xe.id,$));yt(D),await bo(D.id);}catch{U("session_error","Something went wrong. Please try again."),f("quote");}finally{v(false),Lt.current=false;}}},[Le,U,bo,Xe,ee]),ne=ta.useCallback(async(D=false,$,Te)=>{let Ae=$??Ne;if(!Ae||isNaN(Number(Ae))||Number(Ae)<=0){U("validation_error","Please enter a valid amount.");return}$&&vt($),v(true),Le(),m("");try{let He=await ft();if(He.error){U("configuration_error",He.error.message,He.error.code);return}let Ze;if(Te)Ze=Te;else if(D){if(!e?.merchantIdentifier?.trim()){U("configuration_error","Apple Pay is not configured. Set the Apple Pay merchant identifier for this project on the Unifold dashboard."),f("session_params");return}m("Opening Apple Pay...");let Bt={applePay:{merchantCountryCode:"US",currencyCode:Vt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${lt.toUpperCase()} purchase + fees`,amount:Ae}]}},Kr=await g("PlatformPay",Bt);if(Kr?.error){let eo=Kr.error.message??"",wn=Kr.error.code??"";/cancel/i.test(eo)||/cancel/i.test(wn)||(U("payment_error",eo,wn),f("session_params"));return}if(!Kr?.displayData)return;m("Creating payment token...");let wo=await k();if(wo?.error){U("payment_error",wo.error.message,wo.error.code),f("session_params");return}Ze=wo.cryptoPaymentToken;}else {m("Select a payment method...");let Bt=await g("Card");if(Bt?.error){let wo=Bt.error.message??"",eo=Bt.error.code??"";/cancel/i.test(wo)||/cancel/i.test(eo)||(U("payment_error",wo,eo),f("session_params"));return}if(!Bt?.displayData)return;m("Creating payment token...");let Kr=await k();if(Kr?.error){U("payment_error",Kr.error.message,Kr.error.code),f("session_params");return}Ze=Kr.cryptoPaymentToken;}m("Creating onramp session...");let Rt=be.current||Ue;if(!Rt){U("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let Tr=await ee(Bt=>qh({cryptoCustomerId:te.current,paymentToken:Ze,sourceAmount:Number(Ae),sourceCurrency:Vt,destinationCurrency:lt,walletAddress:Rt,destinationNetwork:Ve},Bt));yt(Tr),m(""),D?await bo(Tr.id):f("quote");}catch{U("session_error","Something went wrong. Please try again."),f("session_params");}finally{v(false),m("");}},[Le,ft,g,k,lt,U,bo,vt,Ne,Vt,Ue,Ve,ee,e?.merchantIdentifier]),ue=ta.useCallback(async()=>{v(true),Le(),m("Select a payment method...");try{let D=await ft();if(D.error)return U("configuration_error",D.error.message,D.error.code),null;let $=await g("Card");if($?.error?.message&&(/no active link consumer/i.test($.error.message)||/not be verified/i.test($.error.message))){if(!await on())return U("authorization_error","Please verify your identity to add a payment method."),null;$=await g("Card");}if($?.error){let Ze=$.error.message??"",Rt=$.error.code??"";return /cancel/i.test(Ze)||/cancel/i.test(Rt)||U("payment_error",Ze,Rt),null}if(!$?.displayData)return null;let Ae=$.displayData;m("Saving payment method...");let He=await k();return He?.error?(U("payment_error",He.error.message,He.error.code),null):{token:He.cryptoPaymentToken,sublabel:Ae.sublabel??""}}catch(D){return U("session_error",D?.message??String(D)),null}finally{v(false),m("");}},[Le,ft,g,k,U,on]),zt=ta.useCallback(async()=>{if(Xe){v(true),Le(),m("");try{let D=await ee($=>lf(Xe.id,$));yt(D);}catch{U("session_error","Something went wrong. Please try again.");}finally{v(false);}}},[Le,U,Xe,ee]),ur=ta.useCallback(()=>{M.current=true,q.current=0,C.current&&(clearTimeout(C.current),C.current=null),f(r),v(false),x(false),m(""),T(null),A(e?.email??""),dt.current=e?.email??"",F(e?.phone??""),W(""),Z("US"),Y(""),te.current="",oe(""),ae.current="",ce.current="",j(false),pt(false),Me.current=null,ht(D=>D+1),lr(vf),me(""),be.current="",st.current=false,he(stripeReactNative.Onramp.CryptoNetwork.ethereum),vt(e?.defaultSourceAmount??"100"),Ht(e?.defaultSourceCurrency??"usd"),er(e?.defaultDestinationCurrency??"usdc"),Qe(""),De(void 0),X(void 0),yt(null),Ge.current+=1,Se.current=false,qe.current=false,ot.current=false;},[e,r]),Go=ta.useCallback(()=>{Bo.current=true,f("kyc_offer");},[]),sn=ta.useCallback(async()=>{await ll(),vs=null,ze.current=null,_f=true,Ye.current=true,M.current=true,q.current=0,C.current&&(clearTimeout(C.current),C.current=null),Ge.current+=1,Se.current=false,qe.current=false,ot.current=false,ae.current="",ce.current="",te.current="",be.current="",st.current=false,Me.current=null,oe(""),Y(""),A(e?.email??""),dt.current=e?.email??"",F(e?.phone??""),W(""),Z("US"),yt(null),T(null),v(false),x(false),m(""),lr(vf),me(""),j(false),pt(false),ht(D=>D+1),Qe(""),De(void 0),X(void 0),f(r);},[e?.email,e?.phone,r]);return {step:d,restoring:S,loading:w,status:P,error:u,email:b,phone:O,fullName:B,country:N,customerId:je,accessToken:rt,session:Xe,kycData:xt,walletAddress:Ue,resolvedRecipientAddress:Je,walletNetwork:Ve,sourceAmount:Ne,sourceCurrency:Vt,destinationCurrency:lt,tokenIconUrl:gt,networkIconUrl:at,applePaySupported:Pe,walletReady:ke,walletLoading:Ie,setStep:f,setStatus:m,setEmail:A,setPhone:F,setFullName:W,setCountry:Z,setWalletAddress:me,setWalletNetwork:he,setSourceAmount:vt,setSourceCurrency:Ht,setDestinationCurrency:er,checkEmail:Mt,register:qr,attachKyc:li,verifyIdentity:yo,requestKYCUpgrade:Go,kycUpgradeMode:Bo,logout:sn,registerWallet:nn,collectPaymentMethod:ne,addPaymentMethod:ue,refreshQuote:zt,confirmCheckout:Qr,reset:ur,clearError:Le,emitComplete:kt,resumeFulfillmentPolling:na,amountFirst:t,switchingAccount:I}}function pg({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:i}){let s=mi(),{colors:a,fonts:l,components:c}=z(),p=c.input.placeholderColor,[g,k]=ta.useState(e.dobMonth??""),[d,f]=ta.useState(e.dobDay??""),[S,h]=ta.useState(e.dobYear??""),[w,v]=ta.useState(e.idNumber??""),[I,x]=ta.useState(null),P=ta.useRef(null),m=ta.useRef(null),u=ta.useRef(null),T=g.length===2&&d.length===2&&S.length===4&&w.trim().length>0,b=()=>{if(!T)return;let O=parseInt(g,10),F=parseInt(d,10),B=parseInt(S,10),W=new Date().getFullYear();if(O<1||O>12){x("Please enter a valid month (01\u201312).");return}if(F<1||F>31){x("Please enter a valid day (01\u201331).");return}if(B<1900||B>W){x(`Please enter a valid year (1900\u2013${W}).`);return}x(null),o({dobMonth:g,dobDay:d,dobYear:S,idNumber:w});},A=I||r;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.jsx(xr,{onPress:t?i??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Yt,{style:s.form.flex,contentContainerStyle:wi.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:wi.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:wi.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:wi.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,wi.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,2);k(F),F.length===2&&P.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:wi.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:P,style:[s.form.input,wi.dobInput],placeholder:"DD",placeholderTextColor:p,value:d,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,2);f(F),F.length===2&&m.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:wi.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:m,style:[s.form.input,wi.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:S,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,4);h(F),F.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:wi.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:w,onChangeText:v,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:b,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),A?jsxRuntime.jsx(reactNative.Text,{style:[s.amount.inlineError,{marginTop:20}],children:A}):null]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!T&&s.form.continueBtnDisabled],onPress:b,disabled:!T,children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!T&&s.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var wi=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 fg({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ta.useRef(new reactNative.Animated.Value(.3)).current;return ta.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[sr.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:sr.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[sr.skeletonLine,{width:"60%"}]})]})}function mg({onRefresh:e,colors:t,fonts:r}){let[o,n]=ta.useState(10),i=ta.useRef(null);ta.useEffect(()=>(i.current=setInterval(()=>{n(l=>l<=1?(i.current&&clearInterval(i.current),0):l-1);},1e3),()=>{i.current&&clearInterval(i.current);}),[]);let s=ta.useCallback(()=>{o>0||(e(),n(10),i.current=setInterval(()=>{n(l=>l<=1?(i.current&&clearInterval(i.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,disabled:!a,style:sr.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(Ya,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[sr.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function bg({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:i=false,loadingTiers:s=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:k=false,currentLimit:d}){let f=mi(),{colors:S,fonts:h,components:w}=z(),v=[sr.card,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius??12,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],I=[...v,{opacity:.5}],x=l==="verified",P=l==="pending",m=l==="rejected",u=c==="verified",T=c==="pending",b=x&&u,A=!x,O=!u,F=x,B=(k||x)&&!b,W=N=>`$${N.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:f.form.screen,children:[jsxRuntime.jsx(xr,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:sr.content,children:[d!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[sr.limitBadge,{backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth,borderRadius:w.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.limitLabel,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[sr.limitValue,{color:S.foreground,fontFamily:h.semibold}],children:[W(d)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[sr.subtitle,{color:S.foregroundMuted,fontFamily:h.regular}],children:s?"Checking your verification status...":b?"All verification levels have been completed. Your limits are at the maximum available.":k?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fg,{borderRadius:w.card.borderRadius??12,backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth}),jsxRuntime.jsx(fg,{borderRadius:w.card.borderRadius??12,backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[A&&(P?jsxRuntime.jsxs(reactNative.View,{style:v,children:[jsxRuntime.jsxs(reactNative.View,{style:sr.pendingHeader,children:[jsxRuntime.jsx(Jo,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:S.foreground,fontFamily:h.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(mg,{onRefresh:n,colors:S,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[sr.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:S.primary,gradientTo:S.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[v,sr.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(Jo,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:sr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:S.foreground,fontFamily:h.semibold}],children:m?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:m?"Previous verification was unsuccessful. Please try again.":k?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(co,{size:18,color:S.foregroundMuted,strokeWidth:2})]})),O&&(T?jsxRuntime.jsxs(reactNative.View,{style:v,children:[jsxRuntime.jsxs(reactNative.View,{style:sr.pendingHeader,children:[jsxRuntime.jsx(Id,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:S.foreground,fontFamily:h.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(mg,{onRefresh:n,colors:S,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[sr.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:S.primary,gradientTo:S.primary})]})]}):F?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[v,sr.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Id,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:sr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:S.foreground,fontFamily:h.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(co,{size:18,color:S.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[I,sr.cardRow],children:[jsxRuntime.jsx(Id,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:sr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:sr.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,i?jsxRuntime.jsxs(reactNative.View,{style:sr.loaderRow,children:[jsxRuntime.jsx(Ct,{size:24,strokeWidth:2,gradientFrom:S.primary,gradientTo:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):b?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.continueBtnText,children:"Done"})}):B?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var sr=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 nu={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 Cg({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:i,components:s}=z(),a=[ri.link,{color:n.primary,fontFamily:i.medium}],l=s.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:ri.logoRow,children:jsxRuntime.jsx(bh,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:ri.scroll,contentContainerStyle:ri.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[ri.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ri.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[ri.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ri.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ri.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[ri.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ri.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 ri=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 Sg({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=z();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{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:s,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:n,progress:i,loading:o})]})]})})}function kg({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(Ct,{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(Xo,{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 _g({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:g}=z(),k=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[k?jsxRuntime.jsx(xr,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:$d}),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(Ct,{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&&i&&s&&jsxRuntime.jsx(qd,{sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Xo,{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 vg({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,tokenIconUrl:s,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=z(),g=t.transaction_details,k=Hd(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{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(nl,{currency:g.destination_currency,tokenIconUrl:s,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(Zn,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"You receive",value:`${k} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Zn,{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(Ct,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})}function Rg({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:c}){let p=z(),{colors:g,fonts:k,components:d}=p,[f,S]=ta.useState("");ta.useEffect(()=>{if(t)return;let v=f?`+1${f}`:"";a(v);},[f,a,t]);let h=ta.useCallback(v=>{S(v.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]});let w=f.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{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:Lc.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Lc.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Lc.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Lc.dialCode,{color:g.foreground,fontFamily:k.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Lc.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:h,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>w&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:i})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!w&&e.form.continueBtnDisabled],onPress:l,disabled:!w,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!w&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})})}var Lc=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 sT({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=z(),n=e.toLowerCase(),i=jd[n]??o.primary,s=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[ki.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:i}],children:jsxRuntime.jsx(reactNative.Text,{style:[ki.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[ki.checkBadge,{width:s,height:s,borderRadius:s/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(It,{size:s*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Ig({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:i,onDone:s}){let {colors:a,components:l,fonts:c}=z(),p=t.transaction_details,g=Hd(p.destination_amount,p.destination_currency),k=r||o||"";ol(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:s,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Yt,{style:e.form.flex,contentContainerStyle:ki.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ki.iconSection,children:[jsxRuntime.jsx(sT,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:ki.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ki.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ki.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[ki.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(qd,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:i,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},ki.detailCard],children:[jsxRuntime.jsx(Zn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(nf,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),k?jsxRuntime.jsx(nf,{quote:e.quote,label:"Recipient Address",address:k,last:true}):jsxRuntime.jsx(Zn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var ki=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 Pg({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:g}){let{colors:k,components:d}=z();if(t){let f=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!f&&jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]}),f&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{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:d.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Ud.map(f=>{let S=s===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,S&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(f.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,S&&e.wallet.rowTextSelected],children:f.label}),S&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(It,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},f.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:k.primaryForeground,gradientTo:k.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:p,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})})}function du({config:e,onClose:t}){let r=z(),o=mi(),{step:n,restoring:i,loading:s,status:a,error:l,email:c,phone:p,session:g,kycData:k,walletAddress:d,resolvedRecipientAddress:f,walletNetwork:S,sourceAmount:h,sourceCurrency:w,destinationCurrency:v,tokenIconUrl:I,networkIconUrl:x,applePaySupported:P,setStep:m,setEmail:u,setPhone:T,setWalletAddress:b,setWalletNetwork:A,setSourceAmount:O,setDestinationCurrency:F,checkEmail:B,register:W,attachKyc:N,verifyIdentity:Z,registerWallet:je,collectPaymentMethod:Y,addPaymentMethod:rt,confirmCheckout:oe,reset:ce,emitComplete:ae,resumeFulfillmentPolling:te,amountFirst:ke,customerId:j,accessToken:Ie,requestKYCUpgrade:pt,kycUpgradeMode:Ge,logout:Se,clearError:qe,switchingAccount:ot}=tu(e),Ye=!!e?.email&&!ot,dt=!!e?.phone,st=!!e?.publishableKey&&!!e?.externalUserId,[Me,be]=ta.useState(void 0),[we,ze]=ta.useState(void 0),[ut,ht]=ta.useState([]),[xt,lr]=ta.useState(false),[Ue,me]=ta.useState(false),[Je,Qe]=ta.useState(null),[Ve,he]=ta.useState(null),[Ne,vt]=ta.useState(null),[Vt,Ht]=ta.useState(false),lt=ta.useCallback(async()=>{await Se(),t?.();},[Se,t]);ta.useEffect(()=>{n!=="kyc_offer"||!j||!Ie||(Ht(true),zi(j,Ie).then(De=>{let at=De.kyc_tiers??[],X=at.find(C=>C.tier==="l0"),Pe=at.find(C=>C.tier==="l1"),_=at.find(C=>C.tier==="l2");X?.verification_status&&Qe(X.verification_status),Pe?.verification_status&&he(Pe.verification_status),_?.verification_status&&vt(_.verification_status);}).catch(De=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",De?.message);}).finally(()=>Ht(false)),d&&cf({destinationNetwork:S||"ethereum",walletAddress:d,accessToken:Ie,cryptoCustomerId:j}).then(De=>{let at=De.limits?.usd;if(at?.card?.length){let X=Math.max(...at.card.map(Pe=>Pe.limit));be(X);}}).catch(De=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",De?.message);}));},[n,j,Ie,d,S]),ta.useEffect(()=>{if(i||n!=="session_params"||!j||!Ie)return;let De=X=>{let Pe=X?.message??"";return Pe.includes("stripe_onramp_forbidden")||Pe.includes("403")},at=X=>{De(X)&<();};zi(j,Ie).then(X=>{let Pe=X.kyc_tiers??[],_=Pe.find(K=>K.tier==="l0"),C=Pe.find(K=>K.tier==="l1"),M=Pe.find(K=>K.tier==="l2"),q=!!C?.verification_status&&C.verification_status!=="not_started",J=M?.verification_status==="verified";lr(q),me(!!J),_?.verification_status&&Qe(_.verification_status),C?.verification_status&&he(C.verification_status),M?.verification_status&&vt(M.verification_status);}).catch(X=>{console.warn("[OnrampScreen] customer fetch error:",X?.message),at(X);}),df(j,Ie).then(X=>{ht(X.data??[]);}).catch(X=>{console.warn("[OnrampScreen] payment_tokens error:",X?.message),at(X);}),d&&cf({destinationNetwork:S||"ethereum",walletAddress:d,accessToken:Ie,cryptoCustomerId:j}).then(X=>{let Pe=X.limits?.usd;if(Pe?.card?.length){let _=Math.max(...Pe.card.map(C=>C.limit));be(_);}}).catch(X=>{console.warn("[OnrampScreen] transaction_limits error:",X?.message),at(X);}),bc(e?.publishableKey).then(X=>{let Pe=X.data?.find(_=>_.currency_code==="usd");Pe&&ze(Pe.minimum_amount);}).catch(X=>{console.warn("[OnrampScreen] fiat_currencies error:",X?.message);});},[i,n,j,Ie,d,S,ce,lt]);let er=async()=>{if(!(!j||!Ie))try{let De=await df(j,Ie);ht(De.data??[]);}catch(De){console.warn("[OnrampScreen] payment_tokens refresh error:",De?.message);let at=De?.message??"";(at.includes("stripe_onramp_forbidden")||at.includes("403"))&<();}},Xe=async()=>{let De=await rt();return De&&await er(),De},yt=e?.skipSuccessConfirmation===true;ta.useEffect(()=>{n==="success"&&yt&&g&&(ae(g),ce(),t?.());},[n,yt,g,ae,ce,t]),ta.useEffect(()=>{n==="register"&&dt&&W();},[n,dt,W]);let gt=()=>{ce(),t?.();};if(i)return jsxRuntime.jsx(reactNative.View,{style:[fT.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Cg,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>m("register"),onClose:()=>m("email")});if(n==="email")return jsxRuntime.jsx(Sg,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Ye,loading:s,error:l,status:a,email:c,setEmail:u,checkEmail:B,onClose:gt});if(n==="register")return jsxRuntime.jsx(Rg,{styles:o,hasPrefilledPhone:dt,loading:s,error:l,status:a,email:c,phone:p,setPhone:T,register:W,onClose:gt});if(n==="kyc")return jsxRuntime.jsx(eu,{initialData:k,loading:s,onComplete:N,onCancel:gt});if(n==="kyc_offer"){let X=Je==="verified"||Ve==="verified"||Ne==="verified",Pe=()=>{Ge.current&&(Ge.current=false),m("session_params");};return jsxRuntime.jsx(bg,{onSelectL1:()=>m("kyc_l1"),onSelectL2:()=>{Ge.current=true,m("identity");},onSkip:Pe,onClose:()=>{Ge.current?(Ge.current=false,m("session_params")):X?Pe():gt();},onRefresh:()=>{!j||!Ie||(Ht(true),zi(j,Ie).then(M=>{let q=M.kyc_tiers??[],J=q.find(et=>et.tier==="l0"),K=q.find(et=>et.tier==="l1"),_e=q.find(et=>et.tier==="l2");J?.verification_status&&Qe(J.verification_status),K?.verification_status&&he(K.verification_status),_e?.verification_status&&vt(_e.verification_status);}).catch(M=>{console.warn("[OnrampScreen] refresh customer fetch error:",M?.message);}).finally(()=>Ht(false)));},loading:s,loadingTiers:Vt,error:l?.message,l1Status:Ve??"not_started",l2Status:Ne??"not_started",l1Completed:xt,l2Completed:Ue,canPurchase:X,currentLimit:X?Me:void 0})}if(n==="kyc_l1"){let De=Ge.current?"session_params":"wallet";return jsxRuntime.jsx(pg,{initialData:k,loading:s,error:l?.message,onComplete:at=>{Ge.current&&(Ge.current=false),N(at,De);},onCancel:()=>{qe(),m("kyc_offer");},onClose:gt})}return n==="identity"?jsxRuntime.jsx(kg,{styles:o,loading:s,status:a,error:l,verifyIdentity:Z,onClose:()=>{Ge.current?(Ge.current=false,m("session_params")):gt();}}):n==="wallet"?jsxRuntime.jsx(Pg,{styles:o,hasAutoWallet:st,loading:s,error:l,status:a,walletAddress:d,walletNetwork:S,setWalletAddress:b,setWalletNetwork:A,setDestinationCurrency:F,registerWallet:je,onClose:gt}):n==="session_params"?jsxRuntime.jsx(Xd,{initialAmount:h,currency:w,applePaySupported:P,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:we,maxAmount:Me,paymentTokens:ut,onAddPaymentMethod:Xe,onCollectPayment:(De,at)=>{Y(De,at);},paymentLoading:s,paymentStatus:a,paymentError:l?.message??null,onConfirm:(De,at)=>{if(ke&&!j)O(De),m("email");else {let X=at==="apple_pay";Y(X,De,!X&&at?at:void 0);}},onCancel:gt,accessToken:Ie,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:lt,onRequestKYC:pt,showSwitchAccount:!Ye,inputDisabled:(Je!==null||Ve!==null)&&Je!=="verified"&&Ve!=="verified"&&Ne!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(vg,{styles:o,session:g,loading:s,error:l,status:a,confirmCheckout:oe,tokenIconUrl:I,networkIconUrl:x,onClose:gt,onBack:()=>m("session_params")}):n==="processing"?jsxRuntime.jsx(_g,{styles:o,error:l,status:a,loading:s,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??v,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:I,networkIconUrl:x,onClose:gt,onRetryStatusCheck:te}):n==="success"&&g&&!yt?jsxRuntime.jsx(Ig,{styles:o,session:g,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:I,networkIconUrl:x,onDone:()=>{ae(g),ce(),t?.();}}):null}var fT=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function uu({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:g,onClose:k,urlScheme:d="unifoldOnramp",paymentSelectorPosition:f,skipSuccessConfirmation:S=false,appName:h}){let{colors:w,fonts:v,components:I}=z(),x=e||Od(),[P,m]=ta.useState(""),[u,T]=ta.useState("loading"),[b,A]=ta.useState(null);ta.useEffect(()=>{let F=false;async function B(){try{x&&(Qd(x),Kd(sa()));let W=await _c();if(F)return;let N=W.merchantIdentifier??"";if(m(N),await stripeReactNative.initStripe({publishableKey:W.publishableKey,urlScheme:d,...N?{merchantIdentifier:N}:{}}),F)return;T("ready");}catch(W){if(F)return;console.error("[StripeOnramp] Init failed:",W),A(W?.message??"Failed to load Stripe configuration"),T("error");}}return B(),()=>{F=true;}},[x,d]);let O=ta.useMemo(()=>{let F={publishableKey:x,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:c,onError:p,onStepChange:g};return a&&(F.destinationTokenAddress=a),l&&(F.recipientAddress=l),t&&(F.email=t),r&&(F.phone=r),n&&(F.flowOrder=n),f&&(F.paymentSelectorPosition=f),F.skipSuccessConfirmation=S,F.merchantIdentifier=P,h&&(F.merchantDisplayName=h),F},[x,o,i,s,a,l,t,r,n,f,S,P,h,c,p,g]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ml.centered,{backgroundColor:w.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ml.errorText,{color:w.error,fontFamily:v.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ml.errorDetail,{color:w.foregroundMuted,fontFamily:v.regular}],children:b}),k&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ml.retryBtn,{backgroundColor:I.button.primaryBackground,borderRadius:I.button.borderRadius}],onPress:k,children:jsxRuntime.jsx(reactNative.Text,{style:[ml.retryBtnText,{color:I.button.primaryText,fontFamily:v.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ml.centered,{backgroundColor:w.background}],children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3,gradientFrom:w.primary,gradientTo:w.primary})}):jsxRuntime.jsx(du,{config:O,onClose:k})}var ml=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 Dg(){let{configure:e}=stripeReactNative.useOnramp(),t=ta.useRef(false);return ta.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 Ag="__unifold_stripe_onramp__";function pu(e){globalThis[Ag]=e;}function Og(){return globalThis[Ag]}pu(uu);var Ps=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 ma,Fs,hl,Vg,kT=(Vg=class extends Ps{constructor(){super();pe(this,ma);pe(this,Fs);pe(this,hl);G(this,hl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Fs)||this.setEventListener(y(this,hl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Fs))==null||t.call(this),G(this,Fs,void 0));}setEventListener(t){var r;G(this,hl,t),(r=y(this,Fs))==null||r.call(this),G(this,Fs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,ma)!==t&&(G(this,ma,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,ma)=="boolean"?y(this,ma):globalThis.document?.visibilityState!=="hidden"}},ma=new WeakMap,Fs=new WeakMap,hl=new WeakMap,Vg),fu=new kT;var xT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xi,ha,Lg,_T=(Lg=class{constructor(){pe(this,xi,xT);pe(this,ha,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,ha)&&e!==y(this,xi)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,xi),provider:e}),G(this,xi,e),process.env.NODE_ENV!=="production"&&G(this,ha,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,ha,true),y(this,xi).setTimeout(e,t)}clearTimeout(e){y(this,xi).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,ha,true),y(this,xi).setInterval(e,t)}clearInterval(e){y(this,xi).clearInterval(e);}},xi=new WeakMap,ha=new WeakMap,Lg),Bc=new _T;function Bg(e){setTimeout(e,0);}var Mg=typeof window>"u"||"Deno"in globalThis;function mn(){}function zg(e,t){return typeof e=="function"?e(t):e}function Ug(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ng(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ec(e,t){return typeof e=="function"?e(t):e}function Hg(e,t){return typeof e=="function"?e(t):e}function Of(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==Wc(s,t.options))return false}else if(!bl(t.queryKey,s))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||i&&!i(t))}function Vf(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(gl(t.options.mutationKey)!==gl(i))return false}else if(!bl(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Wc(e,t){return (t?.queryKeyHashFn||gl)(e)}function gl(e){return JSON.stringify(e,(t,r)=>Af(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function bl(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>bl(e[r],t[r])):false}var vT=Object.prototype.hasOwnProperty;function Df(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Eg(e)&&Eg(t);if(!o&&!(Af(e)&&Af(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let g=o?p:s[p],k=e[g],d=t[g];if(k===d){l[g]=k,(o?p<i:vT.call(e,g))&&c++;continue}if(k===null||d===null||typeof k!="object"||typeof d!="object"){l[g]=d;continue}let f=Df(k,d,r+1);l[g]=f,f===k&&c++;}return i===a&&c===i?e:l}function Eg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Af(e){if(!Wg(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Wg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Wg(e){return Object.prototype.toString.call(e)==="[object Object]"}function $g(e){return new Promise(t=>{Bc.setTimeout(t,e);})}function jg(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 Df(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 Df(e,t)}return t}function qg(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Qg(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var yl=Symbol();function mu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===yl&&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===yl?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Kg(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 hu=(()=>{let e=()=>Mg;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Gg(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var RT=Bg;function IT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=RT,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var So=IT();var wl,Ds,Cl,Yg,PT=(Yg=class extends Ps{constructor(){super();pe(this,wl,true);pe(this,Ds);pe(this,Cl);G(this,Cl,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,Ds)||this.setEventListener(y(this,Cl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ds))==null||t.call(this),G(this,Ds,void 0));}setEventListener(t){var r;G(this,Cl,t),(r=y(this,Ds))==null||r.call(this),G(this,Ds,t(this.setOnline.bind(this)));}setOnline(t){y(this,wl)!==t&&(G(this,wl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,wl)}},wl=new WeakMap,Ds=new WeakMap,Cl=new WeakMap,Yg),Sl=new PT;function FT(e){return Math.min(1e3*2**e,3e4)}function Lf(e){return (e??"online")==="online"?Sl.isOnline():true}var gu=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function yu(e){let t=false,r=0,o,n=Gg(),i=()=>n.status!=="pending",s=S=>{if(!i()){let h=new gu(S);k(h),e.onCancel?.(h);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>fu.isFocused()&&(e.networkMode==="always"||Sl.isOnline())&&e.canRun(),p=()=>Lf(e.networkMode)&&e.canRun(),g=S=>{i()||(o?.(),n.resolve(S));},k=S=>{i()||(o?.(),n.reject(S));},d=()=>new Promise(S=>{o=h=>{(i()||c())&&S(h);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),f=()=>{if(i())return;let S,h=r===0?e.initialPromise:void 0;try{S=h??e.fn();}catch(w){S=Promise.reject(w);}Promise.resolve(S).then(g).catch(w=>{if(i())return;let v=e.retry??(hu.isServer()?0:3),I=e.retryDelay??FT,x=typeof I=="function"?I(r,w):I,P=v===true||typeof v=="number"&&r<v||typeof v=="function"&&v(r,w);if(t||!P){k(w);return}r++,e.onFail?.(r,w),$g(x).then(()=>c()?void 0:d()).then(()=>{t?k(w):f();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():d().then(f),n)}}var ga,Jg,bu=(Jg=class{constructor(){pe(this,ga);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ug(this.gcTime)&&G(this,ga,Bc.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(hu.isServer()?1/0:300*1e3));}clearGcTimeout(){y(this,ga)!==void 0&&(Bc.clearTimeout(y(this,ga)),G(this,ga,void 0));}},ga=new WeakMap,Jg);function Xg(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let p=false,g=f=>{Kg(f,()=>t.signal,()=>p=true);},k=mu(t.options,t.fetchOptions),d=async(f,S,h)=>{if(p)return Promise.reject(t.signal.reason);if(S==null&&f.pages.length)return Promise.resolve(f);let v=(()=>{let m={client:t.client,queryKey:t.queryKey,pageParam:S,direction:h?"backward":"forward",meta:t.options.meta};return g(m),m})(),I=await k(v),{maxPages:x}=t.options,P=h?Qg:qg;return {pages:P(f.pages,I,x),pageParams:P(f.pageParams,S,x)}};if(n&&i.length){let f=n==="backward",S=f?DT:Zg,h={pages:i,pageParams:s},w=S(o,h);a=await d(h,w,f);}else {let f=e??i.length;do{let S=l===0?s[0]??o.initialPageParam:Zg(o,a);if(l>0&&S==null)break;a=await d(a,S),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Zg(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 DT(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Tl,ya,kl,$n,ba,Ao,Mc,wa,Rn,ny,ji,ry,oy=(ry=class extends bu{constructor(t){super();pe(this,Rn);pe(this,Tl);pe(this,ya);pe(this,kl);pe(this,$n);pe(this,ba);pe(this,Ao);pe(this,Mc);pe(this,wa);G(this,wa,false),G(this,Mc,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,ba,t.client),G(this,$n,y(this,ba).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,ya,ty(this.options)),this.state=t.state??y(this,ya),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return y(this,Tl)}get promise(){return y(this,Ao)?.promise}setOptions(t){if(this.options={...y(this,Mc),...t},t?._type&&G(this,Tl,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=ty(this.options);r.data!==void 0&&(this.setState(ey(r.data,r.dataUpdatedAt)),G(this,ya,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,$n).remove(this);}setData(t,r){let o=jg(this.state.data,t,this.options);return Wt(this,Rn,ji).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){Wt(this,Rn,ji).call(this,{type:"setState",state:t});}cancel(t){let r=y(this,Ao)?.promise;return y(this,Ao)?.cancel(t),r?r.then(mn).catch(mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return y(this,ya)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Hg(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yl||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ec(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:!Ng(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),y(this,Ao)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),y(this,Ao)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,$n).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,Ao)&&(y(this,wa)||Wt(this,Rn,ny).call(this)?y(this,Ao).cancel({revert:true}):y(this,Ao).cancelRetry()),this.scheduleGc()),y(this,$n).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Wt(this,Rn,ji).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&y(this,Ao)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(y(this,Ao))return y(this,Ao).continueRetry(),y(this,Ao).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(G(this,wa,true),o.signal)});},i=()=>{let c=mu(this.options,r),g=(()=>{let k={client:y(this,ba),queryKey:this.queryKey,meta:this.meta};return n(k),k})();return G(this,wa,false),this.options.persister?this.options.persister(c,g,this):c(g)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:y(this,ba),state:this.state,fetchFn:i};return n(c),c})();(y(this,Tl)==="infinite"?Xg(this.options.pages):this.options.behavior)?.onFetch(a,this),G(this,kl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Wt(this,Rn,ji).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),G(this,Ao,yu({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof gu&&c.revert&&this.setState({...y(this,kl),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{Wt(this,Rn,ji).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{Wt(this,Rn,ji).call(this,{type:"pause"});},onContinue:()=>{Wt(this,Rn,ji).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await y(this,Ao).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),y(this,$n).config.onSuccess?.(c,this),y(this,$n).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof gu){if(c.silent)return y(this,Ao).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw Wt(this,Rn,ji).call(this,{type:"error",error:c}),y(this,$n).config.onError?.(c,this),y(this,$n).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Tl=new WeakMap,ya=new WeakMap,kl=new WeakMap,$n=new WeakMap,ba=new WeakMap,Ao=new WeakMap,Mc=new WeakMap,wa=new WeakMap,Rn=new WeakSet,ny=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ji=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,...AT(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...ey(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,kl,t.manual?n:void 0),n;case "error":let i=t.error;return {...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),So.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),y(this,$n).notify({query:this,type:"updated",action:t});});},ry);function AT(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lf(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ey(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function ty(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 zc,_i,jo,Ca,vi,As,iy,sy=(iy=class extends bu{constructor(t){super();pe(this,vi);pe(this,zc);pe(this,_i);pe(this,jo);pe(this,Ca);G(this,zc,t.client),this.mutationId=t.mutationId,G(this,jo,t.mutationCache),G(this,_i,[]),this.state=t.state||OT(),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,_i).includes(t)||(y(this,_i).push(t),this.clearGcTimeout(),y(this,jo).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){G(this,_i,y(this,_i).filter(r=>r!==t)),this.scheduleGc(),y(this,jo).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){y(this,_i).length||(this.state.status==="pending"?this.scheduleGc():y(this,jo).remove(this));}continue(){return y(this,Ca)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Wt(this,vi,As).call(this,{type:"continue"});},o={client:y(this,zc),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,Ca,yu({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{Wt(this,vi,As).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{Wt(this,vi,As).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,jo).canRun(this)}));let n=this.state.status==="pending",i=!y(this,Ca).canStart();try{if(n)r();else {Wt(this,vi,As).call(this,{type:"pending",variables:t,isPaused:i}),y(this,jo).config.onMutate&&await y(this,jo).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Wt(this,vi,As).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await y(this,Ca).start();return await y(this,jo).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await y(this,jo).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),Wt(this,vi,As).call(this,{type:"success",data:s}),s}catch(s){try{await y(this,jo).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await y(this,jo).config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Wt(this,vi,As).call(this,{type:"error",error:s}),s}finally{y(this,jo).runNext(this);}}},zc=new WeakMap,_i=new WeakMap,jo=new WeakMap,Ca=new WeakMap,vi=new WeakSet,As=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),So.batch(()=>{y(this,_i).forEach(o=>{o.onMutationUpdate(t);}),y(this,jo).notify({mutation:this,type:"updated",action:t});});},iy);function OT(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var qi,oi,Uc,ay,ly=(ay=class extends Ps{constructor(t={}){super();pe(this,qi);pe(this,oi);pe(this,Uc);this.config=t,G(this,qi,new Set),G(this,oi,new Map),G(this,Uc,0);}build(t,r,o){let n=new sy({client:t,mutationCache:this,mutationId:++sc(this,Uc)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){y(this,qi).add(t);let r=wu(t);if(typeof r=="string"){let o=y(this,oi).get(r);o?o.push(t):y(this,oi).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(y(this,qi).delete(t)){let r=wu(t);if(typeof r=="string"){let o=y(this,oi).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,oi).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=wu(t);if(typeof r=="string"){let n=y(this,oi).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=wu(t);return typeof r=="string"?y(this,oi).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){So.batch(()=>{y(this,qi).forEach(t=>{this.notify({type:"removed",mutation:t});}),y(this,qi).clear(),y(this,oi).clear();});}getAll(){return Array.from(y(this,qi))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Vf(r,o))}findAll(t={}){return this.getAll().filter(r=>Vf(t,r))}notify(t){So.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return So.batch(()=>Promise.all(t.map(r=>r.continue().catch(mn))))}},qi=new WeakMap,oi=new WeakMap,Uc=new WeakMap,ay);function wu(e){return e.options.scope?.id}var Ri,cy,dy=(cy=class extends Ps{constructor(t={}){super();pe(this,Ri);this.config=t,G(this,Ri,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??Wc(n,r),s=this.get(i);return s||(s=new oy({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){y(this,Ri).has(t.queryHash)||(y(this,Ri).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=y(this,Ri).get(t.queryHash);r&&(t.destroy(),r===t&&y(this,Ri).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){So.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return y(this,Ri).get(t)}getAll(){return [...y(this,Ri).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Of(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Of(t,o)):r}notify(t){So.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){So.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){So.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Ri=new WeakMap,cy);var so,Os,Vs,xl,_l,Ls,vl,Rl,uy,Bf=(uy=class{constructor(e={}){pe(this,so);pe(this,Os);pe(this,Vs);pe(this,xl);pe(this,_l);pe(this,Ls);pe(this,vl);pe(this,Rl);G(this,so,e.queryCache||new dy),G(this,Os,e.mutationCache||new ly),G(this,Vs,e.defaultOptions||{}),G(this,xl,new Map),G(this,_l,new Map),G(this,Ls,0);}mount(){sc(this,Ls)._++,y(this,Ls)===1&&(G(this,vl,fu.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,so).onFocus());})),G(this,Rl,Sl.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,so).onOnline());})));}unmount(){var e,t;sc(this,Ls)._--,y(this,Ls)===0&&((e=y(this,vl))==null||e.call(this),G(this,vl,void 0),(t=y(this,Rl))==null||t.call(this),G(this,Rl,void 0));}isFetching(e){return y(this,so).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Os).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,so).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=y(this,so).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ec(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return y(this,so).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=y(this,so).get(o.queryHash)?.state.data,s=zg(t,i);if(s!==void 0)return y(this,so).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return So.batch(()=>y(this,so).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,so).get(t.queryHash)?.state}removeQueries(e){let t=y(this,so);So.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=y(this,so);return So.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=So.batch(()=>y(this,so).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(mn).catch(mn)}invalidateQueries(e,t={}){return So.batch(()=>(y(this,so).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=So.batch(()=>y(this,so).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(mn)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(mn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=y(this,so).build(this,t);return r.isStaleByTime(Ec(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(mn).catch(mn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(mn).catch(mn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Sl.isOnline()?y(this,Os).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,so)}getMutationCache(){return y(this,Os)}getDefaultOptions(){return y(this,Vs)}setDefaultOptions(e){G(this,Vs,e);}setQueryDefaults(e,t){y(this,xl).set(gl(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...y(this,xl).values()],r={};return t.forEach(o=>{bl(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){y(this,_l).set(gl(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...y(this,_l).values()],r={};return t.forEach(o=>{bl(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...y(this,Vs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Wc(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===yl&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...y(this,Vs).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){y(this,so).clear(),y(this,Os).clear();}},so=new WeakMap,Os=new WeakMap,Vs=new WeakMap,xl=new WeakMap,_l=new WeakMap,Ls=new WeakMap,vl=new WeakMap,Rl=new WeakMap,uy);var py=ta__namespace.createContext(void 0);var Ef=({client:e,children:t})=>(ta__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(py.Provider,{value:e,children:t}));var Pl=new Map;function fy({width:e,height:t,borderRadius:r,color:o}){let n=ta.useRef(new reactNative.Animated.Value(.3)).current;return ta.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function en({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=z(),[c,p]=ta.useState(false),[g,k]=ta.useState(false),[d,f]=ta.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let P=Pl.get(e);return P?{uri:e,xml:P}:null}),S=e?.toLowerCase().endsWith(".svg"),h=S&&e&&d?.uri===e?d.xml:null;ta.useEffect(()=>{p(false),k(false);},[e]),ta.useEffect(()=>{if(!S||!e)return;if(Pl.has(e)){f({uri:e,xml:Pl.get(e)});return}let P=false;return fetch(e).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(m=>{P||(Pl.set(e,m),f({uri:e,xml:m}));}).catch(()=>{P||p(true);}),()=>{P=true;}},[e,S]);let w=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:w},a]});let v={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},I=t-n*2,x=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[v,{backgroundColor:s||w}]}):S?jsxRuntime.jsxs(reactNative.View,{style:v,children:[!!!h&&jsxRuntime.jsx(fy,{width:I,height:x,borderRadius:o,color:w}),h?jsxRuntime.jsx(Ir.SvgXml,{xml:h,width:I,height:x,onError:()=>p(true)}):jsxRuntime.jsx(Ir.SvgUri,{uri:e,width:I,height:x,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:v,children:[!g&&jsxRuntime.jsx(fy,{width:I,height:x,borderRadius:o,color:w}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:I,height:x},resizeMode:"contain",onLoad:()=>k(true),onError:()=>p(true)})]})}function Hc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Pl.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Pl.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function fo({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:g,publishableKey:k,projectName:d,leftIcon:f,onLeftAction:S}){let{colors:h,fonts:w,components:v}=z(),[I,x]=ta.useState(null),[P,m]=ta.useState(false),u=ta.useState(()=>new reactNative.Animated.Value(0))[0];ta.useEffect(()=>{if(!P)return;let b=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 b.start(),()=>b.stop()},[P,u]),ta.useEffect(()=>{if(!a||!l||!c||!p||!g||!k){x(null),m(false);return}let b=false;return m(true),Wd(l,c,p,g,k).then(A=>{if(b)return;let O=A.balance,F=null;O&&(O.amount_usd!=null&&O.amount_usd!==""?F=`$${O.amount_usd}`:F="$0.00"),x(F);}).catch(()=>{b||x(null);}).finally(()=>{b||m(false);}),()=>{b=true;}},[a,l,c,p,g,k]);let T=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:qo.header,children:[jsxRuntime.jsx(reactNative.View,{style:qo.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(lc,{size:20,color:v.header.buttonColor,strokeWidth:2})}):f&&S?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:S,style:[qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsxRuntime.jsx(reactNative.View,{style:qo.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:qo.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:qo.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qo.title,{color:v.header.titleColor,fontFamily:w.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[qo.titleBadge,{backgroundColor:h.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[qo.titleBadgeText,{color:h.foregroundMuted,fontFamily:w.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[qo.balanceText,{color:h.foregroundMuted,fontFamily:w.regular}],children:t}):null,a&&(P?jsxRuntime.jsx(reactNative.Animated.View,{style:[qo.balanceSkeleton,{backgroundColor:h.cardHover,opacity:T}]}):I!=null?jsxRuntime.jsxs(reactNative.Text,{style:[qo.balanceText,{color:h.foregroundMuted,fontFamily:w.regular}],children:[d?`${d} `:"","Balance: ",I]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:qo.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:v.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:qo.spacer})})]})}var qo=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:15,width:120,borderRadius:5,marginTop:5},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function jr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=z(),a=i??s.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[yy.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[yy.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 yy=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function $c({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(jr,{cardTokens:s,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:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Wp,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Ii.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ii.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ii.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ii.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Ii.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Ii.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(en,{uri:ye(p),width:20,height:20})},l.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},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function qc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsxs(jr,{cardTokens:s,onPress:e,style:Qi.wrapper,contentStyle:Qi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qi.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qa,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Qi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Qi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Qi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Qi.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(en,{uri:ye(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var Qi=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 Qc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsx(jr,{cardTokens:s,onPress:e,style:Ki.wrapper,contentStyle:Ki.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ki.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ki.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx($o,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Ki.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ki.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ki.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ki.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ki.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Ki=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 Gc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=z(),i=n.depositMenu.card;return jsxRuntime.jsx(jr,{cardTokens:i,onPress:e,style:Ta.wrapper,contentStyle:Ta.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ta.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ta.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(wh,{size:36})}),jsxRuntime.jsxs(reactNative.View,{style:Ta.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ta.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ta.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Ta=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"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var GT="#00D632";function Yc({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=z(),i=n.depositMenu.card,[s,a]=ta.useState(false),l=kr("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(jr,{cardTokens:i,onPress:e,style:Pi.wrapper,contentStyle:Pi.container,children:jsxRuntime.jsxs(reactNative.View,{style:Pi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Pi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:s?jsxRuntime.jsx(reactNative.View,{style:[Pi.cashAppIconFallback,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Pi.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Pi.cashAppIcon,{borderRadius:i.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Pi.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Pi=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:GT,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 Jc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsxs(jr,{cardTokens:s,onPress:e,style:Fi.wrapper,contentStyle:Fi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Fi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Fi.iconContainer,{backgroundColor:s.iconBackgroundColor,borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(yh,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Fi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Fi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:Fi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Fi.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Fi.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(en,{uri:ye(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Fi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});function ek({size:e,color:t}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsx(Ir.Path,{fill:t,d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Zc({onPress:e,title:t="Pay with Apple Pay",subtitle:r="Instant"}){let{colors:o,fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsx(jr,{cardTokens:s,onPress:e,style:xa.wrapper,contentStyle:xa.container,children:jsxRuntime.jsxs(reactNative.View,{style:xa.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[xa.iconContainer,{borderRadius:s.iconContainerBorderRadius,backgroundColor:"#000"}],children:jsxRuntime.jsx(ek,{size:20,color:"#fff"})}),jsxRuntime.jsxs(reactNative.View,{style:xa.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xa.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[xa.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var xa=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"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var va="#00D632",Fy=5,nk=[25,50,100,500],Vl=120,ik=5e3,sk=2e3,ak=300;function Xc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function Dy(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function lk(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 Ay(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function ck(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function Oy(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function dk(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 uk(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function _u({size:e,faded:t=false,withBackground:r=false}){let[o,n]=ta.useState(false),i=kr("/icons/onramps/png/cashapp.png"),s=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:s,backgroundColor:va,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:i,cache:"force-cache"},style:{width:e,height:e,borderRadius:s},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${va}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function vu({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:i="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:s,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:g}=z();ta.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[k,d]=ta.useState("amountInput"),[f,S]=ta.useState("25"),[h,w]=ta.useState(null),[v,I]=ta.useState(null),[x,P]=ta.useState(true),[m,u]=ta.useState(null),[T,b]=ta.useState(false),[A,O]=ta.useState(null),[F,B]=ta.useState(Vl),[W,N]=ta.useState(null),[Z,je]=ta.useState(false),[Y,rt]=ta.useState("pending"),oe=ta.useRef(null),ce=ta.useRef(null),ae=ta.useRef(null),te=ta.useRef("pending"),ke=ta.useRef(null),j=ta.useRef("amountInput"),Ie=ta.useRef(Vl),pt=ta.useRef(null),Ge=ta.useRef(null),Se=ta.useRef(false),qe=ta.useRef(true),ot=v?.minimum_amount??Fy,Ye=v?.maximum_amount,dt=parseFloat(f)||0,st=!isNaN(dt)&&dt>=ot&&(Ye==null||dt<=Ye),Me=Ye?`$${Xc(ot)} \u2013 $${Xc(Ye)}`:`$${Xc(ot)} minimum`,be=k==="amountInput"?"Pay with Cash App":`Pay $${Dy(f)} via Cash App`,we=k==="waitingForPayment";ta.useEffect(()=>(qe.current=true,P(true),Kp("usd",t).then(C=>{qe.current&&I(C);}).catch(()=>{}).finally(()=>{qe.current&&P(false);}),()=>{qe.current=false,ut();}),[t]);function ze(C,M=v){if(O(null),!C){w(null);return}let q=parseFloat(C);if(isNaN(q)){w("Enter a valid number");return}let J=M?.minimum_amount??Fy,K=M?.maximum_amount;q<J?w(`$${Xc(J)} minimum`):K!=null&&q>K?w(`$${Xc(K)} maximum`):w(null);}function ut(){oe.current&&clearInterval(oe.current),ce.current&&clearInterval(ce.current),ae.current&&clearInterval(ae.current),oe.current=null,ce.current=null,ae.current=null;}function ht(){ut(),u(null),ke.current=null,N(null),je(false),O(null),te.current="pending",rt("pending"),B(Vl),Ie.current=Vl,pt.current=null,Se.current=false,d("amountInput"),j.current="amountInput";}async function xt(){if(!(!st||T)){b(true),O(null),ut(),pt.current=null;try{let C=await Qp({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:i,recipient_address:r,source_amount:f},t);ke.current=C,te.current=C.status,u(C),b(!1),d("waitingForPayment"),j.current="waitingForPayment",lr(),Ue(),reactNative.Linking.openURL(C.url).catch(()=>{});}catch(C){b(false),O(C instanceof Error?C.message:"Failed to create session");}}}function lr(){Ie.current=Vl,B(Vl),ae.current&&clearInterval(ae.current),ae.current=setInterval(()=>{Ie.current-=1,B(Ie.current),Ie.current<=0&&(clearInterval(ae.current),ae.current=null,te.current==="pending"&&(d("softExpired"),j.current="softExpired"));},1e3);}function Ue(){oe.current&&clearInterval(oe.current),oe.current=setInterval(()=>{me();},ik);}async function me(){if(!qe.current)return;let C=ke.current;if(!C)return;let M=C.external_id??C.id;try{let q=await Gp(M,t),J=te.current;switch(te.current=q.status,rt(q.status),q.status){case "processing":(j.current==="amountInput"||j.current==="softExpired"||j.current==="waitingForPayment")&&(d("paymentReceived"),j.current="paymentReceived",ae.current&&(clearInterval(ae.current),ae.current=null));break;case "completed":oe.current&&(clearInterval(oe.current),oe.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),J!=="completed"&&(d("paymentReceived"),j.current="paymentReceived",Qe());break;case "failed":oe.current&&(clearInterval(oe.current),oe.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),j.current!=="amountInput"&&(d("failed"),j.current="failed");break;case "expired":oe.current&&(clearInterval(oe.current),oe.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),j.current!=="amountInput"&&(d("softExpired"),j.current="softExpired");break;default:break}}catch{}}let Je=6e5;function Qe(){ce.current&&clearInterval(ce.current);let C=Date.now()+Je;ce.current=setInterval(()=>{if(Date.now()>C){clearInterval(ce.current),ce.current=null;let M=te.current;M==="completed"||M==="processing"?(d("paymentReceived"),j.current="paymentReceived"):(d("failed"),j.current="failed");return}Ve();},sk);}async function Ve(){if(qe.current)try{let C=await ln(e,t,"deposit"),M=Date.now(),q=[...C.data].sort((_e,et)=>{let L=_e.created_at?new Date(_e.created_at).getTime():0;return (et.created_at?new Date(et.created_at).getTime():0)-L}),J=pt.current,K=J?q.find(_e=>_e.id===J):q.find(_e=>{if(!_e.created_at)return !1;let et=new Date(_e.created_at).getTime();return M-et<ak*1e3});K&&(pt.current||(pt.current=K.id),K.status==="succeeded"?(ce.current&&(clearInterval(ce.current),ce.current=null),N(K),d("depositComplete"),j.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:K.id,transaction:K})):(K.status==="failed"||K.status==="refunded")&&(ce.current&&(clearInterval(ce.current),ce.current=null),N(K),d("failed"),j.current="failed"));}catch{}}function he(){if(k==="waitingForPayment"){ae.current&&(clearInterval(ae.current),ae.current=null),d("amountInput"),j.current="amountInput";return}s();}function Ne(){ut(),a();}function vt(){let C=ke.current??m;C&&reactNative.Linking.openURL(C.url).catch(()=>{});}function Vt(C){let M=C.destination_amount_base_unit;if(!M)return "\u2014";let q=C.destination_token_metadata?.decimals??6;return lk(M,q)}function Ht(C){return ck(C.destination_currency)}function lt(C){let M=C.destination_token_metadata;return M?M.icon_urls&&M.icon_urls.length>0?ui(M.icon_urls,"png")??M.icon_url??null:M.icon_url??null:null}function er(){return jsxRuntime.jsxs(reactNative.View,{style:ie.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function Xe(C,M){return jsxRuntime.jsxs(reactNative.View,{style:ie.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:C}),jsxRuntime.jsx(reactNative.Text,{style:[ie.detailValue,{color:c.foreground,fontFamily:p.medium}],children:M})]},C)}function yt(C,M,q){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ie.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(q).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.txLabel,{color:c.foreground,fontFamily:p.medium}],children:C}),jsxRuntime.jsxs(reactNative.View,{style:ie.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.txHash,{color:c.foregroundMuted}],children:M}),jsxRuntime.jsx(reactNative.Text,{style:[ie.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},C)}function gt(){let C=Math.max(60-f.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:ie.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:ie.flex,contentContainerStyle:ie.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{Se.current||(Se.current=true,setTimeout(()=>Ge.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:ie.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.amountDollar,{color:c.foreground,fontSize:C}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,value:f,onChangeText:M=>{S(M),ze(M);},keyboardType:"decimal-pad",style:[ie.amountInput,{color:c.foreground,fontSize:C}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),h?jsxRuntime.jsx(reactNative.Text,{style:[ie.amountError,{color:c.warning,fontFamily:p.regular}],children:h}):x?jsxRuntime.jsx(reactNative.View,{style:[ie.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[ie.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Me})]}),jsxRuntime.jsx(reactNative.View,{style:ie.quickAmountsRow,children:nk.map(M=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let q=String(M);S(q),ze(q);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[ie.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",M]})},M))}),A&&jsxRuntime.jsxs(reactNative.View,{style:[ie.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:ie.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:A})]})]}),jsxRuntime.jsx(reactNative.View,{style:ie.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:va,borderRadius:g.button.borderRadius,opacity:!st||T?.4:1}],onPress:xt,disabled:!st||T,activeOpacity:.8,children:[T&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:ie.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:T?"Loading...":"Continue"})]})})]})}function De(){return jsxRuntime.jsxs(reactNative.View,{style:ie.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.centeredContent,children:[jsxRuntime.jsx(_u,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
|
|
3
|
-
This page will update automatically.`}),
|
|
4
|
-
`,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:ie.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:va,borderRadius:g.button.borderRadius}],onPress:ht,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function _(){return jsxRuntime.jsxs(reactNative.View,{style:ie.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[ie.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:va,borderRadius:g.button.borderRadius}],onPress:ht,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),er()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[ie.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(fo,{title:be,showBack:we,onBack:he,onClose:Ne}),k==="amountInput"&>(),k==="waitingForPayment"&&De(),k==="paymentReceived"&&at(),k==="depositComplete"&&X(),k==="softExpired"&&Pe(),k==="failed"&&_()]})}var ie=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 pk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function fk(e){let t=new Array(e),r=globalThis;if(r.crypto&&typeof r.crypto.getRandomValues=="function"){let o=new Uint8Array(e);r.crypto.getRandomValues(o);for(let n=0;n<e;n++)t[n]=o[n];return t}for(let o=0;o<e;o++)t[o]=Math.floor(Math.random()*256);return t}function By(e){let t=Math.floor(Date.now()/1e3)-14e8,r=new Array(20).fill(0);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255;let o=fk(16);for(let a=0;a<16;a++)r[4+a]=o[a];let n=[],i=[...r];for(;i.some(a=>a!==0);){let a=0;for(let l=0;l<i.length;l++){let c=a<<8|i[l];i[l]=Math.floor(c/62),a=c%62;}n.push(pk[a]);}let s=n.reverse().join("");return s.length<27&&(s="0".repeat(27-s.length)+s),`${e}_${s}`}var mk="unifold:apple-pay:session",hk=1320*60*60*1e3,gk=6e4;function em(e){return `${mk}:${encodeURIComponent(e)}`}function yk(e){let t=Date.parse(e);return Number.isNaN(t)?null:t}var Us={async get(e){try{let t=await Tf__default.default.getItem(em(e));if(!t)return null;let r=JSON.parse(t);return !r.email||!r.phone||!r.termsAcceptedAt?null:r}catch{return null}},async set(e,t){try{await Tf__default.default.setItem(em(e),JSON.stringify(t));}catch{}},async clear(e){try{await Tf__default.default.removeItem(em(e));}catch{}},isPhoneVerificationFresh(e){let t=e?.phoneVerifiedAt;if(!t)return false;let r=yk(t);return r===null?false:Date.now()-r<hk},isOnrampTokenFresh(e){if(!e)return false;let t=e.onrampToken,r=e.onrampTokenExpiresAtMs;return !t||r==null?false:r-Date.now()>gk}};var _k=5,vk=500,Rk=[25,100,250,500],Ru=6,Ik=30,Pk=800,jy=52,Fk=6e3,Dk=3e3,Ak=6e5,Ok=2500,Vk=12e4,Ey=3,Wy=600,Lk=1500,Bk=3e4,My=3,Ek=600,Iu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Wk=["ethereum","solana","bitcoin","algorand","xrpl","cardano","n1"],Mk=[{key:"guest_checkout_terms",name:"Coinbase Guest Checkout Terms of Service",url:"https://www.coinbase.com/legal/guest-checkout/us"},{key:"user_agreement",name:"Coinbase User Agreement",url:"https://www.coinbase.com/legal/user_agreement"},{key:"privacy_policy",name:"Coinbase Privacy Policy",url:"https://www.coinbase.com/legal/privacy"}],zk="unrequested",Uk="pending",rm="resubmit",zy="active",Nk="inactive",se={title:"Pay with Apple Pay",disabledTitle:"Apple Pay is unavailable",disabledDescription:"Apple Pay is disabled for this project. Try another payment method.",emailLabel:"Email",emailPlaceholder:"you@example.com",continueButton:"Continue",phoneLabel:"US phone number",phonePlaceholder:"555 123 4567",phoneInvalid:"Enter a valid US mobile number (no VoIP).",sendCode:"Send code",phoneHeaderTitle:"Verify your phone",emailOtpHeaderTitle:"Verify your email",otpPlaceholder:"000000",incorrectCode:"Incorrect code. Please try again.",verify:"Verify",resendCode:"Resend code",amountHeaderTitle:"Deposit with Apple Pay",enterAmount:"Enter an amount",preparingApplePay:"Loading",continuePay:"Continue",popupBlocked:"Couldn't open the Apple Pay window. Please try again.",applePayButtonUnavailable:"Apple Pay isn't available right now. Please try again or use another payment method.",checkingHeaderTitle:"Checking deposit",checkingTitle:"Checking for your deposit\u2026",checkingDescription:"Return if the payment is not made.",checkingTimeoutTitle:"Still processing",checkingTimeoutDescription:"This is taking longer than expected. Your deposit may still complete \u2014 check your balance shortly.",paymentErrorTitle:"Payment failed",paymentErrorFallback:"We couldn't complete your payment. Please try again or use a different payment method.",tryAgain:"Try again",guestLimitHeaderTitle:"Limit reached",guestLimitTitle:"Apple Pay limit reached",guestLimitDescription:"Your account is not eligible for a limit increase at this time.",returnButton:"Return",upgradeHeaderTitle:"Verify identity",upgradeIntroDescription:"Submit your date of birth and SSN to increase your Apple Pay limit.",cancelButton:"Cancel",dobLabel:"Date of birth",dobPlaceholder:"MM/DD/YYYY",ssnLabel:"Last 4 of SSN",ssnPlaceholder:"\u2022\u2022\u2022\u2022",submitButton:"Submit",verifyingTitle:"Verifying your information",verifyingDescription:"Your limit increase request is under review. This usually takes just a few seconds.",upgradeVerifyFailed:"We couldn't verify your information. Please check your SSN and date of birth and try again.",upgradeFailedTitle:"Apple Pay limit reached",upgradeFailedPrefix:"Failed to increase. Please try again later or ",contactSupport:"contact support",upgradeFailedSuffix:".",supportUrl:"https://unifold.io/support",destinationNotConfigured:"Deposit destination not configured. Please contact support.",networkUnsupported:"Coinbase Apple Pay is not available for this network.",depositWalletUnavailable:"Deposit wallet unavailable. Please try again.",rateLimited:"Too many attempts. Please wait a few minutes and try again.",networkError:"Network error. Check your connection and try again.",voipError:"We can only verify real US cell phones (not VoIP). Try a different number.",disclaimerPrefix:"By continuing, you agree to Coinbase's ",disclaimerSuffix:". Coinbase is the regulated provider of this fiat-to-crypto onramp.",amountSent:"Amount Sent",amountReceived:"Amount Received",usdValue:"USD Value",destinationNetwork:"Destination Network",inProgress:"In Progress",completed:"Completed",failed:"Failed",depositFailedDescription:"Your payment went through but the deposit didn't complete. Any charge will be refunded.",seeLess:"See less",seeMoreDetails:"See more details",depositTx:"Deposit Tx",completionTx:"Completion Tx",done:"Done",sentTo:e=>`Sent to ${e}`,resendIn:e=>`Resend in ${e}s`,minimumAmount:e=>`Minimum amount is ${e}`,maximumAmount:e=>`Maximum amount is ${e}`};function Fu(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function om(e){let t=e.replace(/\D/g,"");return t.length===11&&t.startsWith("1")?t.slice(1):t.slice(0,10)}function Hk(e){let t=e.indexOf("@");if(t<=0)return e;let r=e.slice(0,t),o=e.slice(t+1),n=r.slice(0,2),i="*".repeat(Math.max(r.length-n.length,1));return `${n}${i}@${o}`}function $k(e){return /^\+1\d{10}$/.test(e)?`+1 (***) ***-${e.slice(-4)}`:e}function Uy(e){return e===Math.round(e)?`$${Math.round(e)}`:`$${e.toFixed(2)}`}function jk(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function Ny(e){return !e||e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function qk(e,t){return e==="n1"?"N1":e==="cardano"?"Cardano":e==="algorand"?"Algorand":e==="xrpl"?"XRPL":{1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function Qk(e,t){switch(e){case "solana":return "solana";case "bitcoin":return "bitcoin";case "ethereum":switch(t){case "1":return "ethereum";case "8453":return "base";case "137":return "polygon";case "43114":return "avalanche";case "42161":return "arbitrum";case "10":return "optimism";default:return null}default:return null}}function Kk(e){let t=Fu(e);if(t===null)return "";try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Gk(e){let t=e.destination_amount_base_unit;if(!t)return "\u2014";let r=e.destination_token_metadata?.decimals??6,o=parseFloat(t)/Math.pow(10,r);return o===0?"0.00":o>=1?o.toFixed(2):o.toFixed(6)}function Yk(e){let t=e.destination_currency??"",r=t.indexOf(".");return r!==-1?t.slice(0,r).toUpperCase()+t.slice(r):t.toUpperCase()}function Jk(e){return !!(/coinbase_onramp_guest_limit_reached/i.test(e)||/guest_(daily_)?transaction_(count|limit)/i.test(e))}function Zk(e){let t=e instanceof hc?e.status:void 0,r=e instanceof Error?e.message:String(e),o=t?`${r} ${t}`:r;return /(token|jwt)[^\n]*(expired|invalid|401|unauthorized)|(expired|invalid|401|unauthorized)[^\n]*(token|jwt)/i.test(o)}function Xk(e){return !!(/coinbase_onramp_guest_limit_reached/i.test(e)||/limit upgrade is not available/i.test(e)||/limits.?upgrade.?blocked/i.test(e))}function Bl(e){let t=e instanceof Error?e.message:String(e);if(/\b429\b|too many requests|rate.?limit|throttle/i.test(t))return se.rateLimited;if(/network|failed to fetch|abort/i.test(t))return se.networkError;if(/voip|not a valid US|not a cell/i.test(t))return se.voipError;let r=t.replace(/\s*\[[\w_]+\]:?.*$/,"").trim();return r.length?r:t}function ex(e){let t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`}function Hy(e){if(!/^\d{2}\/\d{2}\/\d{4}$/.test(e))return null;let[t,r,o]=e.split("/");return !/^(0[1-9]|1[0-2])$/.test(t)||!/^(0[1-9]|[12]\d|3[01])$/.test(r)||!/^(19|20)\d{2}$/.test(o)?null:{day:r,month:t,year:o}}function tx(){return new Date().toISOString()}function rd(e){return new Promise(t=>setTimeout(t,e))}function rx(e){if(sa().includes("api.unifold.io")||e.includes("useApplePaySandbox"))return e;let r=e.includes("?")?"&":"?";return `${e}${r}useApplePaySandbox=true`}function zo(e){let t=ta.useRef(e);return t.current=e,t}function ox({size:e,color:t}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsx(Ir.Path,{fill:t,d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function nx(e,t){let r=Math.round(e);return `
|
|
1
|
+
'use strict';var ta=require('react'),reactNative=require('react-native'),Ir=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),wh=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Tf=require('@react-native-async-storage/async-storage'),reactNativeWebview=require('react-native-webview'),fx=require('react-native-qrcode-svg/src/genMatrix');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 ta__namespace=/*#__PURE__*/_interopNamespace(ta);var Ir__default=/*#__PURE__*/_interopDefault(Ir);var wh__default=/*#__PURE__*/_interopDefault(wh);var Tf__default=/*#__PURE__*/_interopDefault(Tf);var fx__default=/*#__PURE__*/_interopDefault(fx);var lh=e=>{throw TypeError(e)};var Qw=(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 Vp=(e,t,r)=>t.has(e)||lh("Cannot "+r);var y=(e,t,r)=>(Vp(e,t,"read from private field"),r?r.call(e):t.get(e)),ue=(e,t,r)=>t.has(e)?lh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,o)=>(Vp(e,t,"write to private field"),t.set(e,r),r),Mt=(e,t,r)=>(Vp(e,t,"access private method"),r);var ac=(e,t,r,o)=>({set _(n){Y(e,t,n);},get _(){return y(e,t,o)}});var Ap={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)"}},Lp=Ap;function Rd(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function lc(e,t,r){let o=r?t?.[r]:void 0,n=(u,h,k)=>{let d=o?.[u]?.[h];if(d!==void 0)return d;let p=t?.[u]?.[h];return p!==void 0?p:k},i={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:i,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Rd(i,s)},transferCrypto:{depositAddress:{card:Rd(i,a)}},depositCard:{quoteProvider:{card:Rd(i,l)}},depositTracker:{executionRow:{card:Rd(i,c)}}}}function Bp(e,t,r){let n={...Ap[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Ep=ta.createContext(null);function z(){let e=ta.useContext(Ep);if(!e){let t=Lp.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:lc(t,void 0,"dark"),isDark:true}}return e}function Te({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=z(),l=i??a.primary,c=s??a.primary,u=ta.useRef(new reactNative.Animated.Value(0)).current,h=ta.useId(),k=ta.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),d=(e-t)/2,p=2*Math.PI*d,T=e/2,m=o??Math.max(0,Math.round(e-t*2-8)),w=(e-m)/2;ta.useEffect(()=>{let v=reactNative.Animated.loop(reactNative.Animated.timing(u,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),x=requestAnimationFrame(()=>v.start());return ()=>{cancelAnimationFrame(x),v.stop();}},[u]);let R=u.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(Ir__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ir.Defs,{children:jsxRuntime.jsxs(Ir.LinearGradient,{id:k,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Ir.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(Ir.Circle,{cx:T,cy:T,r:d,stroke:`url(#${k})`,strokeWidth:t,fill:"none",strokeDasharray:`${p*.75} ${p*.25}`,strokeLinecap:"round",rotation:-90,origin:`${T}, ${T}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:w+1.5,left:w,width:m,height:m,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Mp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Qa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $t({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ka({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Kn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function gs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Bn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ci({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ir.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.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 Yn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Id({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function uc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.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(Ir.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ph({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ir.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ir.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function mh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function hh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ir.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gh({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Ir__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Ir.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(Ir.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ir.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 yh({size:e=24}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ir.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ir.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 Ja({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=ta.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=ta.useMemo(()=>{let d=o?.[l];return Bp(l,d,r)},[l,o,r]),u=ta.useMemo(()=>lc(c,s,l),[c,s,l]),h=ta.useMemo(()=>i?{regular:i.regular||n,medium:i.medium||n,semibold:i.semibold||n,bold:i.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,i]),k=ta.useMemo(()=>({mode:l,colors:c,fonts:h,components:u,isDark:l==="dark"}),[l,c,h,u]);return jsxRuntime.jsx(Ep.Provider,{value:k,children:e})}var hc={damping:28,stiffness:300,mass:.8},TC=80,kC=500;function rr({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,onBackdropPress:n,enablePanDownToClose:i=true,onRequestClose:s,showHandle:a=true,heightPercent:l,maxHeightPercent:c,startExpanded:u=false,noPadding:h=false,borderTopLeftRadius:k=24,borderTopRightRadius:d=24,marginHorizontal:p,marginBottom:T,overlay:m,useModal:w=true}){let{colors:R}=z(),{height:v}=reactNative.useWindowDimensions(),x=ta.useRef(v);v>x.current&&(x.current=v);let F=reactNative.Platform.OS==="android"?x.current:v,[f,g]=ta.useState(false),b=ta.useRef(e);b.current=e;let C=ta.useRef(0),O=l!=null&&l>=1,V=O||h?0:reactNative.Platform.OS==="ios"?34:24,P=c!=null&&l!=null&&c>l,B=l!=null?(P?c:l)*F:void 0,W=P?(c-l)*F:0,j=u?0:W,Z=wh.useSharedValue(F),Oe=ta.useRef(null),G=ta.useCallback(()=>{Oe.current&&(clearTimeout(Oe.current),Oe.current=null),b.current||g(false);},[]);ta.useEffect(()=>{e?(Oe.current&&(clearTimeout(Oe.current),Oe.current=null),g(true),Z.value=wh.withSpring(j,hc)):f&&(Z.value=wh.withTiming(F,{duration:250},xe=>{xe&&wh.runOnJS(G)();}),Oe.current=setTimeout(()=>{Oe.current=null,G();},350));},[e]),ta.useEffect(()=>()=>{Oe.current&&clearTimeout(Oe.current);},[]),ta.useEffect(()=>{f&&e&&(Z.value=wh.withSpring(j,hc));},[j,P]);let ot=ta.useCallback(()=>{o&&(n??t)();},[o,n,t]),te=ta.useMemo(()=>{if(!(!i&&!P))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{C.current=Z.value;},onPanResponderMove:(xe,$)=>{if(Math.abs($.dy)<4)return;let Re=C.current+$.dy;Z.value=Math.max(0,Re);},onPanResponderRelease:(xe,$)=>{if(!(Math.abs($.dy)<4)){if(i&&($.dy>TC||$.vy>kC)){t();return}if(P){let Re=W/2,dt=Z.value<Re?0:W;Z.value=wh.withSpring(dt,hc);}else Z.value=wh.withSpring(j,hc);}},onPanResponderTerminate:()=>{Z.value=wh.withSpring(j,hc);}}).panHandlers},[i,P,W,j,Z,t]),de=wh.useAnimatedStyle(()=>({transform:[{translateY:Z.value}]})),ae=wh.useAnimatedStyle(()=>({opacity:wh.interpolate(Z.value,[0,F*.5,F],[.5,.25,0],wh.Extrapolation.CLAMP)}));if(!f)return null;let re=jsxRuntime.jsxs(reactNative.View,{style:[Ei.root,!w&&Ei.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(wh__default.default.View,{style:[Ei.backdrop,ae],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:ot})}),jsxRuntime.jsxs(wh__default.default.View,{style:[Ei.sheet,de,{height:B,backgroundColor:R.background,borderTopLeftRadius:O?0:k,borderTopRightRadius:O?0:d,...p?{marginHorizontal:p,marginBottom:T??p+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:k,borderBottomRightRadius:d}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:B!=null?Ei.gestureRoot:Ei.gestureRootAuto,children:[a&&jsxRuntime.jsx(reactNative.View,{style:Ei.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Ei.handle,{backgroundColor:R.foreground+"33"}]})}),r,V>0&&jsxRuntime.jsx(reactNative.View,{style:{height:V}})]}),te&&jsxRuntime.jsx(reactNative.View,{...te,style:Ei.dragOverlay})]})]});return w?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:s??t,children:[re,m]}):re}var Sh={position:"absolute",left:0,right:0,top:0,bottom:0},Ei=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...Sh,zIndex:9999},backdrop:{...Sh,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}}),Yt=ta__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Yt.displayName="BottomSheetScrollView";function Za(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var xC="https://api.unifold.io",Np="__UnifoldDevApiBaseUrl__",Sr="pk_test_123",Dd={},yc=["ethereum","solana","bitcoin","n1"];function _C(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Np];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function or(){return _C()??xC}function Od(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Sr=e.publishableKey;}e.defaultConfig&&(Dd=e.defaultConfig);}function kh(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[Np]=t:delete globalThis[Np];}function sa(){return or()}function Vd(){return Sr}function Pr(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 kr(e){let t=e.startsWith("/")?e:`/${e}`;return `${or()}/api/public${t}`}function ge(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,or()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${or()}${e}`:`${or()}/api/public${e}`:""}async function Zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Dd.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||Dd.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Dd.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Sr;Pr(n);let i=await fetch(`${or()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function nn(e,t){return e.find(r=>r.chain_type===t)}async function sn(e,t,r){let o=t||Sr;Pr(o);let n=await fetch(`${or()}/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 Ad(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 it(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 Wi(e,t){let r=e||Sr;Pr(r);let o=`${or()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Hp(e,t){let r=t||Sr;Pr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${or()}/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 Ld(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function $p(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 jp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 bc(e,t){let r=t||Sr;Pr(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(`${or()}/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 wc(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function di(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function Cc(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 qp(){let e=await fetch(`${or()}/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 Bd(e,t,r){let o=e.find(i=>i.chain_id===r);if(o)return o.chain_name;let n=e.find(i=>i.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function aa(){let e=await fetch(`${or()}/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 Ed(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 Qp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Sc(e,t){return Ad(e.deposit_wallet_id,t)}async function Wd(e,t,r,o,n){let i=n||Sr;Pr(i);let s=await fetch(`${or()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}async function Kp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Gp(e="usd",t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Yp(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/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 Jp(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/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 Zp(e,t,r){let o=r||Sr;Pr(o);let n=await fetch(`${or()}/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()}var gc=class extends Error{constructor(t,r,o){super(t),this.name="CoinbaseApiError",this.status=r,this.body=o;}};async function Mi(e,t){let r="";try{r=await e.text();}catch{}let o=t;if(r)try{let n=JSON.parse(r),i=typeof n.message=="string"&&n.message||typeof n.detail=="string"&&n.detail||typeof n.error_description=="string"&&n.error_description||"",s=typeof n.error=="string"&&n.error||typeof n.error_type=="string"&&n.error_type||typeof n.code=="string"&&n.code||typeof n.type=="string"&&n.type||"",a=[];i&&a.push(i),s&&a.push(`[${s}]`),o=a.length?a.join(" "):r;}catch{o=r;}return new gc(o,e.status,r)}function Md(e){return e?.status==="verified"}async function xh(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/v1/public/onramps/apple_pay/providers`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw await Mi(r,`Failed to fetch Apple Pay providers: ${r.statusText}`);return r.json()}async function _h(e){let t=e||Sr;Pr(t);let r=await fetch(`${or()}/v1/public/onramps/headless/coinbase/legal_agreements`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw await Mi(r,`Failed to fetch legal agreements: ${r.statusText}`);return r.json()}async function Rh(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/v1/public/onramps/verification_sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw await Mi(o,`Failed to create verification session: ${o.statusText}`);return o.json()}async function zd(e,t,r,o){let n=o||Sr;Pr(n);let i=await fetch(`${or()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/${t}/send`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":n},body:JSON.stringify({client_secret:r})});if(!i.ok)throw await Mi(i,`Failed to send verification code: ${i.statusText}`);return i.json()}async function Xp(e,t,r,o,n){let i=n||Sr;Pr(i);let s=await fetch(`${or()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/${t}/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({client_secret:r,code:o})});if(!s.ok)throw await Mi(s,`Failed to verify code: ${s.statusText}`);return s.json()}async function vh(e,t,r){let o=r||Sr;Pr(o);let n=await fetch(`${or()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/token`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({client_secret:t})});if(!n.ok)throw await Mi(n,`Failed to exchange verification token: ${n.statusText}`);return n.json()}async function Ih(e,t,r){let o=r||Sr;Pr(o);let n=await fetch(`${or()}/v1/public/onramps/headless/coinbase/apple_pay/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o,"x-onramp-token":t},body:JSON.stringify(e)});if(!n.ok)throw await Mi(n,`Failed to create Apple Pay session: ${n.statusText}`);return n.json()}async function Tc(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/v1/public/onramps/headless/coinbase/apple_pay/limits`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify({phone:e})});if(!o.ok)throw await Mi(o,`Failed to fetch Apple Pay limits: ${o.statusText}`);let n=await o.json(),i=n.limits??[],s=n.limit_upgrade_options??void 0,a=i.some(u=>{let h=Number(u.remaining);return Number.isFinite(h)?h<=0:u.remaining==="0"}),l=s?.[0]?.status;return {limits:i,limitUpgradeOptions:s,limitReached:a,upgradeStatus:typeof l=="string"&&l?l:void 0}}async function Ph(e,t){let r=t||Sr;Pr(r);let o=await fetch(`${or()}/v1/public/onramps/headless/coinbase/apple_pay/limits/upgrade`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw await Mi(o,`Failed to request limit upgrade: ${o.statusText}`);return o.json()}function Dh({size:e=28}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Ir.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Ir.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Ir.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 Xa({size:e=28}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ir.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Ir.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(Ir.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Ir.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Ir.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Ir.Defs,{children:jsxRuntime.jsx(Ir.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Ir.Rect,{width:28,height:28,fill:"white"})})})]})}function Lh({size:e=28}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ir.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.Defs,{children:jsxRuntime.jsx(Ir.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Ir.Rect,{width:28,height:28,fill:"white"})})})]})}function rl({size:e=28}){return jsxRuntime.jsxs(Ir__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Ir.Defs,{children:[jsxRuntime.jsxs(Ir.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ir.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ir.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Ir.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Ir.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Ir.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(Ir.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(Ir.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 Bh({size:e=28}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Ir.G,{children:[jsxRuntime.jsx(Ir.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Ir.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 Ud=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Dh},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Xa},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Lh},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:rl},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Bh}];function Nd(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Hd(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 ol(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ud.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ud.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function xr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:i}=z(),s=r==="back",a=s?jsxRuntime.jsx(Ka,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx($t,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:bs.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:s?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:bs.headerWithTitle,children:[s?l:o??jsxRuntime.jsx(reactNative.View,{style:bs.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[bs.headerTitleText,{color:n.header.titleColor},...i.bold?[{fontFamily:i.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),s?jsxRuntime.jsx(reactNative.View,{style:bs.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:s?bs.headerWithTitle:bs.header,children:[s?l:jsxRuntime.jsx(reactNative.View,{style:bs.headerSpacer}),!s&&l]})}var $d={paddingTop:8,paddingBottom:8},bs=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...$d},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...$d,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 Xo({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=z();return e?jsxRuntime.jsx(reactNative.Text,{style:[Eh.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Eh.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Eh=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function Jn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ta.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 sf({quote:e,label:t,address:r,last:o,hideDivider:n}){let[i,s]=ta.useState(false),{colors:a,components:l}=z(),c=()=>{reactNative.Clipboard.setString(r),s(true),setTimeout(()=>s(false),2e3);},u=Nd(r);return jsxRuntime.jsxs(ta.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:u}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:i?jsxRuntime.jsx(Pt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(Kn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var jd={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function nl({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=z(),i=e.toLowerCase(),s=jd[i]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:s,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function qd({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:i}){let{colors:s,components:a,fonts:l}=z(),c=kr(`/icons/currencies/png/${e.toLowerCase()}.png`),u=ol(r);return jsxRuntime.jsxs(reactNative.View,{style:[En.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},i],children:[jsxRuntime.jsxs(reactNative.View,{style:En.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:En.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[En.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[En.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(co,{size:16,color:s.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:En.step,children:[jsxRuntime.jsxs(reactNative.View,{style:En.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:En.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[En.tokenIcon,{backgroundColor:jd[t.toLowerCase()]??s.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[En.networkBadge,{borderColor:s.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[En.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[En.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",u]})]})]})}var En=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 fi(){let{colors:e,fonts:t,components:r}=z(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return ta.useMemo(()=>{let l=s.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:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},u={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:s.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:l,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},k=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:k,borderBottomRightRadius:k,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},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:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},T={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:h,pm:d,wallet:p,flow:T,amount:u}},[e,t,o,n,i,s,a])}var zh="",Uh;function Qd(e){zh=e;}function Kd(e){Uh=e;}function an(){let e=zh||Vd();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function ln(){return Uh??sa()}async function Rc(){let e=`${ln()}/v1/public/onramps/headless/stripe/config`,t=an(),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");let n=typeof o.merchant_identifier=="string"&&o.merchant_identifier.trim().length>0?o.merchant_identifier.trim():null;return {publishableKey:o.publishable_key,merchantIdentifier:n}}async function Nh(){return (await Rc()).publishableKey}async function af(e){let t=await fetch(`${ln()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":an(),"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 Hh(e,t){let r=await fetch(`${ln()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":an(),"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 lf(e,t){let r=await fetch(`${ln()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":an(),"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 $h(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(`${ln()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":an(),"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 jh(e,t){let r=await fetch(`${ln()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":an(),"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 zi(e,t){let r=`${ln()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":an(),"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 qh(e){let t=`${ln()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":an(),"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 Qh(e,t){let r=`${ln()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":an(),"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 cf(e,t){let r=await fetch(`${ln()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":an(),"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 df(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(`${ln()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":an(),"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 uf(e,t){let r=await fetch(`${ln()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":an(),"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 Kh(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(`${ln()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":an(),"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 ws(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 Gh(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${ln()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":an()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function ZC({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Ir__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Ir.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Ir.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Ir.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(Ir.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(Ir.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 XC({size:e=24}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Ir.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Ir.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Ir.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function eS({size:e=24}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Ir.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Ir.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Ir.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Ir.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(Ir.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Ir.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 ff({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Qa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(ZC,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(XC,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(eS,{size:t}):jsxRuntime.jsx(Qa,{size:t*.75,color:r,strokeWidth:1.75})}function Gd(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 hf={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function gf(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 eg({status:e,colors:t,fontFamily:r}){let o=gf(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:hf[e]??e})})}function tg({count:e=4}){let{colors:t,components:r}=z(),o=ta.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,i=Math.min(r.card.borderRadius??12,14);return ta.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:il.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[il.row,{backgroundColor:t.card,borderRadius:i,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:il.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[il.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[il.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[il.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var il=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 rg({active:e,interval:t=15e3,color:r}){let o=ta.useRef(new reactNative.Animated.Value(0)).current;return ta.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:i})=>{i&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function og({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=z(),[i,s]=ta.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),s(true),setTimeout(()=>s(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",u=gf(e.status,r),h=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",k=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),p=e.destination_token_metadata,T=ws(p?.icon_urls,p?.icon_url),m=ol(l?.destination_network??""),w=l?.wallet_address?Nd(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,x=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,f=>f.toUpperCase()):null,F=[{label:"Amount",value:h},{label:"Received",value:`${k} ${d}`},...x?[{label:"Payment",value:x}]:[],{label:"Network",value:m},...w?[{label:"Wallet",value:w}]:[],...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(xr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Yt,{style:xo.scroll,contentContainerStyle:xo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xo.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(nl,{currency:d||"USD",tokenIconUrl:T,size:64}),jsxRuntime.jsx(reactNative.View,{style:[xo.statusBadge,{backgroundColor:u,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx(jo,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx($t,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Pt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:xo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xo.statusDot,{backgroundColor:u}]}),jsxRuntime.jsx(reactNative.Text,{style:[xo.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:hf[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[xo.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Gd(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[xo.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xo.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xo.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:[xo.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),i?jsxRuntime.jsx(Pt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Kn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),F.map(f=>jsxRuntime.jsx(ta__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:xo.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xo.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:f.label}),jsxRuntime.jsx(reactNative.Text,{style:[xo.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:f.value})]})},f.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[xo.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:xo.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xo.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[xo.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var xo=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 ig({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:i}=z(),[s,a]=ta.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:hi.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hi.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(fh,{size:20,color:o.foreground,strokeWidth:2})}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:hi.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[hi.menu,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius??12,borderWidth:i.card.borderWidth,borderColor:i.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:hi.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(jo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[hi.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:hi.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(Jo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[hi.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:hi.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(mh,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[hi.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var hi=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 mS=[50,100,500],hS=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function ag(e){return e.charAt(0).toUpperCase()+e.slice(1)}function gS(e){return e.card?`${ag(e.card.brand)} ${ag(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Xd({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:i,paymentSelectorPosition:s="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:u,paymentTokens:h=[],onAddPaymentMethod:k,onConfirm:d,onCancel:p,sheetBorderTopLeftRadius:T,sheetBorderTopRightRadius:m,accessToken:w,showHistoryProgressBar:R=true,onLogout:v,onRequestKYC:x,showSwitchAccount:F=true,inputDisabled:f=false}){let g=fi(),{colors:b,components:C,fonts:O}=z(),V=T??C.card.borderRadius,P=m??C.card.borderRadius,[B,W]=ta.useState(e),[j,Z]=ta.useState(r?"apple_pay":h.length>0?h[0].id:null),Oe=ta.useRef(false),G=_=>{Oe.current=true,Z(_);};ta.useEffect(()=>{Oe.current||r||h.length>0&&Z(h[0].id);},[h,r]);let[ot,te]=ta.useState(false),[de,ae]=ta.useState("select"),[re,xe]=ta.useState(null),$=ta.useRef(false);ta.useEffect(()=>{l&&c&&/saving/i.test(c)&&ae("card");},[l,c]);let Re=i,dt=Re!=null&&Re>0,Xe=ta.useMemo(()=>{if(o)return [];let _=mS.map(S=>({label:`$${S}`,amount:String(S),disabled:false}));return _.push({label:"MAX",amount:dt?String(Re):"0",disabled:!dt}),_},[o,dt,Re]),Se=_=>{if(_==="\u232B"){W(S=>S.slice(0,-1));return}if(_==="."){if(B.includes("."))return;W(S=>S===""?"0.":S+".");return}W(S=>{let M=S.indexOf(".");return M!==-1&&S.length-M>2?S:S==="0"&&_!=="."?_:S+_});},Ke=B===""?"0":B,nt=parseFloat(B),Ge=n!=null&&!isNaN(nt)&&nt>0&&nt<n,pt=Re!=null&&Re>0&&!isNaN(nt)&&nt>Re,st=B!==""&&!isNaN(nt)&&nt>0&&!Ge&&!pt,Ne=r||h.length>0,ye=s==="header",be=ta.useMemo(()=>{let _=[];r&&_.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let S of h)_.push({id:S.id,label:gS(S),hint:S.card?`Expires ${S.card.exp_month}/${S.card.exp_year}`:S.type,brand:S.card?.brand,isApplePay:false});return _},[r,h]),He=be.find(_=>_.id===j),yt=j!=null&&j!=="apple_pay",xt=He?He.label:yt&&re?re:yt?"Card":"Pay With",lr=He?!He.isApplePay:yt,$e=He?.brand??re??void 0,[fe,Ye]=ta.useState(false),[Je,Ee]=ta.useState([]),[me,je]=ta.useState(false),[vt,Bt]=ta.useState(null),[Nt,ct]=ta.useState(null),er=ta.useRef(null);er.current=Nt;let tt=ta.useRef(false);tt.current=fe;let Ct=ta.useCallback(async(_=false)=>{if(w){_||(je(true),Bt(null));try{let S=await qh(w);if(!tt.current)return;let M=Array.isArray(S.data)?S.data:Array.isArray(S)?S:[];Ee(M),_||Bt(null);let q=er.current?.id;if(q){let J=M.find(K=>K.id===q);J&&ct(J);}}catch(S){if(!tt.current)return;_||Bt(S?.message??"Failed to load history");}finally{!_&&tt.current&&je(false);}}},[w]),bt=ta.useCallback(()=>{Ye(true),Ct();},[Ct]);ta.useEffect(()=>{if(!fe||!w)return;let _=setInterval(()=>Ct(true),15e3);return ()=>clearInterval(_)},[fe,w,Ct]);let Ae=ta.useCallback(_=>{switch(_){case "history":bt();break;case "kyc":x?.();break;case "logout":v?.();break}},[bt,x,v]),X=!!w||!!x||!!v?jsxRuntime.jsx(ig,{onSelect:Ae,showKycOption:!!x,showSwitchAccount:F&&!!v}):void 0,Fe=Ne?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ye?g.amount.paymentRowHeader:g.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(ae("select"),te(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:g.amount.paymentLeft,children:[He?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:g.amount.applePayIcon,children:"\uF8FF"}):lr?jsxRuntime.jsx(ff,{sublabel:$e,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:g.amount.paymentLabel,children:xt}),jsxRuntime.jsx(Vr,{size:12,color:g.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:g.form.screen,children:[jsxRuntime.jsx(xr,{onPress:p,title:"Enter amount",leftAction:X}),ye&&Fe,jsxRuntime.jsxs(reactNative.View,{style:g.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[g.amount.amountText,Ke==="0"&&g.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ke]}),jsxRuntime.jsx(reactNative.Text,{style:g.amount.currencyLabel,children:t.toUpperCase()}),Ge&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[g.amount.minAmountText,{color:b.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),pt&&Re!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[g.amount.minAmountText,{color:b.warning}],children:["Maximum amount is $",Re.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!ye&&Fe,Xe.length>0&&jsxRuntime.jsx(reactNative.View,{style:g.amount.quickRow,children:Xe.map(_=>{let S=!_.disabled&&B===_.amount&&B!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[g.amount.quickPill,S&&{backgroundColor:b.primary},_.disabled&&{opacity:.4}],activeOpacity:.7,disabled:_.disabled||l,onPress:()=>W(_.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[g.amount.quickPillText,S&&{color:b.primaryForeground}],children:_.label})},_.label)})}),jsxRuntime.jsx(reactNative.View,{style:g.amount.numpad,children:hS.map((_,S)=>jsxRuntime.jsx(reactNative.View,{style:g.amount.numpadRow,children:_.map(M=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[g.amount.numpadKey,(l||f)&&{opacity:.3}],onPress:()=>Se(M),activeOpacity:.6,disabled:l||f,children:jsxRuntime.jsx(reactNative.Text,{style:M==="\u232B"?g.amount.backspaceText:g.amount.numpadKeyText,children:M})},M))},S))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[g.form.continueBtn,(!st||l||f)&&g.form.continueBtnDisabled],onPress:()=>st&&!l&&!f&&d(B,j),disabled:!st||l||f,children:l?jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:b.primaryForeground,gradientTo:b.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[g.form.continueBtnText,(!st||f)&&g.form.continueBtnTextDisabled],children:"Continue"})}),!ot&&u?jsxRuntime.jsx(reactNative.Text,{style:g.amount.inlineError,children:u}):!ot&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:g.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(rr,{visible:ot,onClose:()=>{l||(te(false),ae("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:V,borderTopRightRadius:P,children:jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetContent,children:de==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(false),activeOpacity:.7,style:g.amount.sheetCloseBtn,children:jsxRuntime.jsx($t,{size:16,color:b.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Yt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[be.map(_=>{let S=j===_.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[g.amount.sheetOption,S&&{borderColor:b.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{G(_.id),xe(_.isApplePay?null:_.label),te(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetOptionIcon,children:_.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:g.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(ff,{sublabel:_.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionLabel,children:_.label}),jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionHint,children:_.hint})]})]}),S&&jsxRuntime.jsx(Pt,{size:18,color:b.primary,strokeWidth:2.5})]},_.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:g.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!$.current){$.current=true;try{let _=await k?.();_&&(G(_.token),xe(_.sublabel),te(!1));}finally{$.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:g.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||ae("select");},activeOpacity:.7,style:g.amount.sheetBackBtn,children:jsxRuntime.jsx(Ka,{size:20,color:b.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetLoading,children:[jsxRuntime.jsx(Te,{size:20,strokeWidth:2}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetErrorText,children:u})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:g.form.continueBtn,onPress:()=>{a&&st&&a(false,B);},children:jsxRuntime.jsx(reactNative.Text,{style:g.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetLoading,children:[jsxRuntime.jsx(Te,{size:20,strokeWidth:2}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(rr,{visible:fe,onClose:()=>{Ye(false),ct(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:V,borderTopRightRadius:P,children:Nt?jsxRuntime.jsx(og,{session:Nt,onBack:()=>ct(null)}):jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetContent,children:[jsxRuntime.jsx(xr,{onPress:()=>Ye(false),title:"Purchase History"}),R&&jsxRuntime.jsx(rg,{active:fe&&!me&&Je.length>0,color:b.primary}),me?jsxRuntime.jsx(tg,{}):vt?jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetErrorText,children:vt})}):Je.length===0?jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[g.amount.sheetStatusText,{color:b.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Yt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:Je.map(_=>{let S=_.transaction_details,M=S?.source_amount?`$${parseFloat(S.source_amount).toFixed(2)}`:"\u2014",q=(S?.destination_currency??"").toUpperCase(),J=S?.destination_amount?`${parseFloat(S.destination_amount).toFixed(2)} ${q}`:"",K=Gd(_.created),ve=_.destination_token_metadata,Ve=ws(ve?.icon_urls,ve?.icon_url),L=ws(ve?.chain?.icon_urls,ve?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:g.amount.sheetOption,activeOpacity:.7,onPress:()=>ct(_),children:[jsxRuntime.jsx(nl,{currency:q||"USD",tokenIconUrl:Ve,networkIconUrl:L,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionLabel,children:M}),J?jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionHint,children:J}):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(eg,{status:_.status,colors:b,fontFamily:O.regular}),K?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:b.foregroundMuted,fontFamily:O.regular},children:K}):null]}),jsxRuntime.jsx(co,{size:14,color:b.foregroundMuted,strokeWidth:2})]})]},_.id)})})]})})]})}function eu({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let i=fi(),{colors:s,fonts:a,components:l}=z(),c=l.input.placeholderColor,u=r==="L0"?["name","address"]:["name","dob","address","ssn"],h=u.length,[k,d]=ta.useState(1),[p,T]=ta.useState(e.firstName??""),[m,w]=ta.useState(e.lastName??""),[R,v]=ta.useState(e.dobMonth??""),[x,F]=ta.useState(e.dobDay??""),[f,g]=ta.useState(e.dobYear??""),[b,C]=ta.useState(e.addressLine1??""),[O,V]=ta.useState(e.addressLine2??""),[P,B]=ta.useState(e.city??""),[W,j]=ta.useState(e.state??""),[Z,Oe]=ta.useState(e.postalCode??""),[G,ot]=ta.useState(e.country??"US"),[te,de]=ta.useState(e.idNumber??""),ae=ta.useRef(null),re=ta.useRef(null),xe=ta.useRef(null),$=ta.useRef(null),Re=ta.useRef(null),dt=ta.useRef(null),Xe=ta.useRef(null),Se=ta.useRef(null),Ke=u[k-1],nt=()=>{switch(Ke){case "name":return p.trim().length>0&&m.trim().length>0;case "dob":return R.length===2&&x.length===2&&f.length===4;case "address":return b.trim().length>0&&P.trim().length>0&&W.trim().length>0&&Z.trim().length>0;case "ssn":return te.trim().length>0;default:return false}},Ge=()=>{nt()&&(k<h?d(be=>be+1):o({firstName:p,lastName:m,idNumber:te,dobMonth:R,dobDay:x,dobYear:f,addressLine1:b,addressLine2:O,city:P,state:W,postalCode:Z,country:G}));},pt=()=>{k>1?d(be=>be-1):n();},st={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:Ne}=st[Ke],ye=[oo.stepCounter,{color:s.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:oo.header,children:[jsxRuntime.jsx(reactNative.View,{style:oo.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:oo.iconButton,onPress:pt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:k>1?"Back":"Cancel",children:jsxRuntime.jsx(cc,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:oo.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:ye,children:[k," of ",h]})}),jsxRuntime.jsx(reactNative.View,{style:oo.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:oo.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx($t,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:oo.progressTrack,children:Array.from({length:h}).map((be,He)=>jsxRuntime.jsx(reactNative.View,{style:[oo.progressSegment,{backgroundColor:He<k||He+1===k?s.primary:s.border}]},He))}),jsxRuntime.jsx(Yt,{style:i.form.flex,contentContainerStyle:oo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[i.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:Ne}),Ke==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ni,{form:i.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"Jane",placeholderTextColor:c,value:p,onChangeText:T,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ae.current?.focus()})}),jsxRuntime.jsx(Ni,{form:i.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ae,style:i.form.input,placeholder:"Doe",placeholderTextColor:c,value:m,onChangeText:w,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ge})})]}),Ke==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:oo.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:oo.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,oo.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,oo.dobInput],placeholder:"MM",placeholderTextColor:c,value:R,onChangeText:be=>{let He=be.replace(/\D/g,"").slice(0,2);v(He),He.length===2&&re.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:oo.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,oo.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:re,style:[i.form.input,oo.dobInput],placeholder:"DD",placeholderTextColor:c,value:x,onChangeText:be=>{let He=be.replace(/\D/g,"").slice(0,2);F(He),He.length===2&&xe.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:oo.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,oo.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:xe,style:[i.form.input,oo.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:f,onChangeText:be=>{let He=be.replace(/\D/g,"").slice(0,4);g(He);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ge})]})]}),Ke==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ni,{form:i.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:b,onChangeText:C,returnKeyType:"next",onSubmitEditing:()=>$.current?.focus()})}),jsxRuntime.jsx(Ni,{form:i.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:$,style:i.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:O,onChangeText:V,returnKeyType:"next",onSubmitEditing:()=>Re.current?.focus()})}),jsxRuntime.jsx(Ni,{form:i.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Re,style:i.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:P,onChangeText:B,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>dt.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:oo.row,children:[jsxRuntime.jsx(reactNative.View,{style:[i.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Ni,{form:i.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:dt,style:i.form.input,placeholder:"CA",placeholderTextColor:c,value:W,onChangeText:be=>j(be.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Xe.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:i.form.flex,children:jsxRuntime.jsx(Ni,{form:i.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Xe,style:i.form.input,placeholder:"94001",placeholderTextColor:c,value:Z,onChangeText:Oe,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Se.current?.focus()})})})]}),jsxRuntime.jsx(Ni,{form:i.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:i.form.input,placeholder:"US",placeholderTextColor:c,value:G,onChangeText:be=>ot(be.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ge})})]}),Ke==="ssn"&&jsxRuntime.jsxs(Ni,{form:i.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:te,onChangeText:de,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ge}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,oo.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t&&k>=h?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(Te,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!nt()&&i.form.continueBtnDisabled],onPress:Ge,disabled:!nt(),children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!nt()&&i.form.continueBtnTextDisabled],children:k>=h?"Submit":"Continue"})})})]})})}function Ni({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 oo=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 kf="@unifold/stripe_oauth";async function cg(){try{let e=await Tf__default.default.getItem(kf);return e?JSON.parse(e):null}catch{return null}}async function xf(e){try{await Tf__default.default.setItem(kf,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ll(){try{await Tf__default.default.removeItem(kf);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var xS=5,Rs=null,_f=false,Rf={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function tu(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:i,authorize:s,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:u,collectPaymentMethod:h,createCryptoPaymentToken:k}=stripeReactNative.useOnramp(),[d,p]=ta.useState(r),[T,m]=ta.useState(!!e?.externalUserId),[w,R]=ta.useState(false),[v,x]=ta.useState(false),[F,f]=ta.useState(""),[g,b]=ta.useState(null),[C,O]=ta.useState(e?.email??""),[V,P]=ta.useState(e?.phone??""),[B,W]=ta.useState(""),[j,Z]=ta.useState("US"),[Oe,G]=ta.useState(""),[ot,te]=ta.useState(""),de=ta.useRef(""),ae=ta.useRef(""),re=ta.useRef(""),[xe,$]=ta.useState(false),[Re,dt]=ta.useState(false),Xe=ta.useRef(0),Se=ta.useRef(false),Ke=ta.useRef(false),nt=ta.useRef(false),Ge=ta.useRef(false),pt=ta.useRef(e?.email??""),st=ta.useRef(false),Ne=ta.useRef(null),ye=ta.useRef(""),be=ta.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),He=ta.useRef(null),[ft,yt]=ta.useState(0),[xt,lr]=ta.useState(Rf),[$e,fe]=ta.useState(e?.defaultWalletAddress??""),[Ye,Je]=ta.useState(""),[Ee,me]=ta.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[je,vt]=ta.useState(e?.defaultSourceAmount??"100"),[Bt,Nt]=ta.useState(e?.defaultSourceCurrency??"usd"),[ct,er]=ta.useState(e?.defaultDestinationCurrency??"usdc"),[tt,Ct]=ta.useState(null),[bt,Ae]=ta.useState(),[at,X]=ta.useState(),[Fe,_]=ta.useState(false),S=ta.useRef(null),M=ta.useRef(false),q=ta.useRef(0),J=ta.useRef(e?.onComplete),K=ta.useRef(e?.onError),ve=ta.useRef(e?.onStepChange),Ve=ta.useRef(r);ta.useEffect(()=>{J.current=e?.onComplete;},[e?.onComplete]),ta.useEffect(()=>{K.current=e?.onError;},[e?.onError]),ta.useEffect(()=>{ve.current=e?.onStepChange;},[e?.onStepChange]);let L=ta.useRef(r);ta.useEffect(()=>{d!==L.current&&(ve.current?.(d,L.current),L.current=d),Ve.current=d;},[d]),ta.useEffect(()=>{v&&d!=="email"&&x(false);},[v,d]),ta.useEffect(()=>{T&&d!==r&&m(false);},[T,d,r]);let U=ta.useCallback((D,H,ke)=>{let Le={code:D,message:H,step:Ve.current,stripeErrorCode:ke};b(Le),f(""),K.current?.(Le);},[]),Ot=ta.useCallback(D=>{let H={sessionId:D.id,status:D.status,sourceAmount:D.transaction_details.source_amount,sourceCurrency:D.transaction_details.source_currency,destinationAmount:D.transaction_details.destination_amount,destinationCurrency:D.transaction_details.destination_currency,destinationNetwork:D.transaction_details.destination_network,walletAddress:D.transaction_details.wallet_address,fees:{networkFee:D.transaction_details.fees.network_fee_amount,transactionFee:D.transaction_details.fees.transaction_fee_amount}};return J.current?.(H),H},[]),We=ta.useCallback(()=>b(null),[]),De=D=>D.refresh_token??D.refresh?.refresh_token??"",wt=ta.useCallback((D,H,ke,Le,qe)=>{ae.current=H,de.current=ke,e?.externalUserId&&xf({accessToken:H,refreshToken:ke,customerId:D,externalUserId:e.externalUserId,email:qe||C,expiresAt:Date.now()+Le*1e3});},[e?.externalUserId,C]),lt=ta.useCallback(async()=>{let D=de.current;if(!D)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let H=await lf(D,re.current??void 0),ke=H.access_token,Le=De(H)||D;return te(ke),wt(re.current,ke,Le,H.expires_in??3600),ke}catch(H){return console.error("[tryRefreshAccessToken] refresh failed:",H?.message),await ll(),Rs=null,He.current=null,ae.current="",de.current="",re.current="",te(""),G(""),null}},[wt]),ee=ta.useCallback(async D=>{try{return await D(ae.current)}catch(H){let ke=H?.message??"";if(ke.includes("stripe_onramp_forbidden")||ke.includes("403")){let Le=await lt();if(!Le)throw U("authorization_error","Session expired. Please sign in again."),p("email"),H;return await D(Le)}throw H}},[lt,U]);ta.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){_(false);return}let H=false;return stripeReactNative.isPlatformPaySupported().then(ke=>{H||_(ke);}),()=>{H=true;}},[e?.merchantIdentifier]),ta.useEffect(()=>(M.current=false,()=>{M.current=true,S.current&&clearTimeout(S.current);}),[]);let $r=ta.useRef(false);ta.useEffect(()=>{if($r.current)return;if(!e?.externalUserId){ll(),Rs=null,He.current=null,m(false);return}let D=false;return (async()=>{try{let H=await cg();if(D||!H){D||m(!1);return}if(H.externalUserId!==e.externalUserId){await ll(),Rs=null,He.current=null,D||m(!1);return}let ke=Date.now()>=H.expiresAt,Le=H.accessToken,qe=H.refreshToken;if(ke)try{let It=await lf(H.refreshToken,H.customerId);if(D)return;Le=It.access_token,qe=It.refresh_token??It.refresh?.refresh_token??H.refreshToken,await xf({accessToken:Le,refreshToken:qe,customerId:H.customerId,externalUserId:e.externalUserId,email:H.email,expiresAt:Date.now()+(It.expires_in??3600)*1e3});}catch(It){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",It?.message),await ll(),Rs=null,He.current=null,D||m(!1);return}if(D)return;if($r.current=!0,G(H.customerId),re.current=H.customerId,te(Le),ae.current=Le,de.current=qe,H.email&&(O(H.email),pt.current=H.email),Rs===H.customerId)He.current=Promise.resolve({error:void 0});else {let It=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:H.customerId});It.error?console.error("[useStripeOnramp] restore configureSDK error:",It.error.message):Rs=H.customerId,He.current=Promise.resolve(It);}if(D)return;let et=()=>new Promise(It=>{let Tr=()=>{st.current&&ye.current?It():setTimeout(Tr,200);};Tr();});try{if(await Promise.race([et(),new Promise((Tr,Et)=>setTimeout(()=>Et(new Error("timeout")),1e4))]),D)return;let It=ye.current.toLowerCase();await u(It,be.current);}catch(It){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",It?.message);}if(D)return;try{let Tr=(await zi(re.current,ae.current)).kyc_tiers??[],Et=Tr.find(Yo=>Yo.tier==="l0"),Kr=Tr.find(Yo=>Yo.tier==="l1"),Co=Tr.find(Yo=>Yo.tier==="l2"),eo=Et?.verification_status==="verified",yn=Kr?.verification_status==="verified",vr=Co?.verification_status==="verified",An=!!Et?.verification_status&&Et.verification_status!=="not_started";p(eo||yn||vr?"session_params":An?"kyc_offer":"kyc");}catch{p("kyc");}}finally{D||m(false);}})(),()=>{D=true;}},[]),ta.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||xe)return;let D=false;dt(true);async function H(){try{let[ke,Le]=await Promise.all([Kh({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?Gh({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(vr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",vr?.message),null)):Promise.resolve(null)]);if(D)return;let qe=e?.destinationChainType??"ethereum",et=ke.data.find(vr=>vr.chain_type===qe);if(et?.address){let vr=et.address.toLowerCase();fe(vr),ye.current=vr,et.recipient_address&&Je(et.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",qe,"in",ke.data?.length,"wallets");let It={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},Tr={8453:"base",1:"ethereum",137:"polygon"},Et=Le?.destination_network,Kr="none";if(Et&&It[Et])me(It[Et]),be.current=It[Et],Kr=Et+" (from default_token API)";else if(e?.destinationChainId&&Tr[e.destinationChainId]){let vr=Tr[e.destinationChainId];It[vr]&&(me(It[vr]),be.current=It[vr]),Kr=vr+" (from chain_id "+e.destinationChainId+")";}else It[qe]&&(me(It[qe]),be.current=It[qe],Kr=qe+" (from chain_type fallback)");Le?.destination_currency&&er(Le.destination_currency.toLowerCase());let Co=Le?.destination_token_metadata,eo=ws(Co?.icon_urls,Co?.icon_url),yn=ws(Co?.chain?.icon_urls,Co?.chain?.icon_url);eo&&Ae(eo),yn&&X(yn),$(!0),st.current=!0;}catch(ke){if(D)return;console.error("[resolveWallet] Failed to resolve wallet:",ke?.message),$(true),st.current=true;}finally{D||dt(false);}}return Ne.current=H(),()=>{D=true;}},[e?.publishableKey,e?.externalUserId,ft]);let mt=ta.useCallback(async()=>{if(He.current)return He.current;let D=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(H=>(H.error&&(console.error("[useStripeOnramp] configureSDK error:",H.error.message,H.error.code),He.current=null),H)).catch(H=>{throw console.error("[useStripeOnramp] configureSDK threw:",H?.message??H),He.current=null,H});return He.current=D,D},[o,e?.merchantDisplayName]);ta.useEffect(()=>{e?.externalUserId||mt();},[]);let tr=ta.useCallback(async D=>{if(!Se.current){Se.current=true,R(true),We(),f("Creating auth intent...");try{let H=await af(D);f("Waiting for authorization...");let ke=await s(H);if(ke?.error){U("authorization_error","Something went wrong during authorization. Please try again."),p("email");return}if(ke?.status==="Denied"){U("authorization_error","Authorization denied by user."),p("email");return}if(ke?.status!=="Consented"||!ke.customerId){U("authorization_error","Authorization was canceled."),p("email");return}f("Exchanging tokens...");let Le=ke.customerId,qe=await Hh(H,Le),et=qe.access_token,It=De(qe);O(D),pt.current=D,G(Le),re.current=Le,Rs=Le,te(et),wt(Le,et,It,qe.expires_in??3600,D),f("Checking verification status...");try{let Et=(await zi(Le,et)).kyc_tiers??[],Kr=Et.find(Eo=>Eo.tier==="l0"),Co=Et.find(Eo=>Eo.tier==="l1"),eo=Et.find(Eo=>Eo.tier==="l2"),yn=Kr?.verification_status==="verified",vr=Co?.verification_status==="verified",An=eo?.verification_status==="verified",Yo=!!Kr?.verification_status&&Kr.verification_status!=="not_started";if(f(""),yn||vr||An){Ne.current&&(f("Resolving wallet..."),await Ne.current,f(""));let Eo=ye.current;if(Eo)try{let bn=Eo.toLowerCase(),fs=be.current,Ln=await u(bn,fs);Ln?.error?(console.warn("[proceedToAuthorize] wallet registration error:",Ln.error.message),U("wallet_error",Ln.error.message,Ln.error.code),p("wallet")):p("session_params");}catch(bn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",bn?.message),p("wallet");}else p("wallet");}else Yo?(await Rr(),f(""),p("kyc_offer")):p("kyc");}catch(Tr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",Tr?.message),f(""),p("kyc");}}catch(H){U("authorization_error",H?.message??String(H)),p("email");}finally{Se.current=false,R(false);}}},[s,We,U,wt,u,Ee]),Ht=ta.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!C){U("validation_error","Please enter an email address.");return}R(true),We(),f("");try{f("Configuring...");let D=await mt();if(D.error){U("configuration_error",D.error.message,D.error.code);return}f("Checking Link account...");let H=await n(C);if(H.error){U("authorization_error",H.error.message,H.error.code);return}H.hasLinkAccount?await tr(C):(f(""),p("disclaimer"));}catch(D){U("unknown_error",D?.message??String(D));}finally{R(false);}},[We,mt,C,U,n,tr]),jr=ta.useCallback(async()=>{if(!nt.current){if(!V){U("validation_error","Please enter your phone number.");return}nt.current=true,R(true),We(),f("");try{f("Creating Link account...");let D=await i({email:C,phone:V,fullName:B||C,country:j||"US"});if(D.error){U("registration_error",D.error.message,D.error.code);return}await tr(C);}catch(D){U("registration_error",D?.message??String(D));}finally{nt.current=false,R(false);}}},[We,j,C,U,B,V,i,tr]);ta.useEffect(()=>{if(d!=="email")return;let D=Ge.current||_f;if(D&&(Ge.current=false,_f=false),!e?.email||T)return;if(D){x(true);return}let H=++Xe.current,ke=false,Le=()=>ke||Xe.current!==H;return e?.phone?(async()=>{R(true),We();try{f("Configuring...");let qe=await mt();if(Le())return;if(qe.error){U("configuration_error",qe.error.message,qe.error.code);return}f("Checking Link account...");let et=await n(e.email);if(Le())return;if(et.error){U("authorization_error",et.error.message,et.error.code);return}if(et.hasLinkAccount){if(Le())return;await tr(e.email);}else {if(Le())return;f(""),p("disclaimer");}}catch(qe){Le()||U("unknown_error",qe?.message??String(qe));}finally{R(false);}})():(async()=>{R(true),We();try{f("Configuring...");let qe=await mt();if(Le())return;if(qe.error){U("configuration_error",qe.error.message,qe.error.code);return}f("Checking Link account...");let et=await n(e.email);if(Le())return;if(et.error){U("authorization_error",et.error.message,et.error.code);return}if(et.hasLinkAccount){if(Le())return;await tr(e.email);}else {if(Le())return;f(""),p("disclaimer");}}catch(qe){Le()||U("unknown_error",qe?.message??String(qe));}finally{R(false);}})(),()=>{ke=true;}},[d,e?.email,e?.phone,T]);let Rr=ta.useCallback(async()=>{Ne.current&&(f("Resolving wallet..."),await Ne.current);let D=ye.current;if(D)try{f("Registering wallet...");let H=D.toLowerCase(),ke=be.current;await u(H,ke);}catch(H){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",H?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[u]),ai=ta.useCallback(async(D,H)=>{R(true),We(),f(""),lr(et=>({...et,...D}));let ke=!H,Le=H??"kyc_offer",qe=H?"kyc_l1":"kyc";try{let et=D.dobDay&&D.dobMonth&&D.dobYear,It=D.firstName&&D.lastName,Tr={};It&&(Tr.firstName=D.firstName,Tr.lastName=D.lastName),D.addressLine1&&(Tr.address={line1:D.addressLine1,line2:D.addressLine2||void 0,city:D.city,state:D.state,postalCode:D.postalCode,country:D.country}),D.idNumber&&(Tr.idNumber=D.idNumber),et&&(Tr.dateOfBirth={day:parseInt(D.dobDay,10),month:parseInt(D.dobMonth,10),year:parseInt(D.dobYear,10)});let Et=await a(Tr);if(Et?.error?.message&&(/no active link consumer/i.test(Et.error.message)||/not be verified/i.test(Et.error.message))){if(f("Verifying identity..."),!await on()){U("kyc_error","Please verify your identity to continue."),p(qe);return}Et=await a(Tr);}if(Et?.error){let vr=ke?"l0":"l1";try{let Yo=(await zi(re.current,ae.current)).kyc_tiers?.find(Eo=>Eo.tier===vr);if(Yo?.verification_status==="verified"){let Eo=ke?"session_params":Le;await Rr(),f(""),p(Eo);return}if(Yo?.verification_status==="rejected"){if(ke){await Rr(),f(""),p(Le);return}U("kyc_error","Something went wrong. Please try again."),p(qe);return}}catch(An){console.warn("[attachKyc] could not fetch verification status:",An?.message);}if(ke){await Rr(),f(""),p(Le);return}U("kyc_error",Et.error.message,Et.error.stripeErrorCode??Et.error.code),p(qe);return}if(!(Et&&Object.keys(Et).length>0&&!Et.error)){let vr=ke?"l0":"l1";if(f("Verifying identity..."),(!re.current||!ae.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${vr} \u2014 missing customerIdRef or accessTokenRef`),!ke)){U("kyc_error","Unable to verify identity. Please try again."),p(qe);return}let An=re.current,Yo=ae.current,Eo=10,bn=!1;if(An&&Yo)for(let fs=0;fs<Eo;fs++){try{let ia=(await zi(An,Yo)).kyc_tiers?.find(vp=>vp.tier===vr);if(ia?.verification_status==="verified"){bn=!0;break}if(ia?.verification_status==="rejected"){if(ke)break;console.warn(`[attachKyc] \u274C ${vr} rejected:`,ia?.verification_errors),U("kyc_error","KYC verification was rejected. Please try again."),p(qe);return}}catch(Ln){console.warn(`[attachKyc] ${vr} poll error:`,Ln?.message);}await new Promise(Ln=>setTimeout(Ln,2e3));}if(!bn&&!ke){console.warn(`[attachKyc] \u274C ${vr} verification timed out after`,Eo,"attempts"),U("kyc_error","Identity verification is taking longer than expected. Please try again."),p(qe);return}await Rr(),f(""),p(ke&&bn?"session_params":Le);return}f("Please review your KYC information...");let eo=await l(null);if(eo?.error){U("kyc_error",eo.error.message,eo.error.stripeErrorCode??eo.error.code),p(qe);return}if(eo?.status==="UpdateAddress"){U("kyc_error","Please update your address and resubmit."),p(qe);return}await Rr(),f(""),p(ke?"session_params":Le);}catch(et){U("kyc_error",et?.message??String(et)),p(qe);}finally{R(false);}},[a,We,U,l,Rr]),on=ta.useCallback(async()=>{let D=pt.current||e?.email;if(!D)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(pt.current),"config.email:",e?.email),false;try{let H=await af(D),ke=await s(H);return ke?.status==="Consented"&&ke.customerId?(re.current=ke.customerId,G(ke.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",ke?.status),!1)}catch(H){return console.warn("[reestablishLinkSession] failed:",H?.message),false}},[s,e?.email]),yo=ta.useCallback(async()=>{if(!Ke.current){Ke.current=true,R(true),We(),f("Launching identity verification...");try{let D=await c();if(D?.error?.message&&(/no active link consumer/i.test(D.error.message)||/not be verified/i.test(D.error.message))){if(f("Verifying identity..."),!await on()){U("identity_error","Please verify your identity to continue.");return}D=await c();}if(D?.error){let ke=D.error.message??"";if(/cancel/i.test(ke)){f("");return}U("identity_error",ke,D.error.code);return}f(""),Io.current?(Io.current=!1,p("session_params")):p("wallet");}catch(D){U("identity_error",D?.message??String(D));}finally{Ke.current=false,R(false);}}},[We,U,on,c]),Io=ta.useRef(false);ta.useEffect(()=>{d==="identity"&&!w&&yo();},[d]);let Vn=ta.useCallback(async()=>{if(!$e){U("validation_error","Please enter a wallet address.");return}R(true),We(),f("");try{let D=$e.toLowerCase(),H=await u(D,Ee);if(H?.error){console.warn("[registerWallet] error:",H.error.message),U("wallet_error",H.error.message,H.error.code);return}f(""),p("kyc_offer");}catch(D){console.error("[registerWallet] exception:",D?.message??String(D)),U("wallet_error",D?.message??String(D));}finally{R(false);}},[We,U,$e,Ee,u]);ta.useEffect(()=>{d==="wallet"&&xe&&$e&&Vn();},[d,xe,$e]);let bo=ta.useCallback(D=>{M.current=false,q.current=0;let H=0,ke=async()=>{H+=1;let Le=ae.current;try{let qe=await Qh(D,Le);if(M.current)return;q.current=0,qe.status==="fulfillment_complete"?(Ct(qe),p("success")):S.current=setTimeout(ke,3e3);}catch(qe){if(M.current)return;let et=qe?.message??"";if((et.includes("stripe_onramp_forbidden")||et.includes("403"))&&await lt()&&!M.current){S.current=setTimeout(ke,1e3);return}if(q.current+=1,console.error(`[pollSessionStatus] poll #${H} error:`,et),q.current>=xS){U("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}S.current=setTimeout(ke,5e3);}};S.current=setTimeout(ke,3e3);},[U,lt]),na=ta.useCallback(()=>{if(Ve.current==="processing"&&tt?.id){if(!ae.current){U("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}We(),q.current=0,S.current&&(clearTimeout(S.current),S.current=null),bo(tt.id);}},[We,U,bo,tt?.id]),wo=ta.useCallback(async D=>{R(true),We(),f("");try{f("Confirming purchase...");let H=await ee(ke=>jh(D,ke));Ct(H),p("processing"),f(""),bo(H.id);}finally{R(false);}},[We,bo,ee]),Li=ta.useRef(false),_t=ta.useCallback(async()=>{if(!(!tt||Li.current)){Li.current=true;try{R(!0),We(),f("Refreshing quote...");let D=await ee(H=>cf(tt.id,H));Ct(D),await wo(D.id);}catch{U("session_error","Something went wrong. Please try again."),p("quote");}finally{R(false),Li.current=false;}}},[We,U,wo,tt,ee]),oe=ta.useCallback(async(D=false,H,ke)=>{let Le=H??je;if(!Le||isNaN(Number(Le))||Number(Le)<=0){U("validation_error","Please enter a valid amount.");return}H&&vt(H),R(true),We(),f("");try{let qe=await mt();if(qe.error){U("configuration_error",qe.error.message,qe.error.code);return}let et;if(ke)et=ke;else if(D){if(!e?.merchantIdentifier?.trim()){U("configuration_error","Apple Pay is not configured. Set the Apple Pay merchant identifier for this project on the Unifold dashboard."),p("session_params");return}f("Opening Apple Pay...");let Et={applePay:{merchantCountryCode:"US",currencyCode:Bt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ct.toUpperCase()} purchase + fees`,amount:Le}]}},Kr=await h("PlatformPay",Et);if(Kr?.error){let eo=Kr.error.message??"",yn=Kr.error.code??"";/cancel/i.test(eo)||/cancel/i.test(yn)||(U("payment_error",eo,yn),p("session_params"));return}if(!Kr?.displayData)return;f("Creating payment token...");let Co=await k();if(Co?.error){U("payment_error",Co.error.message,Co.error.code),p("session_params");return}et=Co.cryptoPaymentToken;}else {f("Select a payment method...");let Et=await h("Card");if(Et?.error){let Co=Et.error.message??"",eo=Et.error.code??"";/cancel/i.test(Co)||/cancel/i.test(eo)||(U("payment_error",Co,eo),p("session_params"));return}if(!Et?.displayData)return;f("Creating payment token...");let Kr=await k();if(Kr?.error){U("payment_error",Kr.error.message,Kr.error.code),p("session_params");return}et=Kr.cryptoPaymentToken;}f("Creating onramp session...");let It=ye.current||$e;if(!It){U("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let Tr=await ee(Et=>$h({cryptoCustomerId:re.current,paymentToken:et,sourceAmount:Number(Le),sourceCurrency:Bt,destinationCurrency:ct,walletAddress:It,destinationNetwork:Ee},Et));Ct(Tr),f(""),D?await wo(Tr.id):p("quote");}catch{U("session_error","Something went wrong. Please try again."),p("session_params");}finally{R(false),f("");}},[We,mt,h,k,ct,U,wo,vt,je,Bt,$e,Ee,ee,e?.merchantIdentifier]),we=ta.useCallback(async()=>{R(true),We(),f("Select a payment method...");try{let D=await mt();if(D.error)return U("configuration_error",D.error.message,D.error.code),null;let H=await h("Card");if(H?.error?.message&&(/no active link consumer/i.test(H.error.message)||/not be verified/i.test(H.error.message))){if(!await on())return U("authorization_error","Please verify your identity to add a payment method."),null;H=await h("Card");}if(H?.error){let et=H.error.message??"",It=H.error.code??"";return /cancel/i.test(et)||/cancel/i.test(It)||U("payment_error",et,It),null}if(!H?.displayData)return null;let Le=H.displayData;f("Saving payment method...");let qe=await k();return qe?.error?(U("payment_error",qe.error.message,qe.error.code),null):{token:qe.cryptoPaymentToken,sublabel:Le.sublabel??""}}catch(D){return U("session_error",D?.message??String(D)),null}finally{R(false),f("");}},[We,mt,h,k,U,on]),ht=ta.useCallback(async()=>{if(tt){R(true),We(),f("");try{let D=await ee(H=>cf(tt.id,H));Ct(D);}catch{U("session_error","Something went wrong. Please try again.");}finally{R(false);}}},[We,U,tt,ee]),Cr=ta.useCallback(()=>{M.current=true,q.current=0,S.current&&(clearTimeout(S.current),S.current=null),p(r),R(false),x(false),f(""),b(null),O(e?.email??""),pt.current=e?.email??"",P(e?.phone??""),W(""),Z("US"),G(""),re.current="",te(""),ae.current="",de.current="",$(false),dt(false),Ne.current=null,yt(D=>D+1),lr(Rf),fe(""),ye.current="",st.current=false,me(stripeReactNative.Onramp.CryptoNetwork.ethereum),vt(e?.defaultSourceAmount??"100"),Nt(e?.defaultSourceCurrency??"usd"),er(e?.defaultDestinationCurrency??"usdc"),Je(""),Ae(void 0),X(void 0),Ct(null),Xe.current+=1,Se.current=false,Ke.current=false,nt.current=false;},[e,r]),Or=ta.useCallback(()=>{Io.current=true,p("kyc_offer");},[]),$o=ta.useCallback(async()=>{await ll(),Rs=null,He.current=null,_f=true,Ge.current=true,M.current=true,q.current=0,S.current&&(clearTimeout(S.current),S.current=null),Xe.current+=1,Se.current=false,Ke.current=false,nt.current=false,ae.current="",de.current="",re.current="",ye.current="",st.current=false,Ne.current=null,te(""),G(""),O(e?.email??""),pt.current=e?.email??"",P(e?.phone??""),W(""),Z("US"),Ct(null),b(null),R(false),x(false),f(""),lr(Rf),fe(""),$(false),dt(false),yt(D=>D+1),Je(""),Ae(void 0),X(void 0),p(r);},[e?.email,e?.phone,r]);return {step:d,restoring:T,loading:w,status:F,error:g,email:C,phone:V,fullName:B,country:j,customerId:Oe,accessToken:ot,session:tt,kycData:xt,walletAddress:$e,resolvedRecipientAddress:Ye,walletNetwork:Ee,sourceAmount:je,sourceCurrency:Bt,destinationCurrency:ct,tokenIconUrl:bt,networkIconUrl:at,applePaySupported:Fe,walletReady:xe,walletLoading:Re,setStep:p,setStatus:f,setEmail:O,setPhone:P,setFullName:W,setCountry:Z,setWalletAddress:fe,setWalletNetwork:me,setSourceAmount:vt,setSourceCurrency:Nt,setDestinationCurrency:er,checkEmail:Ht,register:jr,attachKyc:ai,verifyIdentity:yo,requestKYCUpgrade:Or,kycUpgradeMode:Io,logout:$o,registerWallet:Vn,collectPaymentMethod:oe,addPaymentMethod:we,refreshQuote:ht,confirmCheckout:_t,reset:Cr,clearError:We,emitComplete:Ot,resumeFulfillmentPolling:na,amountFirst:t,switchingAccount:v}}function dg({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:i}){let s=fi(),{colors:a,fonts:l,components:c}=z(),u=c.input.placeholderColor,[h,k]=ta.useState(e.dobMonth??""),[d,p]=ta.useState(e.dobDay??""),[T,m]=ta.useState(e.dobYear??""),[w,R]=ta.useState(e.idNumber??""),[v,x]=ta.useState(null),F=ta.useRef(null),f=ta.useRef(null),g=ta.useRef(null),b=h.length===2&&d.length===2&&T.length===4&&w.trim().length>0,C=()=>{if(!b)return;let V=parseInt(h,10),P=parseInt(d,10),B=parseInt(T,10),W=new Date().getFullYear();if(V<1||V>12){x("Please enter a valid month (01\u201312).");return}if(P<1||P>31){x("Please enter a valid day (01\u201331).");return}if(B<1900||B>W){x(`Please enter a valid year (1900\u2013${W}).`);return}x(null),o({dobMonth:h,dobDay:d,dobYear:T,idNumber:w});},O=v||r;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.jsx(xr,{onPress:t?i??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Yt,{style:s.form.flex,contentContainerStyle:bi.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:bi.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:bi.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:bi.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,bi.dobInput],placeholder:"MM",placeholderTextColor:u,value:h,onChangeText:V=>{let P=V.replace(/\D/g,"").slice(0,2);k(P),P.length===2&&F.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:bi.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:F,style:[s.form.input,bi.dobInput],placeholder:"DD",placeholderTextColor:u,value:d,onChangeText:V=>{let P=V.replace(/\D/g,"").slice(0,2);p(P),P.length===2&&f.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:bi.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:f,style:[s.form.input,bi.dobInput],placeholder:"YYYY",placeholderTextColor:u,value:T,onChangeText:V=>{let P=V.replace(/\D/g,"").slice(0,4);m(P),P.length===4&&g.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:bi.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:g,style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:u,value:w,onChangeText:R,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:C,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),O?jsxRuntime.jsx(reactNative.Text,{style:[s.amount.inlineError,{marginTop:20}],children:O}):null]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(Te,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!b&&s.form.continueBtnDisabled],onPress:C,disabled:!b,children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!b&&s.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var bi=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 ug({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ta.useRef(new reactNative.Animated.Value(.3)).current;return ta.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[sr.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:sr.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[sr.skeletonLine,{width:"60%"}]})]})}function pg({onRefresh:e,colors:t,fonts:r}){let[o,n]=ta.useState(10),i=ta.useRef(null);ta.useEffect(()=>(i.current=setInterval(()=>{n(l=>l<=1?(i.current&&clearInterval(i.current),0):l-1);},1e3),()=>{i.current&&clearInterval(i.current);}),[]);let s=ta.useCallback(()=>{o>0||(e(),n(10),i.current=setInterval(()=>{n(l=>l<=1?(i.current&&clearInterval(i.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,disabled:!a,style:sr.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(Ya,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[sr.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function gg({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:i=false,loadingTiers:s=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:u=false,l2Completed:h=false,canPurchase:k=false,currentLimit:d}){let p=fi(),{colors:T,fonts:m,components:w}=z(),R=[sr.card,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius??12,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],v=[...R,{opacity:.5}],x=l==="verified",F=l==="pending",f=l==="rejected",g=c==="verified",b=c==="pending",C=x&&g,O=!x,V=!g,P=x,B=(k||x)&&!C,W=j=>`$${j.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:p.form.screen,children:[jsxRuntime.jsx(xr,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:sr.content,children:[d!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[sr.limitBadge,{backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth,borderRadius:w.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.limitLabel,{color:T.foregroundMuted,fontFamily:m.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[sr.limitValue,{color:T.foreground,fontFamily:m.semibold}],children:[W(d)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[sr.subtitle,{color:T.foregroundMuted,fontFamily:m.regular}],children:s?"Checking your verification status...":C?"All verification levels have been completed. Your limits are at the maximum available.":k?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ug,{borderRadius:w.card.borderRadius??12,backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth}),jsxRuntime.jsx(ug,{borderRadius:w.card.borderRadius??12,backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[O&&(F?jsxRuntime.jsxs(reactNative.View,{style:R,children:[jsxRuntime.jsxs(reactNative.View,{style:sr.pendingHeader,children:[jsxRuntime.jsx(Jo,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:T.foreground,fontFamily:m.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(pg,{onRefresh:n,colors:T,fonts:m}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[sr.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:T.foregroundMuted,fontFamily:m.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:T.primary,gradientTo:T.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[R,sr.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(Jo,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:sr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:T.foreground,fontFamily:m.semibold}],children:f?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:T.foregroundMuted,fontFamily:m.regular}],children:f?"Previous verification was unsuccessful. Please try again.":k?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(co,{size:18,color:T.foregroundMuted,strokeWidth:2})]})),V&&(b?jsxRuntime.jsxs(reactNative.View,{style:R,children:[jsxRuntime.jsxs(reactNative.View,{style:sr.pendingHeader,children:[jsxRuntime.jsx(Id,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:T.foreground,fontFamily:m.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(pg,{onRefresh:n,colors:T,fonts:m}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[sr.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:T.foregroundMuted,fontFamily:m.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:T.primary,gradientTo:T.primary})]})]}):P?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[R,sr.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Id,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:sr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:T.foreground,fontFamily:m.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:T.foregroundMuted,fontFamily:m.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(co,{size:18,color:T.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[v,sr.cardRow],children:[jsxRuntime.jsx(Id,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:sr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[sr.cardTitle,{color:T.foregroundMuted,fontFamily:m.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[sr.cardBody,{color:T.foregroundMuted,fontFamily:m.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:sr.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[p.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,i?jsxRuntime.jsxs(reactNative.View,{style:sr.loaderRow,children:[jsxRuntime.jsx(Te,{size:24,strokeWidth:2,gradientFrom:T.primary,gradientTo:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[p.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):C?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:p.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:p.form.continueBtnText,children:"Done"})}):B?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 sr=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 nu={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 bg({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:i,components:s}=z(),a=[ti.link,{color:n.primary,fontFamily:i.medium}],l=s.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:ti.logoRow,children:jsxRuntime.jsx(gh,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:ti.scroll,contentContainerStyle:ti.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[ti.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ti.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[ti.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ti.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ti.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[ti.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ti.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 ti=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 wg({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:c}){let{colors:u}=z();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Te,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{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:s,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Te,{size:28,strokeWidth:2,gradientFrom:u.primaryForeground,gradientTo:u.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:n,progress:i,loading:o})]})]})})}function Sg({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(Te,{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(Xo,{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 kg({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:u}){let{colors:h}=z(),k=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[k?jsxRuntime.jsx(xr,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:$d}),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(Te,{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&&i&&s&&jsxRuntime.jsx(qd,{sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Xo,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:u,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function xg({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,tokenIconUrl:s,networkIconUrl:a,onClose:l,onBack:c}){let{colors:u}=z(),h=t.transaction_details,k=Hd(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{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(nl,{currency:h.destination_currency,tokenIconUrl:s,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(Jn,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Jn,{quote:e.quote,label:"You receive",value:`${k} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Jn,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Jn,{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(Te,{size:28,strokeWidth:2,gradientFrom:u.primaryForeground,gradientTo:u.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})}function _g({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:c}){let u=z(),{colors:h,fonts:k,components:d}=u,[p,T]=ta.useState("");ta.useEffect(()=>{if(t)return;let R=p?`+1${p}`:"";a(R);},[p,a,t]);let m=ta.useCallback(R=>{T(R.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Te,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]});let w=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(xr,{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:Bc.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Bc.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Bc.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Bc.dialCode,{color:h.foreground,fontFamily:k.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Bc.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:u.components.input.placeholderColor,keyboardType:"phone-pad",value:p,onChangeText:m,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>w&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:i})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Te,{size:28,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!w&&e.form.continueBtnDisabled],onPress:l,disabled:!w,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!w&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})})}var Bc=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 XS({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=z(),n=e.toLowerCase(),i=jd[n]??o.primary,s=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[Ti.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:i}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ti.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Ti.checkBadge,{width:s,height:s,borderRadius:s/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(Pt,{size:s*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Rg({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:i,onDone:s}){let {colors:a,components:l,fonts:c}=z(),u=t.transaction_details,h=Hd(u.destination_amount,u.destination_currency),k=r||o||"";ol(u.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:s,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Yt,{style:e.form.flex,contentContainerStyle:Ti.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ti.iconSection,children:[jsxRuntime.jsx(XS,{currency:u.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Ti.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ti.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ti.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ti.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(qd,{sourceCurrency:u.source_currency,destinationCurrency:u.destination_currency,destinationNetwork:u.destination_network,tokenIconUrl:n,networkIconUrl:i,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Ti.detailCard],children:[jsxRuntime.jsx(Jn,{quote:e.quote,label:"You Paid",value:`${u.source_amount} ${u.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Jn,{quote:e.quote,label:"You Received",value:`${h} ${u.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Jn,{quote:e.quote,label:"Network Fee",value:`$${u.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Jn,{quote:e.quote,label:"Transaction Fee",value:`$${u.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(sf,{quote:e.quote,label:"Intent Address",address:u.wallet_address,hideDivider:true}),k?jsxRuntime.jsx(sf,{quote:e.quote,label:"Recipient Address",address:k,last:true}):jsxRuntime.jsx(Jn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var Ti=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 vg({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:u,onClose:h}){let{colors:k,components:d}=z();if(t){let p=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(xr,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!p&&jsxRuntime.jsx(Te,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{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:u,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(xr,{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:i,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Ud.map(p=>{let T=s===p.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,T&&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,T&&e.wallet.rowTextSelected],children:p.label}),T&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(Pt,{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(Te,{size:28,strokeWidth:2,gradientFrom:k.primaryForeground,gradientTo:k.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:u,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})})}function du({config:e,onClose:t}){let r=z(),o=fi(),{step:n,restoring:i,loading:s,status:a,error:l,email:c,phone:u,session:h,kycData:k,walletAddress:d,resolvedRecipientAddress:p,walletNetwork:T,sourceAmount:m,sourceCurrency:w,destinationCurrency:R,tokenIconUrl:v,networkIconUrl:x,applePaySupported:F,setStep:f,setEmail:g,setPhone:b,setWalletAddress:C,setWalletNetwork:O,setSourceAmount:V,setDestinationCurrency:P,checkEmail:B,register:W,attachKyc:j,verifyIdentity:Z,registerWallet:Oe,collectPaymentMethod:G,addPaymentMethod:ot,confirmCheckout:te,reset:de,emitComplete:ae,resumeFulfillmentPolling:re,amountFirst:xe,customerId:$,accessToken:Re,requestKYCUpgrade:dt,kycUpgradeMode:Xe,logout:Se,clearError:Ke,switchingAccount:nt}=tu(e),Ge=!!e?.email&&!nt,pt=!!e?.phone,st=!!e?.publishableKey&&!!e?.externalUserId,[Ne,ye]=ta.useState(void 0),[be,He]=ta.useState(void 0),[ft,yt]=ta.useState([]),[xt,lr]=ta.useState(false),[$e,fe]=ta.useState(false),[Ye,Je]=ta.useState(null),[Ee,me]=ta.useState(null),[je,vt]=ta.useState(null),[Bt,Nt]=ta.useState(false),ct=ta.useCallback(async()=>{await Se(),t?.();},[Se,t]);ta.useEffect(()=>{n!=="kyc_offer"||!$||!Re||(Nt(true),zi($,Re).then(Ae=>{let at=Ae.kyc_tiers??[],X=at.find(S=>S.tier==="l0"),Fe=at.find(S=>S.tier==="l1"),_=at.find(S=>S.tier==="l2");X?.verification_status&&Je(X.verification_status),Fe?.verification_status&&me(Fe.verification_status),_?.verification_status&&vt(_.verification_status);}).catch(Ae=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",Ae?.message);}).finally(()=>Nt(false)),d&&df({destinationNetwork:T||"ethereum",walletAddress:d,accessToken:Re,cryptoCustomerId:$}).then(Ae=>{let at=Ae.limits?.usd;if(at?.card?.length){let X=Math.max(...at.card.map(Fe=>Fe.limit));ye(X);}}).catch(Ae=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",Ae?.message);}));},[n,$,Re,d,T]),ta.useEffect(()=>{if(i||n!=="session_params"||!$||!Re)return;let Ae=X=>{let Fe=X?.message??"";return Fe.includes("stripe_onramp_forbidden")||Fe.includes("403")},at=X=>{Ae(X)&&ct();};zi($,Re).then(X=>{let Fe=X.kyc_tiers??[],_=Fe.find(K=>K.tier==="l0"),S=Fe.find(K=>K.tier==="l1"),M=Fe.find(K=>K.tier==="l2"),q=!!S?.verification_status&&S.verification_status!=="not_started",J=M?.verification_status==="verified";lr(q),fe(!!J),_?.verification_status&&Je(_.verification_status),S?.verification_status&&me(S.verification_status),M?.verification_status&&vt(M.verification_status);}).catch(X=>{console.warn("[OnrampScreen] customer fetch error:",X?.message),at(X);}),uf($,Re).then(X=>{yt(X.data??[]);}).catch(X=>{console.warn("[OnrampScreen] payment_tokens error:",X?.message),at(X);}),d&&df({destinationNetwork:T||"ethereum",walletAddress:d,accessToken:Re,cryptoCustomerId:$}).then(X=>{let Fe=X.limits?.usd;if(Fe?.card?.length){let _=Math.max(...Fe.card.map(S=>S.limit));ye(_);}}).catch(X=>{console.warn("[OnrampScreen] transaction_limits error:",X?.message),at(X);}),wc(e?.publishableKey).then(X=>{let Fe=X.data?.find(_=>_.currency_code==="usd");Fe&&He(Fe.minimum_amount);}).catch(X=>{console.warn("[OnrampScreen] fiat_currencies error:",X?.message);});},[i,n,$,Re,d,T,de,ct]);let er=async()=>{if(!(!$||!Re))try{let Ae=await uf($,Re);yt(Ae.data??[]);}catch(Ae){console.warn("[OnrampScreen] payment_tokens refresh error:",Ae?.message);let at=Ae?.message??"";(at.includes("stripe_onramp_forbidden")||at.includes("403"))&&ct();}},tt=async()=>{let Ae=await ot();return Ae&&await er(),Ae},Ct=e?.skipSuccessConfirmation===true;ta.useEffect(()=>{n==="success"&&Ct&&h&&(ae(h),de(),t?.());},[n,Ct,h,ae,de,t]),ta.useEffect(()=>{n==="register"&&pt&&W();},[n,pt,W]);let bt=()=>{de(),t?.();};if(i)return jsxRuntime.jsx(reactNative.View,{style:[sT.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(Te,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(bg,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>f("register"),onClose:()=>f("email")});if(n==="email")return jsxRuntime.jsx(wg,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Ge,loading:s,error:l,status:a,email:c,setEmail:g,checkEmail:B,onClose:bt});if(n==="register")return jsxRuntime.jsx(_g,{styles:o,hasPrefilledPhone:pt,loading:s,error:l,status:a,email:c,phone:u,setPhone:b,register:W,onClose:bt});if(n==="kyc")return jsxRuntime.jsx(eu,{initialData:k,loading:s,onComplete:j,onCancel:bt});if(n==="kyc_offer"){let X=Ye==="verified"||Ee==="verified"||je==="verified",Fe=()=>{Xe.current&&(Xe.current=false),f("session_params");};return jsxRuntime.jsx(gg,{onSelectL1:()=>f("kyc_l1"),onSelectL2:()=>{Xe.current=true,f("identity");},onSkip:Fe,onClose:()=>{Xe.current?(Xe.current=false,f("session_params")):X?Fe():bt();},onRefresh:()=>{!$||!Re||(Nt(true),zi($,Re).then(M=>{let q=M.kyc_tiers??[],J=q.find(Ve=>Ve.tier==="l0"),K=q.find(Ve=>Ve.tier==="l1"),ve=q.find(Ve=>Ve.tier==="l2");J?.verification_status&&Je(J.verification_status),K?.verification_status&&me(K.verification_status),ve?.verification_status&&vt(ve.verification_status);}).catch(M=>{console.warn("[OnrampScreen] refresh customer fetch error:",M?.message);}).finally(()=>Nt(false)));},loading:s,loadingTiers:Bt,error:l?.message,l1Status:Ee??"not_started",l2Status:je??"not_started",l1Completed:xt,l2Completed:$e,canPurchase:X,currentLimit:X?Ne:void 0})}if(n==="kyc_l1"){let Ae=Xe.current?"session_params":"wallet";return jsxRuntime.jsx(dg,{initialData:k,loading:s,error:l?.message,onComplete:at=>{Xe.current&&(Xe.current=false),j(at,Ae);},onCancel:()=>{Ke(),f("kyc_offer");},onClose:bt})}return n==="identity"?jsxRuntime.jsx(Sg,{styles:o,loading:s,status:a,error:l,verifyIdentity:Z,onClose:()=>{Xe.current?(Xe.current=false,f("session_params")):bt();}}):n==="wallet"?jsxRuntime.jsx(vg,{styles:o,hasAutoWallet:st,loading:s,error:l,status:a,walletAddress:d,walletNetwork:T,setWalletAddress:C,setWalletNetwork:O,setDestinationCurrency:P,registerWallet:Oe,onClose:bt}):n==="session_params"?jsxRuntime.jsx(Xd,{initialAmount:m,currency:w,applePaySupported:F,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:be,maxAmount:Ne,paymentTokens:ft,onAddPaymentMethod:tt,onCollectPayment:(Ae,at)=>{G(Ae,at);},paymentLoading:s,paymentStatus:a,paymentError:l?.message??null,onConfirm:(Ae,at)=>{if(xe&&!$)V(Ae),f("email");else {let X=at==="apple_pay";G(X,Ae,!X&&at?at:void 0);}},onCancel:bt,accessToken:Re,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:ct,onRequestKYC:dt,showSwitchAccount:!Ge,inputDisabled:(Ye!==null||Ee!==null)&&Ye!=="verified"&&Ee!=="verified"&&je!=="verified"}):n==="quote"&&h?jsxRuntime.jsx(xg,{styles:o,session:h,loading:s,error:l,status:a,confirmCheckout:te,tokenIconUrl:v,networkIconUrl:x,onClose:bt,onBack:()=>f("session_params")}):n==="processing"?jsxRuntime.jsx(kg,{styles:o,error:l,status:a,loading:s,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??R,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:v,networkIconUrl:x,onClose:bt,onRetryStatusCheck:re}):n==="success"&&h&&!Ct?jsxRuntime.jsx(Rg,{styles:o,session:h,resolvedRecipientAddress:p,recipientFromConfig:e?.recipientAddress,tokenIconUrl:v,networkIconUrl:x,onDone:()=>{ae(h),de(),t?.();}}):null}var sT=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function uu({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:u,onStepChange:h,onClose:k,urlScheme:d="unifoldOnramp",paymentSelectorPosition:p,skipSuccessConfirmation:T=false,appName:m}){let{colors:w,fonts:R,components:v}=z(),x=e||Vd(),[F,f]=ta.useState(""),[g,b]=ta.useState("loading"),[C,O]=ta.useState(null);ta.useEffect(()=>{let P=false;async function B(){try{x&&(Qd(x),Kd(sa()));let W=await Rc();if(P)return;let j=W.merchantIdentifier??"";if(f(j),await stripeReactNative.initStripe({publishableKey:W.publishableKey,urlScheme:d,...j?{merchantIdentifier:j}:{}}),P)return;b("ready");}catch(W){if(P)return;console.error("[StripeOnramp] Init failed:",W),O(W?.message??"Failed to load Stripe configuration"),b("error");}}return B(),()=>{P=true;}},[x,d]);let V=ta.useMemo(()=>{let P={publishableKey:x,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:c,onError:u,onStepChange:h};return a&&(P.destinationTokenAddress=a),l&&(P.recipientAddress=l),t&&(P.email=t),r&&(P.phone=r),n&&(P.flowOrder=n),p&&(P.paymentSelectorPosition=p),P.skipSuccessConfirmation=T,P.merchantIdentifier=F,m&&(P.merchantDisplayName=m),P},[x,o,i,s,a,l,t,r,n,p,T,F,m,c,u,h]);return g==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ml.centered,{backgroundColor:w.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ml.errorText,{color:w.error,fontFamily:R.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ml.errorDetail,{color:w.foregroundMuted,fontFamily:R.regular}],children:C}),k&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ml.retryBtn,{backgroundColor:v.button.primaryBackground,borderRadius:v.button.borderRadius}],onPress:k,children:jsxRuntime.jsx(reactNative.Text,{style:[ml.retryBtnText,{color:v.button.primaryText,fontFamily:R.medium}],children:"Go Back"})})]}):g==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ml.centered,{backgroundColor:w.background}],children:jsxRuntime.jsx(Te,{size:56,strokeWidth:3,gradientFrom:w.primary,gradientTo:w.primary})}):jsxRuntime.jsx(du,{config:V,onClose:k})}var ml=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 Pg(){let{configure:e}=stripeReactNative.useOnramp(),t=ta.useRef(false);return ta.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 Fg="__unifold_stripe_onramp__";function pu(e){globalThis[Fg]=e;}function Dg(){return globalThis[Fg]}pu(uu);var Ps=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 ma,Fs,hl,Og,gT=(Og=class extends Ps{constructor(){super();ue(this,ma);ue(this,Fs);ue(this,hl);Y(this,hl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Fs)||this.setEventListener(y(this,hl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Fs))==null||t.call(this),Y(this,Fs,void 0));}setEventListener(t){var r;Y(this,hl,t),(r=y(this,Fs))==null||r.call(this),Y(this,Fs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,ma)!==t&&(Y(this,ma,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,ma)=="boolean"?y(this,ma):globalThis.document?.visibilityState!=="hidden"}},ma=new WeakMap,Fs=new WeakMap,hl=new WeakMap,Og),fu=new gT;var yT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ki,ha,Vg,bT=(Vg=class{constructor(){ue(this,ki,yT);ue(this,ha,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,ha)&&e!==y(this,ki)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,ki),provider:e}),Y(this,ki,e),process.env.NODE_ENV!=="production"&&Y(this,ha,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,ha,true),y(this,ki).setTimeout(e,t)}clearTimeout(e){y(this,ki).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,ha,true),y(this,ki).setInterval(e,t)}clearInterval(e){y(this,ki).clearInterval(e);}},ki=new WeakMap,ha=new WeakMap,Vg),Ec=new bT;function Ag(e){setTimeout(e,0);}var Eg=typeof window>"u"||"Deno"in globalThis;function pn(){}function Wg(e,t){return typeof e=="function"?e(t):e}function Mg(e){return typeof e=="number"&&e>=0&&e!==1/0}function zg(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wc(e,t){return typeof e=="function"?e(t):e}function Ug(e,t){return typeof e=="function"?e(t):e}function Vf(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==Mc(s,t.options))return false}else if(!bl(t.queryKey,s))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||i&&!i(t))}function Af(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(gl(t.options.mutationKey)!==gl(i))return false}else if(!bl(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Mc(e,t){return (t?.queryKeyHashFn||gl)(e)}function gl(e){return JSON.stringify(e,(t,r)=>Of(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function bl(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>bl(e[r],t[r])):false}var wT=Object.prototype.hasOwnProperty;function Df(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Lg(e)&&Lg(t);if(!o&&!(Of(e)&&Of(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},c=0;for(let u=0;u<a;u++){let h=o?u:s[u],k=e[h],d=t[h];if(k===d){l[h]=k,(o?u<i:wT.call(e,h))&&c++;continue}if(k===null||d===null||typeof k!="object"||typeof d!="object"){l[h]=d;continue}let p=Df(k,d,r+1);l[h]=p,p===k&&c++;}return i===a&&c===i?e:l}function Lg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Of(e){if(!Bg(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Bg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Bg(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ng(e){return new Promise(t=>{Ec.setTimeout(t,e);})}function Hg(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 Df(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 Df(e,t)}return t}function $g(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function jg(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var yl=Symbol();function mu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===yl&&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===yl?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function qg(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 hu=(()=>{let e=()=>Eg;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Qg(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var CT=Ag;function ST(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=CT,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var To=ST();var wl,Ds,Cl,Kg,TT=(Kg=class extends Ps{constructor(){super();ue(this,wl,true);ue(this,Ds);ue(this,Cl);Y(this,Cl,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,Ds)||this.setEventListener(y(this,Cl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ds))==null||t.call(this),Y(this,Ds,void 0));}setEventListener(t){var r;Y(this,Cl,t),(r=y(this,Ds))==null||r.call(this),Y(this,Ds,t(this.setOnline.bind(this)));}setOnline(t){y(this,wl)!==t&&(Y(this,wl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,wl)}},wl=new WeakMap,Ds=new WeakMap,Cl=new WeakMap,Kg),Sl=new TT;function kT(e){return Math.min(1e3*2**e,3e4)}function Lf(e){return (e??"online")==="online"?Sl.isOnline():true}var gu=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function yu(e){let t=false,r=0,o,n=Qg(),i=()=>n.status!=="pending",s=T=>{if(!i()){let m=new gu(T);k(m),e.onCancel?.(m);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>fu.isFocused()&&(e.networkMode==="always"||Sl.isOnline())&&e.canRun(),u=()=>Lf(e.networkMode)&&e.canRun(),h=T=>{i()||(o?.(),n.resolve(T));},k=T=>{i()||(o?.(),n.reject(T));},d=()=>new Promise(T=>{o=m=>{(i()||c())&&T(m);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),p=()=>{if(i())return;let T,m=r===0?e.initialPromise:void 0;try{T=m??e.fn();}catch(w){T=Promise.reject(w);}Promise.resolve(T).then(h).catch(w=>{if(i())return;let R=e.retry??(hu.isServer()?0:3),v=e.retryDelay??kT,x=typeof v=="function"?v(r,w):v,F=R===true||typeof R=="number"&&r<R||typeof R=="function"&&R(r,w);if(t||!F){k(w);return}r++,e.onFail?.(r,w),Ng(x).then(()=>c()?void 0:d()).then(()=>{t?k(w):p();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?p():d().then(p),n)}}var ga,Gg,bu=(Gg=class{constructor(){ue(this,ga);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Mg(this.gcTime)&&Y(this,ga,Ec.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(hu.isServer()?1/0:300*1e3));}clearGcTimeout(){y(this,ga)!==void 0&&(Ec.clearTimeout(y(this,ga)),Y(this,ga,void 0));}},ga=new WeakMap,Gg);function Jg(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let u=false,h=p=>{qg(p,()=>t.signal,()=>u=true);},k=mu(t.options,t.fetchOptions),d=async(p,T,m)=>{if(u)return Promise.reject(t.signal.reason);if(T==null&&p.pages.length)return Promise.resolve(p);let R=(()=>{let f={client:t.client,queryKey:t.queryKey,pageParam:T,direction:m?"backward":"forward",meta:t.options.meta};return h(f),f})(),v=await k(R),{maxPages:x}=t.options,F=m?jg:$g;return {pages:F(p.pages,v,x),pageParams:F(p.pageParams,T,x)}};if(n&&i.length){let p=n==="backward",T=p?xT:Yg,m={pages:i,pageParams:s},w=T(o,m);a=await d(m,w,p);}else {let p=e??i.length;do{let T=l===0?s[0]??o.initialPageParam:Yg(o,a);if(l>0&&T==null)break;a=await d(a,T),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 Yg(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 xT(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Tl,ya,kl,Hn,ba,Vo,zc,wa,_n,ry,ji,ey,ty=(ey=class extends bu{constructor(t){super();ue(this,_n);ue(this,Tl);ue(this,ya);ue(this,kl);ue(this,Hn);ue(this,ba);ue(this,Vo);ue(this,zc);ue(this,wa);Y(this,wa,false),Y(this,zc,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,ba,t.client),Y(this,Hn,y(this,ba).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,ya,Xg(this.options)),this.state=t.state??y(this,ya),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return y(this,Tl)}get promise(){return y(this,Vo)?.promise}setOptions(t){if(this.options={...y(this,zc),...t},t?._type&&Y(this,Tl,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Xg(this.options);r.data!==void 0&&(this.setState(Zg(r.data,r.dataUpdatedAt)),Y(this,ya,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,Hn).remove(this);}setData(t,r){let o=Hg(this.state.data,t,this.options);return Mt(this,_n,ji).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){Mt(this,_n,ji).call(this,{type:"setState",state:t});}cancel(t){let r=y(this,Vo)?.promise;return y(this,Vo)?.cancel(t),r?r.then(pn).catch(pn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return y(this,ya)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Ug(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yl||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Wc(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:!zg(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),y(this,Vo)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),y(this,Vo)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,Hn).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,Vo)&&(y(this,wa)||Mt(this,_n,ry).call(this)?y(this,Vo).cancel({revert:true}):y(this,Vo).cancelRetry()),this.scheduleGc()),y(this,Hn).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Mt(this,_n,ji).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&y(this,Vo)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(y(this,Vo))return y(this,Vo).continueRetry(),y(this,Vo).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(u=>u.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:()=>(Y(this,wa,true),o.signal)});},i=()=>{let c=mu(this.options,r),h=(()=>{let k={client:y(this,ba),queryKey:this.queryKey,meta:this.meta};return n(k),k})();return Y(this,wa,false),this.options.persister?this.options.persister(c,h,this):c(h)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:y(this,ba),state:this.state,fetchFn:i};return n(c),c})();(y(this,Tl)==="infinite"?Jg(this.options.pages):this.options.behavior)?.onFetch(a,this),Y(this,kl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Mt(this,_n,ji).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),Y(this,Vo,yu({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof gu&&c.revert&&this.setState({...y(this,kl),fetchStatus:"idle"}),o.abort();},onFail:(c,u)=>{Mt(this,_n,ji).call(this,{type:"failed",failureCount:c,error:u});},onPause:()=>{Mt(this,_n,ji).call(this,{type:"pause"});},onContinue:()=>{Mt(this,_n,ji).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await y(this,Vo).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),y(this,Hn).config.onSuccess?.(c,this),y(this,Hn).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof gu){if(c.silent)return y(this,Vo).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw Mt(this,_n,ji).call(this,{type:"error",error:c}),y(this,Hn).config.onError?.(c,this),y(this,Hn).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Tl=new WeakMap,ya=new WeakMap,kl=new WeakMap,Hn=new WeakMap,ba=new WeakMap,Vo=new WeakMap,zc=new WeakMap,wa=new WeakMap,_n=new WeakSet,ry=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ji=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,..._T(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Zg(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,kl,t.manual?n:void 0),n;case "error":let i=t.error;return {...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),To.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),y(this,Hn).notify({query:this,type:"updated",action:t});});},ey);function _T(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lf(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Zg(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Xg(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 Uc,xi,qo,Ca,_i,Os,oy,ny=(oy=class extends bu{constructor(t){super();ue(this,_i);ue(this,Uc);ue(this,xi);ue(this,qo);ue(this,Ca);Y(this,Uc,t.client),this.mutationId=t.mutationId,Y(this,qo,t.mutationCache),Y(this,xi,[]),this.state=t.state||RT(),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,xi).includes(t)||(y(this,xi).push(t),this.clearGcTimeout(),y(this,qo).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){Y(this,xi,y(this,xi).filter(r=>r!==t)),this.scheduleGc(),y(this,qo).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){y(this,xi).length||(this.state.status==="pending"?this.scheduleGc():y(this,qo).remove(this));}continue(){return y(this,Ca)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Mt(this,_i,Os).call(this,{type:"continue"});},o={client:y(this,Uc),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,Ca,yu({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{Mt(this,_i,Os).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{Mt(this,_i,Os).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,qo).canRun(this)}));let n=this.state.status==="pending",i=!y(this,Ca).canStart();try{if(n)r();else {Mt(this,_i,Os).call(this,{type:"pending",variables:t,isPaused:i}),y(this,qo).config.onMutate&&await y(this,qo).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Mt(this,_i,Os).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await y(this,Ca).start();return await y(this,qo).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await y(this,qo).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),Mt(this,_i,Os).call(this,{type:"success",data:s}),s}catch(s){try{await y(this,qo).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await y(this,qo).config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Mt(this,_i,Os).call(this,{type:"error",error:s}),s}finally{y(this,qo).runNext(this);}}},Uc=new WeakMap,xi=new WeakMap,qo=new WeakMap,Ca=new WeakMap,_i=new WeakSet,Os=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),To.batch(()=>{y(this,xi).forEach(o=>{o.onMutationUpdate(t);}),y(this,qo).notify({mutation:this,type:"updated",action:t});});},oy);function RT(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var qi,ri,Nc,iy,sy=(iy=class extends Ps{constructor(t={}){super();ue(this,qi);ue(this,ri);ue(this,Nc);this.config=t,Y(this,qi,new Set),Y(this,ri,new Map),Y(this,Nc,0);}build(t,r,o){let n=new ny({client:t,mutationCache:this,mutationId:++ac(this,Nc)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){y(this,qi).add(t);let r=wu(t);if(typeof r=="string"){let o=y(this,ri).get(r);o?o.push(t):y(this,ri).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(y(this,qi).delete(t)){let r=wu(t);if(typeof r=="string"){let o=y(this,ri).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,ri).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=wu(t);if(typeof r=="string"){let n=y(this,ri).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=wu(t);return typeof r=="string"?y(this,ri).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){To.batch(()=>{y(this,qi).forEach(t=>{this.notify({type:"removed",mutation:t});}),y(this,qi).clear(),y(this,ri).clear();});}getAll(){return Array.from(y(this,qi))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Af(r,o))}findAll(t={}){return this.getAll().filter(r=>Af(t,r))}notify(t){To.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return To.batch(()=>Promise.all(t.map(r=>r.continue().catch(pn))))}},qi=new WeakMap,ri=new WeakMap,Nc=new WeakMap,iy);function wu(e){return e.options.scope?.id}var Ri,ay,ly=(ay=class extends Ps{constructor(t={}){super();ue(this,Ri);this.config=t,Y(this,Ri,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??Mc(n,r),s=this.get(i);return s||(s=new ty({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){y(this,Ri).has(t.queryHash)||(y(this,Ri).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=y(this,Ri).get(t.queryHash);r&&(t.destroy(),r===t&&y(this,Ri).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){To.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return y(this,Ri).get(t)}getAll(){return [...y(this,Ri).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Vf(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Vf(t,o)):r}notify(t){To.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){To.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){To.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Ri=new WeakMap,ay);var so,Vs,As,xl,_l,Ls,Rl,vl,cy,Bf=(cy=class{constructor(e={}){ue(this,so);ue(this,Vs);ue(this,As);ue(this,xl);ue(this,_l);ue(this,Ls);ue(this,Rl);ue(this,vl);Y(this,so,e.queryCache||new ly),Y(this,Vs,e.mutationCache||new sy),Y(this,As,e.defaultOptions||{}),Y(this,xl,new Map),Y(this,_l,new Map),Y(this,Ls,0);}mount(){ac(this,Ls)._++,y(this,Ls)===1&&(Y(this,Rl,fu.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,so).onFocus());})),Y(this,vl,Sl.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,so).onOnline());})));}unmount(){var e,t;ac(this,Ls)._--,y(this,Ls)===0&&((e=y(this,Rl))==null||e.call(this),Y(this,Rl,void 0),(t=y(this,vl))==null||t.call(this),Y(this,vl,void 0));}isFetching(e){return y(this,so).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Vs).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,so).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=y(this,so).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Wc(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return y(this,so).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=y(this,so).get(o.queryHash)?.state.data,s=Wg(t,i);if(s!==void 0)return y(this,so).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return To.batch(()=>y(this,so).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,so).get(t.queryHash)?.state}removeQueries(e){let t=y(this,so);To.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=y(this,so);return To.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=To.batch(()=>y(this,so).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(pn).catch(pn)}invalidateQueries(e,t={}){return To.batch(()=>(y(this,so).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=To.batch(()=>y(this,so).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(pn)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(pn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=y(this,so).build(this,t);return r.isStaleByTime(Wc(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(pn).catch(pn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(pn).catch(pn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Sl.isOnline()?y(this,Vs).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,so)}getMutationCache(){return y(this,Vs)}getDefaultOptions(){return y(this,As)}setDefaultOptions(e){Y(this,As,e);}setQueryDefaults(e,t){y(this,xl).set(gl(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...y(this,xl).values()],r={};return t.forEach(o=>{bl(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){y(this,_l).set(gl(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...y(this,_l).values()],r={};return t.forEach(o=>{bl(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...y(this,As).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Mc(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===yl&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...y(this,As).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){y(this,so).clear(),y(this,Vs).clear();}},so=new WeakMap,Vs=new WeakMap,As=new WeakMap,xl=new WeakMap,_l=new WeakMap,Ls=new WeakMap,Rl=new WeakMap,vl=new WeakMap,cy);var dy=ta__namespace.createContext(void 0);var Ef=({client:e,children:t})=>(ta__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(dy.Provider,{value:e,children:t}));var Pl=new Map;function uy({width:e,height:t,borderRadius:r,color:o}){let n=ta.useRef(new reactNative.Animated.Value(.3)).current;return ta.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function en({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=z(),[c,u]=ta.useState(false),[h,k]=ta.useState(false),[d,p]=ta.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let F=Pl.get(e);return F?{uri:e,xml:F}:null}),T=e?.toLowerCase().endsWith(".svg"),m=T&&e&&d?.uri===e?d.xml:null;ta.useEffect(()=>{u(false),k(false);},[e]),ta.useEffect(()=>{if(!T||!e)return;if(Pl.has(e)){p({uri:e,xml:Pl.get(e)});return}let F=false;return fetch(e).then(f=>{if(!f.ok)throw new Error(`HTTP ${f.status}`);return f.text()}).then(f=>{F||(Pl.set(e,f),p({uri:e,xml:f}));}).catch(()=>{F||u(true);}),()=>{F=true;}},[e,T]);let w=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:w},a]});let R={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},v=t-n*2,x=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[R,{backgroundColor:s||w}]}):T?jsxRuntime.jsxs(reactNative.View,{style:R,children:[!!!m&&jsxRuntime.jsx(uy,{width:v,height:x,borderRadius:o,color:w}),m?jsxRuntime.jsx(Ir.SvgXml,{xml:m,width:v,height:x,onError:()=>u(true)}):jsxRuntime.jsx(Ir.SvgUri,{uri:e,width:v,height:x,onError:()=>u(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:R,children:[!h&&jsxRuntime.jsx(uy,{width:v,height:x,borderRadius:o,color:w}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:v,height:x},resizeMode:"contain",onLoad:()=>k(true),onError:()=>u(true)})]})}function $c(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Pl.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Pl.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function fo({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:u,balanceTokenAddress:h,publishableKey:k,projectName:d,leftIcon:p,onLeftAction:T}){let{colors:m,fonts:w,components:R}=z(),[v,x]=ta.useState(null),[F,f]=ta.useState(false),g=ta.useState(()=>new reactNative.Animated.Value(0))[0];ta.useEffect(()=>{if(!F)return;let C=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(g,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(g,{toValue:0,duration:700,useNativeDriver:true})]));return C.start(),()=>C.stop()},[F,g]),ta.useEffect(()=>{if(!a||!l||!c||!u||!h||!k){x(null),f(false);return}let C=false;return f(true),Wd(l,c,u,h,k).then(O=>{if(C)return;let V=O.balance,P=null;V&&(V.amount_usd!=null&&V.amount_usd!==""?P=`$${V.amount_usd}`:P="$0.00"),x(P);}).catch(()=>{C||x(null);}).finally(()=>{C||f(false);}),()=>{C=true;}},[a,l,c,u,h,k]);let b=g.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Qo.header,children:[jsxRuntime.jsx(reactNative.View,{style:Qo.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(cc,{size:20,color:R.header.buttonColor,strokeWidth:2})}):p&&T?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:T,style:[Qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:p}):jsxRuntime.jsx(reactNative.View,{style:Qo.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Qo.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Qo.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qo.title,{color:R.header.titleColor,fontFamily:w.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Qo.titleBadge,{backgroundColor:m.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Qo.titleBadgeText,{color:m.foregroundMuted,fontFamily:w.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[Qo.balanceText,{color:m.foregroundMuted,fontFamily:w.regular}],children:t}):null,a&&(F?jsxRuntime.jsx(reactNative.Animated.View,{style:[Qo.balanceSkeleton,{backgroundColor:m.cardHover,opacity:b}]}):v!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Qo.balanceText,{color:m.foregroundMuted,fontFamily:w.regular}],children:[d?`${d} `:"","Balance: ",v]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Qo.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[Qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:R.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Qo.spacer})})]})}var Qo=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:15,width:120,borderRadius:5,marginTop:5},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Qr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=z(),a=i??s.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},u=[hy.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],h=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:u,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[hy.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 hy=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function jc({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(Qr,{cardTokens:s,onPress:e,style:vi.wrapper,contentStyle:vi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:vi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[vi.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Mp,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:vi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[vi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[vi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:vi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:vi.networkIcons,children:a.map((l,c)=>{let u=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[vi.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(en,{uri:ge(u),width:20,height:20})},l.name)})})})]})}var vi=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 Qc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsxs(Qr,{cardTokens:s,onPress:e,style:Qi.wrapper,contentStyle:Qi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qi.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qa,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Qi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Qi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Qi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Qi.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(en,{uri:ge(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var Qi=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 Kc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsx(Qr,{cardTokens:s,onPress:e,style:Ki.wrapper,contentStyle:Ki.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ki.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ki.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx(jo,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Ki.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ki.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ki.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ki.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ki.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Ki=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 Yc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=z(),i=n.depositMenu.card;return jsxRuntime.jsx(Qr,{cardTokens:i,onPress:e,style:Ta.wrapper,contentStyle:Ta.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ta.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ta.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(yh,{size:36})}),jsxRuntime.jsxs(reactNative.View,{style:Ta.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ta.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ta.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Ta=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"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var NT="#00D632";function Jc({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=z(),i=n.depositMenu.card,[s,a]=ta.useState(false),l=kr("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Qr,{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:s?jsxRuntime.jsx(reactNative.View,{style:[Ii.cashAppIconFallback,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Ii.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Ii.cashAppIcon,{borderRadius:i.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Ii.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ii.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ii.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}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",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:NT,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 Zc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsxs(Qr,{cardTokens:s,onPress:e,style:Pi.wrapper,contentStyle:Pi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Pi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Pi.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(hh,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Pi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:Pi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Pi.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(u=>u.format==="png")?.url||a.icon_urls.find(u=>u.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Pi.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(en,{uri:ge(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Pi=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"}});function QT({size:e,color:t}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsx(Ir.Path,{fill:t,d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Xc({onPress:e,title:t="Pay with Apple Pay",subtitle:r="Instant"}){let{colors:o,fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsx(Qr,{cardTokens:s,onPress:e,style:xa.wrapper,contentStyle:xa.container,children:jsxRuntime.jsxs(reactNative.View,{style:xa.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[xa.iconContainer,{borderRadius:s.iconContainerBorderRadius,backgroundColor:"#000"}],children:jsxRuntime.jsx(QT,{size:20,color:"#fff"})}),jsxRuntime.jsxs(reactNative.View,{style:xa.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xa.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[xa.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var xa=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"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var Ra="#00D632",Iy=5,YT=[25,50,100,500],Al=120,JT=5e3,ZT=2e3,XT=300;function ed(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function Py(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function ek(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 Fy(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function tk(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function Dy(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function rk(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 ok(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function _u({size:e,faded:t=false,withBackground:r=false}){let[o,n]=ta.useState(false),i=kr("/icons/onramps/png/cashapp.png"),s=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:s,backgroundColor:Ra,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:i,cache:"force-cache"},style:{width:e,height:e,borderRadius:s},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Ra}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Ru({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:i="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:s,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:u,components:h}=z();ta.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[k,d]=ta.useState("amountInput"),[p,T]=ta.useState("25"),[m,w]=ta.useState(null),[R,v]=ta.useState(null),[x,F]=ta.useState(true),[f,g]=ta.useState(null),[b,C]=ta.useState(false),[O,V]=ta.useState(null),[P,B]=ta.useState(Al),[W,j]=ta.useState(null),[Z,Oe]=ta.useState(false),[G,ot]=ta.useState("pending"),te=ta.useRef(null),de=ta.useRef(null),ae=ta.useRef(null),re=ta.useRef("pending"),xe=ta.useRef(null),$=ta.useRef("amountInput"),Re=ta.useRef(Al),dt=ta.useRef(null),Xe=ta.useRef(null),Se=ta.useRef(false),Ke=ta.useRef(true),nt=R?.minimum_amount??Iy,Ge=R?.maximum_amount,pt=parseFloat(p)||0,st=!isNaN(pt)&&pt>=nt&&(Ge==null||pt<=Ge),Ne=Ge?`$${ed(nt)} \u2013 $${ed(Ge)}`:`$${ed(nt)} minimum`,ye=k==="amountInput"?"Pay with Cash App":`Pay $${Py(p)} via Cash App`,be=k==="amountInput"||k==="waitingForPayment";ta.useEffect(()=>(Ke.current=true,F(true),Gp("usd",t).then(S=>{Ke.current&&v(S);}).catch(()=>{}).finally(()=>{Ke.current&&F(false);}),()=>{Ke.current=false,ft();}),[t]);function He(S,M=R){if(V(null),!S){w(null);return}let q=parseFloat(S);if(isNaN(q)){w("Enter a valid number");return}let J=M?.minimum_amount??Iy,K=M?.maximum_amount;q<J?w(`$${ed(J)} minimum`):K!=null&&q>K?w(`$${ed(K)} maximum`):w(null);}function ft(){te.current&&clearInterval(te.current),de.current&&clearInterval(de.current),ae.current&&clearInterval(ae.current),te.current=null,de.current=null,ae.current=null;}function yt(){ft(),g(null),xe.current=null,j(null),Oe(false),V(null),re.current="pending",ot("pending"),B(Al),Re.current=Al,dt.current=null,Se.current=false,d("amountInput"),$.current="amountInput";}async function xt(){if(!(!st||b)){C(true),V(null),ft(),dt.current=null;try{let S=await Kp({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:i,recipient_address:r,source_amount:p},t);xe.current=S,re.current=S.status,g(S),C(!1),d("waitingForPayment"),$.current="waitingForPayment",lr(),$e(),reactNative.Linking.openURL(S.url).catch(()=>{});}catch(S){C(false),V(S instanceof Error?S.message:"Failed to create session");}}}function lr(){Re.current=Al,B(Al),ae.current&&clearInterval(ae.current),ae.current=setInterval(()=>{Re.current-=1,B(Re.current),Re.current<=0&&(clearInterval(ae.current),ae.current=null,re.current==="pending"&&(d("softExpired"),$.current="softExpired"));},1e3);}function $e(){te.current&&clearInterval(te.current),te.current=setInterval(()=>{fe();},JT);}async function fe(){if(!Ke.current)return;let S=xe.current;if(!S)return;let M=S.external_id??S.id;try{let q=await Yp(M,t),J=re.current;switch(re.current=q.status,ot(q.status),q.status){case "processing":($.current==="amountInput"||$.current==="softExpired"||$.current==="waitingForPayment")&&(d("paymentReceived"),$.current="paymentReceived",ae.current&&(clearInterval(ae.current),ae.current=null));break;case "completed":te.current&&(clearInterval(te.current),te.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),J!=="completed"&&(d("paymentReceived"),$.current="paymentReceived",Je());break;case "failed":te.current&&(clearInterval(te.current),te.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),$.current!=="amountInput"&&(d("failed"),$.current="failed");break;case "expired":te.current&&(clearInterval(te.current),te.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),$.current!=="amountInput"&&(d("softExpired"),$.current="softExpired");break;default:break}}catch{}}let Ye=6e5;function Je(){de.current&&clearInterval(de.current);let S=Date.now()+Ye;de.current=setInterval(()=>{if(Date.now()>S){clearInterval(de.current),de.current=null;let M=re.current;M==="completed"||M==="processing"?(d("paymentReceived"),$.current="paymentReceived"):(d("failed"),$.current="failed");return}Ee();},ZT);}async function Ee(){if(Ke.current)try{let S=await sn(e,t,"deposit"),M=Date.now(),q=[...S.data].sort((ve,Ve)=>{let L=ve.created_at?new Date(ve.created_at).getTime():0;return (Ve.created_at?new Date(Ve.created_at).getTime():0)-L}),J=dt.current,K=J?q.find(ve=>ve.id===J):q.find(ve=>{if(!ve.created_at)return !1;let Ve=new Date(ve.created_at).getTime();return M-Ve<XT*1e3});K&&(dt.current||(dt.current=K.id),K.status==="succeeded"?(de.current&&(clearInterval(de.current),de.current=null),j(K),d("depositComplete"),$.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:K.id,transaction:K})):(K.status==="failed"||K.status==="refunded")&&(de.current&&(clearInterval(de.current),de.current=null),j(K),d("failed"),$.current="failed"));}catch{}}function me(){if(k==="waitingForPayment"){ae.current&&(clearInterval(ae.current),ae.current=null),d("amountInput"),$.current="amountInput";return}s();}function je(){ft(),a();}function vt(){let S=xe.current??f;S&&reactNative.Linking.openURL(S.url).catch(()=>{});}function Bt(S){let M=S.destination_amount_base_unit;if(!M)return "\u2014";let q=S.destination_token_metadata?.decimals??6;return ek(M,q)}function Nt(S){return tk(S.destination_currency)}function ct(S){let M=S.destination_token_metadata;return M?M.icon_urls&&M.icon_urls.length>0?di(M.icon_urls,"png")??M.icon_url??null:M.icon_url??null:null}function er(){return jsxRuntime.jsxs(reactNative.View,{style:ie.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.poweredByText,{color:c.foregroundMuted,fontFamily:u.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.poweredByBold,{color:c.foreground,fontFamily:u.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.poweredByBold,{color:c.foreground,fontFamily:u.semibold}],children:"nifold"})]})}function tt(S,M){return jsxRuntime.jsxs(reactNative.View,{style:ie.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.detailLabel,{color:c.foregroundMuted,fontFamily:u.regular}],children:S}),jsxRuntime.jsx(reactNative.Text,{style:[ie.detailValue,{color:c.foreground,fontFamily:u.medium}],children:M})]},S)}function Ct(S,M,q){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ie.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(q).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.txLabel,{color:c.foreground,fontFamily:u.medium}],children:S}),jsxRuntime.jsxs(reactNative.View,{style:ie.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.txHash,{color:c.foregroundMuted}],children:M}),jsxRuntime.jsx(reactNative.Text,{style:[ie.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},S)}function bt(){let S=Math.max(60-p.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:ie.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:ie.flex,contentContainerStyle:ie.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{Se.current||(Se.current=true,setTimeout(()=>Xe.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:ie.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.amountDollar,{color:c.foreground,fontSize:S}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Xe,value:p,onChangeText:M=>{T(M),He(M);},keyboardType:"decimal-pad",style:[ie.amountInput,{color:c.foreground,fontSize:S}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),m?jsxRuntime.jsx(reactNative.Text,{style:[ie.amountError,{color:c.warning,fontFamily:u.regular}],children:m}):x?jsxRuntime.jsx(reactNative.View,{style:[ie.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[ie.limitsSubtitle,{color:c.foregroundMuted,fontFamily:u.regular}],children:Ne})]}),jsxRuntime.jsx(reactNative.View,{style:ie.quickAmountsRow,children:YT.map(M=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let q=String(M);T(q),He(q);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[ie.quickAmountText,{color:c.foreground,fontFamily:u.medium}],children:["$",M]})},M))}),O&&jsxRuntime.jsxs(reactNative.View,{style:[ie.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:ie.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.errorBannerText,{color:c.foreground,fontFamily:u.regular}],children:O})]})]}),jsxRuntime.jsx(reactNative.View,{style:ie.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:Ra,borderRadius:h.button.borderRadius,opacity:!st||b?.4:1}],onPress:xt,disabled:!st||b,activeOpacity:.8,children:[b&&jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:"#fff",gradientTo:"#fff",style:ie.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:u.medium}],children:b?"Loading...":"Continue"})]})})]})}function Ae(){return jsxRuntime.jsxs(reactNative.View,{style:ie.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.centeredContent,children:[jsxRuntime.jsx(_u,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateTitle,{color:c.foreground,fontFamily:u.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateDescription,{color:c.foregroundMuted,fontFamily:u.regular}],children:`Complete the payment in Cash App.
|
|
3
|
+
This page will update automatically.`}),P>0&&jsxRuntime.jsxs(reactNative.Text,{style:[ie.expiryText,{color:P<=30?c.warning:c.foregroundMuted,fontFamily:u.medium}],children:["Expires in ",ok(P)]})]}),jsxRuntime.jsx(reactNative.View,{style:ie.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:Ra,borderRadius:h.button.borderRadius}],onPress:vt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:ie.cashAppButtonIcon,children:jsxRuntime.jsx(_u,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:u.semibold}],children:"Open Cash App"})]})})]})}function at(){let S=G==="processing",M=S?"Payment processing":"Payment received",q=S?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:ie.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:ie.centeredContent,children:[jsxRuntime.jsx(Te,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(_u,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateTitle,{color:c.foreground,fontFamily:u.semibold}],children:M}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateDescription,{color:c.foregroundMuted,fontFamily:u.regular}],children:q})]})})}function X(){if(!W)return at();let S=W,M=["pending","waiting","delayed"].includes(S.status),q=ct(S),J=rk(S.created_at);return jsxRuntime.jsxs(reactNative.View,{style:ie.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:ie.flex,contentContainerStyle:ie.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:q?jsxRuntime.jsx(reactNative.Image,{source:{uri:q,cache:"force-cache"},style:ie.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[ie.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[ie.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[ie.statusBadge,{backgroundColor:M?c.warning:c.success}],children:jsxRuntime.jsx(reactNative.Text,{style:ie.statusBadgeText,children:M?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.statusDot,{backgroundColor:M?c.warning:c.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ie.statusText,{color:c.foreground,fontFamily:u.semibold}],children:M?"In Progress":"Completed"})]}),J?jsxRuntime.jsx(reactNative.Text,{style:[ie.dateText,{color:c.foregroundMuted,fontFamily:u.regular}],children:J}):null,jsxRuntime.jsxs(reactNative.View,{style:[ie.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[tt("Amount Sent",`$${Py(p)} USD`),tt("Amount Received",`${Bt(S)} ${Nt(S)}`),S.source_amount_usd?tt("USD Value",`$${parseFloat(S.source_amount_usd).toFixed(2)}`):null,S.source_chain_id?tt("Source Network",Fy(S.source_chain_type??"",S.source_chain_id)):null,S.destination_chain_id?tt("Destination Network",Fy(S.destination_chain_type??"",S.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ie.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),Oe(K=>!K);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ie.seeMoreText,{color:c.foreground,fontFamily:u.medium}],children:Z?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.seeMoreChevron,{color:c.foregroundMuted}],children:Z?"\u25B2":"\u25BC"})]}),Z&&jsxRuntime.jsxs(reactNative.View,{style:ie.txHashSection,children:[S.explorer_url?Ct("Deposit Tx",Dy(S.transaction_hash),S.explorer_url):null,!M&&S.destination_explorer_url&&S.destination_transaction_hashes?.[0]?Ct("Completion Tx",Dy(S.destination_transaction_hashes[0]),S.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:ie.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:Ra,borderRadius:h.button.borderRadius}],onPress:je,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:u.medium}],children:"Done"})})})]})}function Fe(){return jsxRuntime.jsxs(reactNative.View,{style:ie.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.centeredContent,children:[jsxRuntime.jsx(_u,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateTitle,{color:c.foreground,fontFamily:u.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[ie.stateDescription,{color:c.foregroundMuted,fontFamily:u.regular}],children:["Your session has expired.",`
|
|
4
|
+
`,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:ie.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:Ra,borderRadius:h.button.borderRadius}],onPress:yt,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:u.semibold}],children:"New Cash App session"})})})]})}function _(){return jsxRuntime.jsxs(reactNative.View,{style:ie.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:ie.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ie.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[ie.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateTitle,{color:c.foreground,fontFamily:u.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[ie.stateDescription,{color:c.foregroundMuted,fontFamily:u.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:ie.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie.continueButton,{backgroundColor:Ra,borderRadius:h.button.borderRadius}],onPress:yt,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ie.continueButtonText,{color:"#fff",fontFamily:u.semibold}],children:"Try Again"})}),er()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[ie.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(fo,{title:ye,showBack:be,onBack:me,onClose:je}),k==="amountInput"&&bt(),k==="waitingForPayment"&&Ae(),k==="paymentReceived"&&at(),k==="depositComplete"&&X(),k==="softExpired"&&Fe(),k==="failed"&&_()]})}var ie=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 nk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function ik(e){let t=new Array(e),r=globalThis;if(r.crypto&&typeof r.crypto.getRandomValues=="function"){let o=new Uint8Array(e);r.crypto.getRandomValues(o);for(let n=0;n<e;n++)t[n]=o[n];return t}for(let o=0;o<e;o++)t[o]=Math.floor(Math.random()*256);return t}function Ay(e){let t=Math.floor(Date.now()/1e3)-14e8,r=new Array(20).fill(0);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255;let o=ik(16);for(let a=0;a<16;a++)r[4+a]=o[a];let n=[],i=[...r];for(;i.some(a=>a!==0);){let a=0;for(let l=0;l<i.length;l++){let c=a<<8|i[l];i[l]=Math.floor(c/62),a=c%62;}n.push(nk[a]);}let s=n.reverse().join("");return s.length<27&&(s="0".repeat(27-s.length)+s),`${e}_${s}`}var sk="unifold:apple-pay:session",ak=1320*60*60*1e3,lk=6e4;function em(e){return `${sk}:${encodeURIComponent(e)}`}function ck(e){let t=Date.parse(e);return Number.isNaN(t)?null:t}var Us={async get(e){try{let t=await Tf__default.default.getItem(em(e));if(!t)return null;let r=JSON.parse(t);return !r.email||!r.phone||!r.termsAcceptedAt?null:r}catch{return null}},async set(e,t){try{await Tf__default.default.setItem(em(e),JSON.stringify(t));}catch{}},async clear(e){try{await Tf__default.default.removeItem(em(e));}catch{}},isPhoneVerificationFresh(e){let t=e?.phoneVerifiedAt;if(!t)return false;let r=ck(t);return r===null?false:Date.now()-r<ak},isOnrampTokenFresh(e){if(!e)return false;let t=e.onrampToken,r=e.onrampTokenExpiresAtMs;return !t||r==null?false:r-Date.now()>lk}};var yk=5,bk=500,wk=[25,100,250,500],vu=6,Ck=30,Sk=800,Hy=52,Tk=6e3,kk=3e3,xk=6e5,_k=2500,Rk=12e4,Ly=3,By=600,vk=1500,Ik=3e4,Ey=3,Pk=600,Iu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Fk=["ethereum","solana","bitcoin","algorand","xrpl","cardano","n1"],Dk=[{key:"guest_checkout_terms",name:"Coinbase Guest Checkout Terms of Service",url:"https://www.coinbase.com/legal/guest-checkout/us"},{key:"user_agreement",name:"Coinbase User Agreement",url:"https://www.coinbase.com/legal/user_agreement"},{key:"privacy_policy",name:"Coinbase Privacy Policy",url:"https://www.coinbase.com/legal/privacy"}],Ok="unrequested",Vk="pending",rm="resubmit",Wy="active",Ak="inactive",se={title:"Pay with Apple Pay",disabledTitle:"Apple Pay is unavailable",disabledDescription:"Apple Pay is disabled for this project. Try another payment method.",emailLabel:"Email",emailPlaceholder:"you@example.com",continueButton:"Continue",phoneLabel:"US phone number",phonePlaceholder:"555 123 4567",phoneInvalid:"Enter a valid US mobile number (no VoIP).",sendCode:"Send code",phoneHeaderTitle:"Verify your phone",emailOtpHeaderTitle:"Verify your email",otpPlaceholder:"000000",incorrectCode:"Incorrect code. Please try again.",verify:"Verify",resendCode:"Resend code",amountHeaderTitle:"Deposit with Apple Pay",enterAmount:"Enter an amount",preparingApplePay:"Loading",continuePay:"Continue",popupBlocked:"Couldn't open the Apple Pay window. Please try again.",applePayButtonUnavailable:"Apple Pay isn't available right now. Please try again or use another payment method.",checkingHeaderTitle:"Checking deposit",checkingTitle:"Checking for your deposit\u2026",checkingDescription:"Return if the payment is not made.",checkingTimeoutTitle:"Still processing",checkingTimeoutDescription:"This is taking longer than expected. Your deposit may still complete \u2014 check your balance shortly.",paymentErrorTitle:"Payment failed",paymentErrorFallback:"We couldn't complete your payment. Please try again or use a different payment method.",tryAgain:"Try again",guestLimitHeaderTitle:"Limit reached",guestLimitTitle:"Apple Pay limit reached",guestLimitDescription:"Your account is not eligible for a limit increase at this time.",returnButton:"Return",upgradeHeaderTitle:"Verify identity",upgradeIntroDescription:"Submit your date of birth and SSN to increase your Apple Pay limit.",cancelButton:"Cancel",dobLabel:"Date of birth",dobPlaceholder:"MM/DD/YYYY",ssnLabel:"Last 4 of SSN",ssnPlaceholder:"\u2022\u2022\u2022\u2022",submitButton:"Submit",verifyingTitle:"Verifying your information",verifyingDescription:"Your limit increase request is under review. This usually takes just a few seconds.",upgradeVerifyFailed:"We couldn't verify your information. Please check your SSN and date of birth and try again.",upgradeFailedTitle:"Apple Pay limit reached",upgradeFailedPrefix:"Failed to increase. Please try again later or ",contactSupport:"contact support",upgradeFailedSuffix:".",supportUrl:"https://unifold.io/support",destinationNotConfigured:"Deposit destination not configured. Please contact support.",networkUnsupported:"Coinbase Apple Pay is not available for this network.",depositWalletUnavailable:"Deposit wallet unavailable. Please try again.",rateLimited:"Too many attempts. Please wait a few minutes and try again.",networkError:"Network error. Check your connection and try again.",voipError:"We can only verify real US cell phones (not VoIP). Try a different number.",disclaimerPrefix:"By continuing, you agree to Coinbase's ",disclaimerSuffix:". Coinbase is the regulated provider of this fiat-to-crypto onramp.",amountSent:"Amount Sent",amountReceived:"Amount Received",usdValue:"USD Value",destinationNetwork:"Destination Network",inProgress:"In Progress",completed:"Completed",failed:"Failed",depositFailedDescription:"Your payment went through but the deposit didn't complete. Any charge will be refunded.",seeLess:"See less",seeMoreDetails:"See more details",depositTx:"Deposit Tx",completionTx:"Completion Tx",done:"Done",sentTo:e=>`Sent to ${e}`,resendIn:e=>`Resend in ${e}s`,minimumAmount:e=>`Minimum amount is ${e}`,maximumAmount:e=>`Maximum amount is ${e}`};function Fu(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function om(e){let t=e.replace(/\D/g,"");return t.length===11&&t.startsWith("1")?t.slice(1):t.slice(0,10)}function Lk(e){let t=e.indexOf("@");if(t<=0)return e;let r=e.slice(0,t),o=e.slice(t+1),n=r.slice(0,2),i="*".repeat(Math.max(r.length-n.length,1));return `${n}${i}@${o}`}function Bk(e){return /^\+1\d{10}$/.test(e)?`+1 (***) ***-${e.slice(-4)}`:e}function My(e){return e===Math.round(e)?`$${Math.round(e)}`:`$${e.toFixed(2)}`}function Ek(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function zy(e){return !e||e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Wk(e,t){return e==="n1"?"N1":e==="cardano"?"Cardano":e==="algorand"?"Algorand":e==="xrpl"?"XRPL":{1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function Mk(e,t){switch(e){case "solana":return "solana";case "bitcoin":return "bitcoin";case "ethereum":switch(t){case "1":return "ethereum";case "8453":return "base";case "137":return "polygon";case "43114":return "avalanche";case "42161":return "arbitrum";case "10":return "optimism";default:return null}default:return null}}function zk(e){let t=Fu(e);if(t===null)return "";try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Uk(e){let t=e.destination_amount_base_unit;if(!t)return "\u2014";let r=e.destination_token_metadata?.decimals??6,o=parseFloat(t)/Math.pow(10,r);return o===0?"0.00":o>=1?o.toFixed(2):o.toFixed(6)}function Nk(e){let t=e.destination_currency??"",r=t.indexOf(".");return r!==-1?t.slice(0,r).toUpperCase()+t.slice(r):t.toUpperCase()}function Hk(e){return !!(/coinbase_onramp_guest_limit_reached/i.test(e)||/guest_(daily_)?transaction_(count|limit)/i.test(e))}function $k(e){let t=e instanceof gc?e.status:void 0,r=e instanceof Error?e.message:String(e),o=t?`${r} ${t}`:r;return /(token|jwt)[^\n]*(expired|invalid|401|unauthorized)|(expired|invalid|401|unauthorized)[^\n]*(token|jwt)/i.test(o)}function jk(e){return !!(/coinbase_onramp_guest_limit_reached/i.test(e)||/limit upgrade is not available/i.test(e)||/limits.?upgrade.?blocked/i.test(e))}function Bl(e){let t=e instanceof Error?e.message:String(e);if(/\b429\b|too many requests|rate.?limit|throttle/i.test(t))return se.rateLimited;if(/network|failed to fetch|abort/i.test(t))return se.networkError;if(/voip|not a valid US|not a cell/i.test(t))return se.voipError;let r=t.replace(/\s*\[[\w_]+\]:?.*$/,"").trim();return r.length?r:t}function qk(e){let t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`}function Uy(e){if(!/^\d{2}\/\d{2}\/\d{4}$/.test(e))return null;let[t,r,o]=e.split("/");return !/^(0[1-9]|1[0-2])$/.test(t)||!/^(0[1-9]|[12]\d|3[01])$/.test(r)||!/^(19|20)\d{2}$/.test(o)?null:{day:r,month:t,year:o}}function Qk(){return new Date().toISOString()}function od(e){return new Promise(t=>setTimeout(t,e))}function Kk(e){if(sa().includes("api.unifold.io")||e.includes("useApplePaySandbox"))return e;let r=e.includes("?")?"&":"?";return `${e}${r}useApplePaySandbox=true`}function zo(e){let t=ta.useRef(e);return t.current=e,t}function Gk({size:e,color:t}){return jsxRuntime.jsx(Ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsx(Ir.Path,{fill:t,d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Yk(e,t){let r=Math.round(e);return `
|
|
5
5
|
(function() {
|
|
6
6
|
function send(obj) {
|
|
7
7
|
try { window.ReactNativeWebView.postMessage(JSON.stringify(obj)); } catch (e) {}
|
|
@@ -99,7 +99,7 @@ This page will update automatically.`}),F>0&&jsxRuntime.jsxs(reactNative.Text,{s
|
|
|
99
99
|
var iv = setInterval(function() { tick(); if (++n > 60) clearInterval(iv); }, 200);
|
|
100
100
|
})();
|
|
101
101
|
true;
|
|
102
|
-
`}function
|
|
102
|
+
`}function Jk(){return `
|
|
103
103
|
(function() {
|
|
104
104
|
function report(ok) {
|
|
105
105
|
try {
|
|
@@ -121,5 +121,5 @@ This page will update automatically.`}),F>0&&jsxRuntime.jsxs(reactNative.Text,{s
|
|
|
121
121
|
check();
|
|
122
122
|
})();
|
|
123
123
|
true;
|
|
124
|
-
`}function Du({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,enabled:a=true,user:l,prefilledEmail:c,preloadedWallets:p,onBack:g,onClose:k,onDepositSuccess:d,onDepositError:f,onExecutionsChange:S}){let{colors:h,fonts:w,components:v}=z(),I=v.input.borderRadius,x=v.input.borderWidth,P=v.button.borderRadius,m=v.card.borderRadius,u=l?.email?.trim(),T=u&&Iu.test(u)?u:null,b=`${t}:${e}`,A=_k,[O,F]=ta.useState("loading"),[B,W]=ta.useState(""),[N,Z]=ta.useState(""),[je,Y]=ta.useState(false),[rt,oe]=ta.useState([]),[ce,ae]=ta.useState(null),[te,ke]=ta.useState(null),[j,Ie]=ta.useState(""),[pt,Ge]=ta.useState(""),[Se,qe]=ta.useState(null),[ot,Ye]=ta.useState(false),[dt,st]=ta.useState(0),[Me,be]=ta.useState(""),[we,ze]=ta.useState(""),[ut,ht]=ta.useState(null),[xt,lr]=ta.useState(null),[Ue,me]=ta.useState(null),[Je,Qe]=ta.useState(null),[Ve,he]=ta.useState(false),[Ne,vt]=ta.useState(p??[]),[Vt,Ht]=ta.useState(null),[lt,er]=ta.useState(false),[Xe,yt]=ta.useState(false),[gt,De]=ta.useState(false),[at,X]=ta.useState(null),[Pe,_]=ta.useState(null),[C,M]=ta.useState(false),[q,J]=ta.useState(""),[K,_e]=ta.useState(""),[et,L]=ta.useState(null),[U,kt]=ta.useState(false),Le=N.length===10?`+1${N}`:"",Fe=Iu.test(B),bt=/^\+1\d{10}$/.test(Le),nt=ut??vk,ee=ta.useRef(true),vr=zo(O),ft=zo(we),tr=zo(B),Mt=zo(xt),qr=zo(Ue),Mr=zo(Je),li=zo(Ne),on=zo(Vt),yo=zo(Xe),Bo=zo(Pe),nn=zo(at),ko=zo(lt),na=zo(Ve),bo=zo(Le),Lt=zo(Fe),Qr=zo(bt),ne=zo(U),ue=ta.useRef(null),zt=ta.useRef(null),ur=ta.useRef(null),Go=ta.useRef(null),sn=ta.useRef(null),D=ta.useRef(null),$=ta.useRef(null),Te=ta.useRef(null),Ae=ta.useRef(null),He=ta.useRef(null),Ze=ta.useRef(null),Rt=ta.useRef(null),Tr=ta.useRef(null),Bt=ta.useRef(null),Kr=ta.useRef(null);ta.useEffect(()=>(ee.current=true,wn(),()=>{ee.current=false,wo();}),[]),ta.useEffect(()=>{let R=null;if(O==="emailInput"?R=Rt:O==="phoneInput"?R=Tr:O==="emailOtp"||O==="phoneOtp"?R=Bt:O==="limitUpgradeForm"&&(R=Kr),!R)return;let E=setTimeout(()=>R?.current?.focus(),300);return ()=>clearTimeout(E)},[O]);function wo(){ur.current&&clearTimeout(ur.current),ur.current=null,Go.current&&(Go.current.cancelled=true),Go.current=null,Bi(),D.current&&(D.current.cancelled=true),D.current=null,$.current&&clearInterval($.current),$.current=null,Ae.current&&clearTimeout(Ae.current),Ae.current=null,Ze.current&&clearTimeout(Ze.current),Ze.current=null;}function eo(){let R,E=on.current;if(E){let Q=E.destination_token_metadata?.chain_type;R=Q&&Wk.includes(Q)?Q:o;}else R=o;if(R)return li.current.find(Q=>Q.chain_type===R)}async function wn(){if(!a){F("disabled");return}p&&p.length>0?(vt(p),li.current=p):await Rr(),Te.current=Ln(),Yo(),await Eo();}async function Rr(){try{let R=await Zo({external_user_id:e,destination_chain_type:o??"ethereum",destination_chain_id:n,destination_token_address:i,recipient_address:r},t);if(!ee.current)return;vt(R.data),li.current=R.data;}catch{}}async function Ln(){if(!i||!n||!o)return;let R="US",E;try{let Q=await aa();R=(Q.alpha2||"US").toUpperCase(),E=Q.state&&Q.state.length>0?Q.state:void 0;}catch{}for(let Q=0;Q<My;Q++)try{let ge=await yc({token_address:i,chain_id:n,chain_type:o,country_code:R,subdivision_code:E},t);if(!ee.current)return;Ht(ge),on.current=ge;return}catch{if(!ee.current)return;Q<My-1&&await rd(Ek);}}async function Yo(){try{let R=await Rh(t);if(!ee.current)return;oe(R.agreements??[]);}catch{}}async function Eo(){let R=await Us.get(b),E=c&&Iu.test(c)?c:null;if(T){W(T),tr.current=T,Y(true);let Et=R&&R.email.toLowerCase()===T.toLowerCase()?om(R.phone):"";Z(Et);}else if(R){W(R.email),tr.current=R.email;let Et=om(R.phone);Z(Et),Y(true);}else Y(false),E&&(W(E),tr.current=E);if(!R){F(T?"phoneInput":"emailInput");return}if(T&&R.email.toLowerCase()!==T.toLowerCase()){bo.current="",Qr.current=false,F("phoneInput");return}let Q=om(R.phone),ge=Q.length===10?`+1${Q}`:"";if(bo.current=ge,Qr.current=/^\+1\d{10}$/.test(ge),Us.isOnrampTokenFresh(R)&&R.onrampToken&&R.onrampTokenExpiresAtMs!=null){let Et={token:R.onrampToken,token_type:"Bearer",expires_in:Math.max(0,Math.floor((R.onrampTokenExpiresAtMs-Date.now())/1e3))};lr(Et),Mt.current=Et;}let pr=Us.isPhoneVerificationFresh(R),cr=/^\+1\d{10}$/.test(ge)&&R.phone===ge&≺if(cr)try{let Et=await Sc(ge,t);Cn(Et);let Gr=fs(Et);if(Gr){ia(Gr,Et.upgradeStatus);return}}catch{}if(Mt.current!=null&&cr){F("amount");return}Iu.test(tr.current)&&/^\+1\d{10}$/.test(ge)?await xd():F("phoneInput");}function Cn(R){let E=null;for(let Q of R.limits){if(!Q.currency)continue;let ge=parseFloat(Q.remaining);Number.isFinite(ge)&&(E=E==null?ge:Math.min(E,ge));}E!=null&&ee.current&&ht(Math.max(0,E));}function fs(R){if(!R.limitReached)return null;switch(R.upgradeStatus){case zk:return "limitUpgradeIntro";case rm:return "limitUpgradeForm";case Uk:return "limitUpgradeSubmitting";case zy:return null;case void 0:return R.limitUpgradeOptions&&R.limitUpgradeOptions.length>0?"limitUpgradeIntro":"guestLimitReached";default:return "guestLimitReached"}}function Bn(){if(!Qr.current){F("guestLimitReached");return}(async()=>{try{let R=await Sc(bo.current,t);if(!ee.current)return;Cn(R);let E=fs(R);E?ia(E,R.upgradeStatus):Mt.current!=null?F("amount"):await xd();}catch{ee.current&&F("guestLimitReached");}})();}function ia(R,E){me(null),qr.current=null,Qe(null),Mr.current=null,er(false),ko.current=false,L(R==="limitUpgradeForm"&&E===rm?se.upgradeVerifyFailed:null),F(R),R==="limitUpgradeSubmitting"&&oh();}async function vp(){!Lt.current||!Qr.current||await xd();}async function xd(){F("submittingSession"),be("");try{let R=await Ih({email:tr.current,phone:bo.current,terms_accepted:!0,email_already_verified:!0},t),E=R.client_secret;if(!E)throw new Error("Missing required field: client_secret");await Fp();let Q=Md(R.email)?"phone":"email";if(await zd(R.id,Q,E,t),!ee.current)return;ae(R),ke(E),Rp(),F(Q==="phone"?"phoneOtp":"emailOtp");}catch(R){if(!ee.current)return;be(Bl(R)),F("phoneInput");}}async function Iw(){let R=ce,E=te;if(!(!R||!E||j.length!==Ru||ot)){qe(null),Ye(true);try{let Q=await Zp(R.id,"email",E,j,t);if(Md(Q.email)){if(await Fp({emailVerifiedAt:Q.email.verified_at}),await zd(Q.id,"phone",E,t),!ee.current)return;ae(Q),Ie(""),Rp(),Ye(!1),F("phoneOtp");}else {if(!ee.current)return;qe(se.incorrectCode),Ie(""),Ye(!1);}}catch(Q){if(!ee.current)return;qe(Bl(Q)),Ie(""),Ye(false);}}}async function Pw(){let R=ce,E=te;if(!(!R||!E||pt.length!==Ru||ot)){qe(null),Ye(true);try{let Q=await Zp(R.id,"phone",E,pt,t);if(Md(Q.phone)&&Q.status==="verified"){let ge=await Ph(Q.id,E,t);if(await Fp({emailVerifiedAt:Q.email.verified_at,phoneVerifiedAt:Q.phone.verified_at,onrampToken:ge.token,onrampTokenExpiresAtMs:Date.now()+ge.expires_in*1e3}),!ee.current)return;ae(Q),lr(ge),Mt.current=ge,Y(!0),Ge("");try{let pr=await Sc(bo.current,t);Cn(pr);let cr=fs(pr);if(cr){if(!ee.current)return;Ye(!1),ia(cr,pr.upgradeStatus);return}}catch{}if(!ee.current)return;Ye(!1),F("amount");}else {if(!ee.current)return;qe(se.incorrectCode),Ge(""),Ye(!1);}}catch(Q){if(!ee.current)return;qe(Bl(Q)),Ge(""),Ye(false);}}}function Fw(R){let E=ce,Q=te;!E||!Q||(async()=>{try{if(await zd(E.id,R?"email":"phone",Q,t),!ee.current)return;qe(null),Rp();}catch(ge){ee.current&&qe(Bl(ge));}})();}function Rp(){st(Ik),$.current&&clearInterval($.current),$.current=setInterval(()=>{st(R=>R<=1?($.current&&clearInterval($.current),$.current=null,0):R-1);},1e3);}function ja(R){let E=R;if(!(E===""||/^\d*\.?\d{0,2}$/.test(E))){let Gr=Mr.current??"";ze(Gr),ft.current=Gr;return}if(E.length>1&&E.startsWith("0")&&!E.startsWith("0.")&&(E=E.replace(/^0+/,""),E===""&&(E="0")),ze(E),ft.current=E,be(""),Mr.current===E&&qr.current!=null)return;let Q=parseFloat(E)||0,ge=E!==""&&Q>=A&&Q<=nt;Mr.current!==E&&(me(null),qr.current=null,Qe(null),Mr.current=null,er(false),ko.current=false),ur.current&&clearTimeout(ur.current),ur.current=null,Go.current&&(Go.current.cancelled=true),Go.current=null;let pr=Mt.current?.token;if(!ge||!pr){he(false);return}let cr={cancelled:false};Go.current=cr;let Et=E;ur.current=setTimeout(()=>{(async()=>{if(!cr.cancelled){he(true);try{await Aw(pr,Et,cr);}finally{ee.current&&Go.current===cr&&(qr.current!=null&&Mr.current===Et||he(false));}}})();},Pk);}function Dw(R){if(na.current)return;let E=ft.current;if(R==="\u232B"){E.length>0&&ja(E.slice(0,-1));return}if(R==="."){if(E.includes("."))return;ja(E===""?"0.":E+".");return}let Q=E.indexOf(".");if(Q>=0){if(E.length-(Q+1)>=2)return;ja(E+R);}else {let ge=E+R;for(;ge.length>1&&ge.startsWith("0");)ge=ge.slice(1);ja(ge);}}function Xm(){if(Mt.current==null||qr.current!=null)return;let R=parseFloat(ft.current)||0;ft.current!==""&&R>=A&&R<=nt&&ja(ft.current);}async function Aw(R,E,Q){if(Te.current&&await Te.current,Q.cancelled)return;let ge=!!i&&!!n&&!!o;if(on.current==null&&ge){let wt=Ln();if(Te.current=wt,await wt,Q.cancelled||!ee.current)return}let pr,cr,Et=on.current;if(Et)pr=Et.destination_currency,cr=Et.destination_network;else {if(!o||!n){if(!ee.current)return;be(se.destinationNotConfigured);return}let wt=Qk(o,n);if(!wt){if(!ee.current)return;be(ge?se.networkError:se.networkUnsupported);return}cr=wt,pr=(s??"USDC").toLowerCase();}let Gr=eo()?.address;if(!Gr){if(!ee.current)return;be(se.depositWalletUnavailable);return}let Yr=By("orsext");try{let wt=await Fh({source_currency:"usd",source_amount:E,destination_currency:pr,destination_network:cr,wallet_address:Gr,email:tr.current||T||void 0,external_id:Yr},R,t);if(Q.cancelled||!ee.current||E!==ft.current)return;me({url:wt.url}),qr.current={url:wt.url},Qe(E),Mr.current=E;}catch(wt){if(Q.cancelled||!ee.current)return;let Io=wt instanceof Error?wt.message:String(wt);if(Zk(wt)){let ms=await Us.get(b);if(ms&&(ms.onrampToken=null,ms.onrampTokenExpiresAtMs=null,await Us.set(b,ms)),!ee.current)return;lr(null),Mt.current=null,me(null),qr.current=null,Qe(null),Mr.current=null,Y(true),F("phoneInput");return}if(Jk(Io)){me(null),qr.current=null,Qe(null),Mr.current=null,be(""),Bn();return}me(null),qr.current=null,Qe(null),Mr.current=null,be(Bl(wt));}}function eh(R,E,Q){switch(R){case "unifold.pay_authorized":{if(vr.current!=="amount"||yo.current)return;yt(true),yo.current=true,Ip();break}case "unifold.pay_cancelled":{if(vr.current!=="amount"||!yo.current||Bo.current!=null||nn.current!=null)return;Bi(),De(false),ue.current=null,yt(false),yo.current=false;break}case "onramp_api.commit_success":case "onramp_api.polling_success":{if(vr.current!=="amount"||nn.current!=null)return;let ge=Bo.current;if(ge&&["succeeded","failed","refunded"].includes(ge.status))return;yo.current?sn.current==null&&Ip():(yt(true),yo.current=true,Ip());break}case "onramp_api.commit_error":{E&&["ERROR_CODE_GUEST_TRANSACTION_COUNT","ERROR_CODE_GUEST_DAILY_TRANSACTION_COUNT","ERROR_CODE_GUEST_TRANSACTION_LIMIT"].includes(E)?(Bi(),yt(false),yo.current=false,Bn()):th(Q);break}case "onramp_api.polling_error":case "onramp_api.polling_failed":{th(Q);break}}}function th(R){if(vr.current!=="amount")return;let E=Bo.current;if(E&&["succeeded","failed","refunded"].includes(E.status))return;Bi(),De(false),_(null),Bo.current=null,ue.current=null;let Q=R&&R.trim().length>0?R.trim():se.paymentErrorFallback;X(Q),nn.current=Q,yo.current||(yt(true),yo.current=true),f?.({message:Q});}function Bi(){sn.current&&(sn.current.cancelled=true),sn.current=null;}function Ip(){Bi(),De(false),X(null),nn.current=null;let R={cancelled:false};sn.current=R;let E=Date.now();(async()=>{let Q=E+Ak,ge=zt.current,pr=ge!=null;if(ge==null)for(let wt=0;wt<Ey&&!R.cancelled&&Date.now()<Q;wt++){if(ge=await rh(),R.cancelled)return;if(ge!=null){pr=wt===0;break}await rd(Wy);}if(R.cancelled)return;let cr=ge!=null&&pr,Et=cr?ge:new Set,Gr=cr?E-Vk:E;for(;!R.cancelled&&Date.now()<Q;){if(await Vw(R,Gr,Et),R.cancelled)return;let wt=eo()?.id;if(wt)try{await Cc({deposit_wallet_id:wt},t);}catch{}await rd(Ok);}if(R.cancelled||!ee.current)return;let Yr=Bo.current;Yr&&["succeeded","failed","refunded"].includes(Yr.status)||yo.current&&(De(true),f?.({message:"Timed out waiting for the deposit to be detected. It may still complete.",code:"polling_timeout"}));})();}async function rh(){try{let R=await ln(e,t,"deposit");return new Set(R.data.map(E=>E.id))}catch{return null}}async function Ow(){for(let R=0;R<Ey&&ee.current;R++){let E=await rh();if(!ee.current)return;if(E!=null){zt.current=E;return}await rd(Wy);}}async function Vw(R,E,Q){try{let pr=[...(await ln(e,t,"deposit")).data].sort((Gr,Yr)=>{let wt=Fu(Gr.created_at)??0;return (Fu(Yr.created_at)??0)-wt}),cr=eo()?.id,Et=pr.find(Gr=>{let Yr=ue.current;if(Yr)return Gr.id===Yr;let wt=Fu(Gr.created_at);return wt===null||wt<=E||!cr||Gr.deposit_wallet_id!==cr?!1:!Q.has(Gr.id)});if(!Et||R.cancelled||!ee.current)return;ue.current==null&&(ue.current=Et.id),_(Et),Bo.current=Et,S?.([Et]),Et.status==="succeeded"?(Bi(),yt(!1),yo.current=!1,F("success"),d?.({message:"Deposit completed successfully",executionId:Et.id,transaction:Et})):(Et.status==="failed"||Et.status==="refunded")&&(Bi(),yt(!1),yo.current=!1,F("success"),f?.({message:`Deposit ${Et.status}`}));}catch{}}function Pp(){_e(""),J("");}function Lw(){if(ne.current)return;let R=Hy(q);!R||!/^\d{4}$/.test(K)||(kt(true),ne.current=true,L(null),F("limitUpgradeSubmitting"),D.current&&(D.current.cancelled=true),D.current=null,(async()=>{try{await Dh({phone:bo.current,fields:{ssnLast4:K,dateOfBirth:R}},t);}catch(E){if(!ee.current)return;let Q=E instanceof Error?E.message:String(E);kt(false),ne.current=false,Xk(Q)?(Pp(),L(null),F("guestLimitReached")):(L(Bl(E)),F("limitUpgradeForm"));return}ee.current&&(kt(false),ne.current=false,oh());})());}function oh(){D.current&&(D.current.cancelled=true);let R={cancelled:false};D.current=R,Bw(R);}async function Bw(R){let E=Date.now(),Q=true;for(;Date.now()-E<Bk;){if(R.cancelled||(Q||await rd(Lk),Q=false,R.cancelled))return;let ge;try{ge=await Sc(bo.current,t);}catch{continue}if(R.cancelled||!ee.current)return;Cn(ge);let pr=ge.upgradeStatus,cr=ge.limitReached;if(pr===zy||!cr){let Et=Mt.current!=null;if(Pp(),L(null),Et)F("amount");else {if(R.cancelled)return;await xd();}return}if(pr===Nk){Pp(),L(null),F("guestLimitReached");return}if(pr===rm){_e(""),L(se.upgradeVerifyFailed),F("limitUpgradeForm");return}}R.cancelled||!ee.current||(L(null),F("limitUpgradeFailed"));}async function Fp(R){let E=await Us.get(b),ge=E?.phone===bo.current&&E?.email.toLowerCase()===tr.current.toLowerCase()?E:null,pr={email:tr.current,phone:bo.current,termsAcceptedAt:ge?.termsAcceptedAt??tx(),phoneVerifiedAt:R?.phoneVerifiedAt??ge?.phoneVerifiedAt??null,emailVerifiedAt:R?.emailVerifiedAt??ge?.emailVerifiedAt??null,onrampToken:R?.onrampToken??ge?.onrampToken??null,onrampTokenExpiresAtMs:R?.onrampTokenExpiresAtMs??ge?.onrampTokenExpiresAtMs??null};await Us.set(b,pr);}function nh(){if(Xe){Bi(),yt(false),yo.current=false,De(false),X(null),nn.current=null,_(null),Bo.current=null,ue.current=null,be(""),me(null),qr.current=null,Qe(null),Mr.current=null,er(false),ko.current=false,Xm();return}switch(O){case "phoneInput":je?g():F("emailInput");break;case "emailOtp":Ie(""),F("phoneInput");break;case "phoneOtp":Ge(""),F("phoneInput");break;case "checkingDeposit":Bi(),De(false),X(null),nn.current=null,me(null),qr.current=null,Qe(null),Mr.current=null,be(""),_(null),Bo.current=null,ue.current=null,F("amount");break;case "limitUpgradeForm":L(null),F("limitUpgradeIntro");break;default:g();break}}function Dp(){wo(),k();}let Ew=(()=>{if(Xe)return se.checkingHeaderTitle;switch(O){case "emailInput":case "phoneInput":case "submittingSession":return se.title;case "emailOtp":return se.emailOtpHeaderTitle;case "phoneOtp":return se.phoneHeaderTitle;case "amount":return se.amountHeaderTitle;case "checkingDeposit":return se.checkingHeaderTitle;case "guestLimitReached":case "limitUpgradeIntro":case "limitUpgradeFailed":return se.guestLimitHeaderTitle;case "limitUpgradeForm":case "limitUpgradeSubmitting":return se.upgradeHeaderTitle;default:return se.title}})(),Ww=(()=>{if(Xe)return true;switch(O){case "phoneInput":return !je;case "emailOtp":case "phoneOtp":case "checkingDeposit":case "limitUpgradeForm":return true;default:return false}})();function ci({title:R,enabled:E,loading:Q,onPress:ge}){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ge,disabled:!E,activeOpacity:.85,style:[V.primaryButton,{backgroundColor:E?h.primary:`${h.primary}80`,borderRadius:P}],children:[Q&&jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground}),jsxRuntime.jsx(reactNative.Text,{style:[V.primaryButtonText,{color:h.primaryForeground,fontFamily:w.medium}],children:R})]})}function ih(){let R=rt.length>0?rt:Mk;return jsxRuntime.jsx(reactNative.View,{style:V.legalWrapper,children:jsxRuntime.jsxs(reactNative.Text,{style:[V.legalText,{color:h.foregroundMuted,fontFamily:w.regular}],children:[se.disclaimerPrefix,R.map((E,Q)=>{let ge="";return Q<R.length-2?ge=", ":Q===R.length-2&&(ge=", and "),jsxRuntime.jsxs(reactNative.Text,{children:[jsxRuntime.jsx(reactNative.Text,{style:{color:h.foreground,textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL(E.url).catch(()=>{}),children:E.name}),ge]},E.key)}),se.disclaimerSuffix]})})}function _d(R,E){return jsxRuntime.jsxs(reactNative.View,{style:V.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.detailLabel,{color:h.foregroundMuted,fontFamily:w.regular}],children:R}),jsxRuntime.jsx(reactNative.Text,{style:[V.detailValue,{color:h.foreground,fontFamily:w.medium}],children:E})]},R)}function sh(R,E,Q){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[V.txRow,{backgroundColor:h.card,borderColor:h.border,borderRadius:m}],onPress:()=>reactNative.Linking.openURL(Q).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.txLabel,{color:h.foreground,fontFamily:w.medium}],children:R}),jsxRuntime.jsxs(reactNative.View,{style:V.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.txHash,{color:h.foregroundMuted}],children:E}),jsxRuntime.jsx(reactNative.Text,{style:[V.txArrow,{color:h.foregroundMuted}],children:"\u2197"})]})]},R)}function Mw(){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredFull,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.centerIcon,{color:h.foregroundMuted}],children:"\u26A0\uFE0E"}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.medium}],children:se.disabledTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.disabledDescription})]})}function zw(){return jsxRuntime.jsxs(reactNative.View,{style:V.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:V.flex}),jsxRuntime.jsx(reactNative.Text,{style:[V.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:se.emailLabel}),jsxRuntime.jsx(reactNative.TextInput,{ref:Rt,value:B,onChangeText:R=>{let E=R.replace(/\s/g,"");W(E),tr.current=E;},placeholder:se.emailPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,style:[V.input,{color:h.foreground,backgroundColor:h.card,borderColor:h.border,borderRadius:I,borderWidth:x,fontFamily:w.regular}]}),jsxRuntime.jsx(reactNative.View,{style:{height:24}}),ih(),jsxRuntime.jsx(ci,{title:se.continueButton,enabled:Fe,loading:false,onPress:()=>F("phoneInput")}),jsxRuntime.jsx(reactNative.View,{style:V.flex})]})}function Uw(){let R=O==="submittingSession";return jsxRuntime.jsxs(reactNative.View,{style:V.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:V.flex}),jsxRuntime.jsx(reactNative.Text,{style:[V.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:se.phoneLabel}),jsxRuntime.jsxs(reactNative.View,{style:[V.phoneRow,{backgroundColor:h.card,borderColor:h.border,borderRadius:I,borderWidth:x}],children:[jsxRuntime.jsx(reactNative.View,{style:[V.phonePrefix,{borderRightColor:h.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[V.phonePrefixText,{color:h.foregroundMuted,fontFamily:w.medium}],children:"+1"})}),jsxRuntime.jsx(reactNative.TextInput,{ref:Tr,value:N,editable:!R,onChangeText:E=>{let Q=E.replace(/\D/g,"");Q.length===11&&Q.startsWith("1")&&(Q=Q.slice(1)),Q.length>10&&(Q=Q.slice(0,10)),Z(Q);},placeholder:se.phonePlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",style:[V.phoneInput,{color:h.foreground,fontFamily:w.regular}]})]}),N.length>0&&!bt?jsxRuntime.jsx(reactNative.Text,{style:[V.warningText,{color:h.warning,fontFamily:w.regular}],children:se.phoneInvalid}):null,Me.length>0?jsxRuntime.jsx(reactNative.Text,{style:[V.warningText,{color:h.warning,fontFamily:w.regular}],children:Me}):null,jsxRuntime.jsx(reactNative.View,{style:{height:24}}),je?ih():null,jsxRuntime.jsx(ci,{title:se.sendCode,enabled:bt&&!R,loading:R,onPress:()=>{vp();}}),jsxRuntime.jsx(reactNative.View,{style:V.flex})]})}function Nw(){let R=O==="emailOtp",E=R?Hk(B):$k(Le),Q=R?j:pt,ge=Q.length===Ru&&!ot;return jsxRuntime.jsxs(reactNative.View,{style:V.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:V.flex}),jsxRuntime.jsx(reactNative.Text,{style:[V.otpSentTo,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.sentTo(E)}),jsxRuntime.jsx(reactNative.TextInput,{ref:Bt,value:Q,onChangeText:pr=>{let cr=pr.replace(/\D/g,"").slice(0,Ru);R?Ie(cr):Ge(cr),qe(null);},placeholder:se.otpPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",style:[V.otpInput,{color:h.foreground,backgroundColor:h.card,borderColor:Se?h.error:h.border,borderRadius:I,fontFamily:w.medium}]}),Se?jsxRuntime.jsx(reactNative.Text,{style:[V.errorTextCentered,{color:h.error,fontFamily:w.regular}],children:Se}):null,jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Fw(R),disabled:dt>0||!ce||!te,style:V.resendButton,children:jsxRuntime.jsx(reactNative.Text,{style:[V.resendText,{color:h.foregroundMuted,fontFamily:w.regular}],children:dt>0?se.resendIn(dt):se.resendCode})}),jsxRuntime.jsx(reactNative.View,{style:{height:24}}),jsxRuntime.jsx(ci,{title:se.verify,enabled:ge,loading:ot,onPress:()=>R?void Iw():void Pw()}),jsxRuntime.jsx(reactNative.View,{style:V.flex})]})}function Hw(){let R=parseFloat(we)||0,E=we!==""&&R>0,Q=E&&R<A,ge=E&&R>nt,pr=E&&!Q&&!ge,cr=Je===we&&pr&&Ue?.url?rx(Ue.url):null,Et=Math.max(60-we.length*2.5,32),Gr=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];return jsxRuntime.jsxs(reactNative.View,{style:V.flex,children:[jsxRuntime.jsx(reactNative.View,{style:{flex:1,minHeight:24}}),jsxRuntime.jsxs(reactNative.View,{style:V.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:V.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.amountDollar,{color:h.foreground,fontSize:Et}],children:"$"}),jsxRuntime.jsx(reactNative.Text,{style:[V.amountValue,{color:we===""?h.foregroundMuted:h.foreground,fontSize:Et}],children:we===""?"0":we})]}),Q?jsxRuntime.jsx(reactNative.Text,{style:[V.amountHint,{color:h.warning,fontFamily:w.regular}],children:se.minimumAmount(Uy(A))}):null,ge?jsxRuntime.jsx(reactNative.Text,{style:[V.amountHint,{color:h.warning,fontFamily:w.regular}],children:se.maximumAmount(Uy(nt))}):null,Me.length>0?jsxRuntime.jsx(reactNative.Text,{style:[V.amountHint,{color:h.warning,fontFamily:w.regular,textAlign:"center"}],children:Me}):null]}),jsxRuntime.jsx(reactNative.View,{style:{flex:1,minHeight:24}}),jsxRuntime.jsxs(reactNative.View,{style:[V.keypadArea,{opacity:Ve?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:V.quickAmountsRow,children:Rk.map(Yr=>{let wt=parseFloat(we)===Yr,Io=Yr>nt;return jsxRuntime.jsx(reactNative.TouchableOpacity,{disabled:Ve||Io,onPress:()=>ja(String(Yr)),activeOpacity:.7,style:[V.quickAmountButton,{backgroundColor:h.card,borderColor:wt?h.primary:h.border,borderRadius:I,opacity:Io?.4:1}],children:jsxRuntime.jsxs(reactNative.Text,{style:[V.quickAmountText,{color:h.foreground,fontFamily:w.medium}],children:["$",Yr]})},Yr)})}),jsxRuntime.jsx(reactNative.View,{style:V.keypad,children:Gr.map((Yr,wt)=>jsxRuntime.jsx(reactNative.View,{style:V.keypadRow,children:Yr.map(Io=>jsxRuntime.jsx(reactNative.TouchableOpacity,{disabled:Ve,onPress:()=>Dw(Io),activeOpacity:.6,style:V.keypadKey,children:jsxRuntime.jsx(reactNative.Text,{style:[V.keypadKeyText,{color:h.foreground,fontFamily:w.medium}],children:Io==="\u232B"?"\u232B":Io})},Io))},wt))})]}),jsxRuntime.jsx(reactNative.View,{style:V.payButtonContainer,children:cr?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[lt?jsxRuntime.jsxs(reactNative.View,{style:V.applePayMarkRow,children:[jsxRuntime.jsx(ox,{size:16,color:h.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[V.applePayMarkText,{color:h.foregroundMuted,fontFamily:w.medium}],children:"Pay"})]}):null,jsxRuntime.jsxs(reactNative.View,{style:V.applePayButtonStack,children:[jsxRuntime.jsx(reactNativeWebview.WebView,{ref:He,source:{uri:cr},style:[V.applePayWebView,{opacity:lt?.02:0}],containerStyle:V.applePayWebViewContainer,pointerEvents:lt?"auto":"none",originWhitelist:["*"],javaScriptEnabled:true,domStorageEnabled:true,scrollEnabled:false,bounces:false,androidLayerType:"hardware",injectedJavaScriptBeforeContentLoaded:nx(P,jy),onMessage:Yr=>{try{let wt=JSON.parse(Yr.nativeEvent.data);if(!wt)return;if(!wt.__uf){if(typeof wt.eventName=="string"){let Io=wt.data||{};eh(wt.eventName,Io.errorCode,Io.errorMessage);}return}if(wt.channel==="cbSize")Number(wt.body)>0&&(Ze.current&&(clearTimeout(Ze.current),Ze.current=null),ko.current||(er(!0),ko.current=!0),he(!1));else if(wt.channel==="cbProbe")ch(Number(wt.body)===1);else if(wt.channel==="cbOnramp"){let Io=typeof wt.body=="string"?JSON.parse(wt.body):wt.body;if(!Io)return;let ms=Io.data||{};eh(Io.eventName,ms.errorCode,ms.errorMessage);}}catch{}}},cr),lt?jsxRuntime.jsx(reactNative.View,{pointerEvents:"none",style:[V.applePayBrandButton,{backgroundColor:h.primary,borderRadius:P}],children:jsxRuntime.jsx(reactNative.Text,{style:[V.applePayBrandText,{color:"#fff",fontFamily:w.semibold}],children:se.continuePay})}):null,lt?null:ah(pr)]})]}):ah(pr)})]})}function ah(R){return jsxRuntime.jsxs(reactNative.View,{style:[V.preparingButton,{backgroundColor:`${h.primary}80`,borderRadius:P}],children:[R?jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:"#fff",gradientTo:"#fff"}):null,jsxRuntime.jsx(reactNative.Text,{style:[V.preparingButtonText,{color:"#fff",fontFamily:w.medium}],children:R?se.preparingApplePay:se.enterAmount})]})}function lh(){return at?jw(at):gt?$w():Pe?qw(Pe):jsxRuntime.jsxs(reactNative.View,{style:V.centeredFull,children:[jsxRuntime.jsx(Ct,{size:80,strokeWidth:4}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.checkingTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.checkingDescription})]})}function $w(){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:V.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.centerIcon,{color:h.foregroundMuted}],children:"\u23F1"}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.checkingTimeoutTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.checkingTimeoutDescription})]}),jsxRuntime.jsx(reactNative.View,{style:V.bottomButton,children:jsxRuntime.jsx(ci,{title:se.done,enabled:true,loading:false,onPress:Dp})})]})}function jw(R){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:V.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.centerIcon,{color:h.error}],children:"\u26A0\uFE0E"}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.paymentErrorTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:R})]}),jsxRuntime.jsx(reactNative.View,{style:V.bottomButton,children:jsxRuntime.jsx(ci,{title:se.tryAgain,enabled:true,loading:false,onPress:nh})})]})}function qw(R){let E=["pending","waiting","delayed"].includes(R.status),Q=["failed","refunded"].includes(R.status),ge=Q?h.error:E?h.warning:h.success,pr=Q?se.failed:E?se.inProgress:se.completed,cr=Kk(R.created_at),Et=R.destination_token_metadata,Gr=Et?.icon_urls?.find(Yr=>Yr.format==="png")?.url??Et?.icon_url??null;return jsxRuntime.jsxs(reactNative.View,{style:V.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{contentContainerStyle:V.detailScrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:V.tokenIconWrapper,children:[Gr?jsxRuntime.jsx(reactNative.Image,{source:{uri:Gr,cache:"force-cache"},style:V.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[V.tokenIconFallback,{backgroundColor:h.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[V.tokenIconFallbackText,{color:h.foreground}],children:"$"})}),jsxRuntime.jsx(reactNative.View,{style:[V.statusBadge,{backgroundColor:ge}],children:jsxRuntime.jsx(reactNative.Text,{style:V.statusBadgeText,children:Q?"\u2715":E?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:V.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[V.statusDot,{backgroundColor:ge}]}),jsxRuntime.jsx(reactNative.Text,{style:[V.statusText,{color:h.foreground,fontFamily:w.semibold}],children:pr})]}),Q?jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular,marginBottom:8}],children:se.depositFailedDescription}):null,cr?jsxRuntime.jsx(reactNative.Text,{style:[V.dateText,{color:h.foregroundMuted,fontFamily:w.regular}],children:cr}):null,jsxRuntime.jsxs(reactNative.View,{style:[V.detailCard,{backgroundColor:h.card,borderColor:h.border,borderRadius:m}],children:[we!==""?_d(se.amountSent,`$${jk(we)} USD`):null,_d(se.amountReceived,`${Gk(R)} ${Yk(R)}`),R.source_amount_usd?_d(se.usdValue,`$${(parseFloat(R.source_amount_usd)||0).toFixed(2)}`):null,R.destination_chain_id?_d(se.destinationNetwork,qk(R.destination_chain_type??"",R.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:V.seeMoreRow,onPress:()=>M(Yr=>!Yr),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.seeMoreText,{color:h.foreground,fontFamily:w.medium}],children:C?se.seeLess:se.seeMoreDetails}),jsxRuntime.jsx(reactNative.Text,{style:[V.seeMoreChevron,{color:h.foregroundMuted}],children:C?"\u25B2":"\u25BC"})]}),C?jsxRuntime.jsxs(reactNative.View,{style:V.txHashSection,children:[R.explorer_url?sh(se.depositTx,Ny(R.transaction_hash),R.explorer_url):null,!E&&!Q&&R.destination_explorer_url&&R.destination_transaction_hashes?.[0]?sh(se.completionTx,Ny(R.destination_transaction_hashes[0]),R.destination_explorer_url):null]}):null]}),jsxRuntime.jsx(reactNative.View,{style:[V.bottomButton,V.detailBottomButton],children:jsxRuntime.jsx(ci,{title:se.done,enabled:true,loading:false,onPress:Dp})})]})}function Qw(){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:V.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.guestLimitTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.guestLimitDescription})]}),jsxRuntime.jsx(reactNative.View,{style:V.bottomButton,children:jsxRuntime.jsx(ci,{title:se.returnButton,enabled:true,loading:false,onPress:g})})]})}function Kw(){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:V.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.guestLimitTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.upgradeIntroDescription})]}),jsxRuntime.jsxs(reactNative.View,{style:V.bottomButton,children:[jsxRuntime.jsx(ci,{title:se.continueButton,enabled:true,loading:false,onPress:()=>{L(null),F("limitUpgradeForm");}}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>{L(null),g();},style:V.textButton,children:jsxRuntime.jsx(reactNative.Text,{style:[V.textButtonLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:se.cancelButton})})]})]})}function Gw(){let R=Hy(q)!=null,E=/^\d{4}$/.test(K),Q=R&&E;return jsxRuntime.jsxs(reactNative.View,{style:V.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:V.flex}),jsxRuntime.jsx(reactNative.Text,{style:[V.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:se.dobLabel}),jsxRuntime.jsx(reactNative.TextInput,{ref:Kr,value:q,onChangeText:ge=>{J(ex(ge)),et&&L(null);},placeholder:se.dobPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",style:[V.input,{color:h.foreground,backgroundColor:h.card,borderColor:h.border,borderRadius:I,borderWidth:x,fontFamily:w.regular}]}),jsxRuntime.jsx(reactNative.View,{style:{height:16}}),jsxRuntime.jsx(reactNative.Text,{style:[V.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:se.ssnLabel}),jsxRuntime.jsx(reactNative.TextInput,{value:K,onChangeText:ge=>{_e(ge.replace(/\D/g,"").slice(0,4)),et&&L(null);},placeholder:se.ssnPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",secureTextEntry:true,style:[V.input,{color:h.foreground,backgroundColor:h.card,borderColor:h.border,borderRadius:I,borderWidth:x,fontFamily:w.regular}]}),et?jsxRuntime.jsx(reactNative.Text,{style:[V.warningText,{color:h.warning,fontFamily:w.regular}],children:et}):null,jsxRuntime.jsx(reactNative.View,{style:V.flex}),jsxRuntime.jsx(ci,{title:se.submitButton,enabled:Q&&!U,loading:U,onPress:Lw}),jsxRuntime.jsx(reactNative.View,{style:V.flex})]})}function Yw(){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredFull,children:[jsxRuntime.jsx(Ct,{size:80,strokeWidth:4}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.verifyingTitle}),jsxRuntime.jsx(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:se.verifyingDescription})]})}function Jw(){return jsxRuntime.jsxs(reactNative.View,{style:V.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:V.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:se.upgradeFailedTitle}),jsxRuntime.jsxs(reactNative.Text,{style:[V.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:[se.upgradeFailedPrefix,jsxRuntime.jsx(reactNative.Text,{style:{color:h.primary,textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL(se.supportUrl).catch(()=>{}),children:se.contactSupport}),se.upgradeFailedSuffix]})]}),jsxRuntime.jsx(reactNative.View,{style:V.bottomButton,children:jsxRuntime.jsx(ci,{title:se.returnButton,enabled:true,loading:false,onPress:()=>{L(null),g();}})})]})}function Zw(){switch(O){case "loading":return jsxRuntime.jsx(reactNative.View,{style:V.centeredFull,children:jsxRuntime.jsx(Ct,{size:40,strokeWidth:3})});case "disabled":return Mw();case "emailInput":return zw();case "phoneInput":case "submittingSession":return Uw();case "emailOtp":case "phoneOtp":return Nw();case "amount":return jsxRuntime.jsxs(reactNative.View,{style:V.flex,children:[Hw(),Xe?jsxRuntime.jsx(reactNative.View,{style:[V.overlay,{backgroundColor:h.background}],children:lh()}):null]});case "checkingDeposit":case "success":return lh();case "guestLimitReached":return Qw();case "limitUpgradeIntro":return Kw();case "limitUpgradeForm":return Gw();case "limitUpgradeSubmitting":return Yw();case "limitUpgradeFailed":return Jw();default:return null}}ta.useEffect(()=>{O==="amount"&&Xm();},[O]);function Xw(){!ee.current||ko.current||(er(true),ko.current=true,he(false));}function ch(R){if(Ze.current&&clearTimeout(Ze.current),Ze.current=null,!(!ee.current||ko.current)){if(R){Xw();return}me(null),qr.current=null,Qe(null),Mr.current=null,er(false),ko.current=false,he(false),be(se.applePayButtonUnavailable);}}return ta.useEffect(()=>{if(!(!(Je===we&&Ue?.url&&Ue.url)||lt))return Ae.current&&clearTimeout(Ae.current),Ae.current=setTimeout(()=>{!ee.current||ko.current||(He.current?.injectJavaScript(ix()),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{ch(false);},Dk));},Fk),()=>{Ae.current&&clearTimeout(Ae.current),Ae.current=null,Ze.current&&clearTimeout(Ze.current),Ze.current=null;}},[Ue,Je,we,lt]),ta.useEffect(()=>{lt?Ow():zt.current=null;},[lt]),jsxRuntime.jsxs(reactNative.View,{style:[V.root,{backgroundColor:h.background}],children:[jsxRuntime.jsx(fo,{title:Ew,showBack:Ww,showClose:true,onBack:nh,onClose:Dp}),jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:V.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:Zw()})]})}var Pu={position:"absolute",left:0,right:0,top:0,bottom:0},V=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},overlay:{...Pu},formContainer:{flex:1,paddingHorizontal:16,paddingTop:16,paddingBottom:16},fieldLabel:{fontSize:12,paddingHorizontal:4,marginBottom:6},input:{fontSize:15,padding:14},phoneRow:{flexDirection:"row",alignItems:"center",height:50,overflow:"hidden"},phonePrefix:{paddingHorizontal:12,height:"100%",justifyContent:"center",borderRightWidth:1},phonePrefixText:{fontSize:15},phoneInput:{flex:1,fontSize:15,padding:14},warningText:{fontSize:12,paddingHorizontal:4,marginTop:6},otpSentTo:{fontSize:14,textAlign:"center",marginBottom:24},otpInput:{fontSize:24,textAlign:"center",paddingVertical:14,borderWidth:1.5},errorTextCentered:{fontSize:12,textAlign:"center",marginTop:8},resendButton:{marginTop:12,alignItems:"center"},resendText:{fontSize:12},legalWrapper:{paddingHorizontal:4,marginBottom:24},legalText:{fontSize:11,lineHeight:16},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:16},primaryButtonText:{fontSize:16},amountSection:{alignItems:"center",paddingHorizontal:16},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountValue:{fontWeight:"400"},amountHint:{fontSize:14,marginTop:4},keypadArea:{paddingHorizontal:16,paddingBottom:12,gap:16},quickAmountsRow:{flexDirection:"row",gap:12},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderWidth:1},quickAmountText:{fontSize:14},keypad:{gap:10},keypadRow:{flexDirection:"row",gap:10},keypadKey:{flex:1,height:52,alignItems:"center",justifyContent:"center"},keypadKeyText:{fontSize:24},payButtonContainer:{paddingHorizontal:16,paddingBottom:16},applePayMarkRow:{flexDirection:"row",alignItems:"center",gap:4,marginBottom:8},applePayMarkText:{fontSize:19},applePayButtonStack:{height:jy,position:"relative"},applePayBrandButton:{...Pu,alignItems:"center",justifyContent:"center"},applePayBrandText:{fontSize:16},applePayWebView:{...Pu,backgroundColor:"transparent"},applePayWebViewContainer:{...Pu,backgroundColor:"transparent"},preparingButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:16},preparingButtonText:{fontSize:16},centeredFull:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},centeredWithButton:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:16,gap:12},centerIcon:{fontSize:40},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},bottomButton:{gap:8},detailBottomButton:{paddingHorizontal:16,paddingBottom:16},textButton:{alignItems:"center",paddingVertical:14,marginTop:4},textButtonLabel:{fontSize:16},detailScrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},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%",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,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}});var Qy=5e3,Ky=2500,Gy=5e3,Yy=6e4;function si(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:i,publishableKey:s,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:g,setTrackedExecutions:k,setLatestExecution:d,setShowStatusSheet:f,onDepositSuccess:S,onExecutionsChange:h,onDepositError:w}=e,[v,I]=ta.useState(false),[x,P]=ta.useState(false);return ta.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;I(false),t==="auto_ui"&&P(false);let u=setTimeout(()=>{I(true),t==="auto_ui"&&P(true);},Qy);return ()=>clearTimeout(u)},[r,t,o,n]),ta.useEffect(()=>{if(!r||!i||!a)return;let u=new Date(a.getTime()-Yy),T=setInterval(async()=>{try{let O=[...(await ln(i,s,"deposit")).data??[]].sort((B,W)=>{let N=B.created_at?new Date(B.created_at).getTime():0;return (W.created_at?new Date(W.created_at).getTime():0)-N}),F=null;for(let B of O){let W=B.created_at?new Date(B.created_at):null;if(!W||W<=u)continue;let N=p.get(B.id);if(!N){F=B;break}if(["pending","waiting","delayed"].includes(N)&&B.status==="succeeded"){F=B;break}}if(F){let B=F;g(W=>{let N=W.findIndex(Z=>Z.id===B.id);if(N>=0){let Z=[...W];return Z[N]=B,Z}return [...W,B]}),k(W=>{let N=new Map(W);return N.set(B.id,B.status),N}),d(B),f(!0),B.status==="succeeded"&&S?.({message:"Deposit completed successfully",executionId:B.id}),h?.([...c,B]);}}catch(b){w?.({message:"Failed to check deposit status",error:b});}},Ky);return ()=>clearInterval(T)},[r,i,s,a,p,c,h,S,w]),ta.useEffect(()=>{if(!r||!v||!l)return;let u=async()=>{try{await Vd(l,s);}catch{}};u();let T=setInterval(u,Gy);return ()=>clearInterval(T)},[r,v,l,s]),{pollingEnabled:v,showWaitingUi:x,handleIveDeposited:()=>{I(true),P(true);}}}function Zy({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(od,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(im,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function od({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=z(),n=ta.useRef(new reactNative.Animated.Value(0)).current;ta.useEffect(()=>{if(e&&!t){n.setValue(0);let s=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return s.start(),()=>s.stop()}},[e,t,n]);let i=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Ou.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:i}]},children:jsxRuntime.jsx(cc,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ou.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function im({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:i,components:s}=z();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Ou.iveDepositedButton,{backgroundColor:n.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ou.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})})}var Ou=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 Lu(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ye(t||r||e.icon_url)}function fx(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 Bu=18,Eu=12,mx=2;function hx({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),i=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(en,{uri:e,width:r,height:r,borderRadius:10}),i?jsxRuntime.jsxs(reactNative.View,{style:Yi.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.backBadge],children:jsxRuntime.jsx(rl,{size:Eu})}),jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.frontBadge],children:jsxRuntime.jsx(Xa,{size:Eu})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.singleBadge],children:jsxRuntime.jsx(Xa,{size:Eu})}):n?jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.singleBadge],children:jsxRuntime.jsx(rl,{size:Eu})}):null]})}var Yi=reactNative.StyleSheet.create({badge:{width:Bu,height:Bu,borderRadius:Bu/2,borderWidth:mx,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 Wu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,onBack:s,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:g,onShowStatusSheet:k}){let{colors:d,fonts:f,components:S}=z(),h=ta.useRef(true);ta.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let w=ta.useRef(false),[v,I]=ta.useState("selectWallet"),[x,P]=ta.useState([]),[m,u]=ta.useState(true),[T,b]=ta.useState(null),[A,O]=ta.useState(null),[F,B]=ta.useState(null),[W,N]=ta.useState(null),[Z,je]=ta.useState(null),[Y,rt]=ta.useState([]),[oe,ce]=ta.useState(false),[ae,te]=ta.useState(null),[ke,j]=ta.useState([]),[Ie,pt]=ta.useState(new Map),[Ge]=ta.useState(()=>new Date),[Se,qe]=ta.useState(null),[ot,Ye]=ta.useState(false),[dt,st]=ta.useState(null),[Me,be]=ta.useState(false);ta.useEffect(()=>{if(v==="depositProcessing"||v==="depositComplete")return;if(v!=="waitingForDeposit"){be(false);return}reactNative.AppState.currentState==="active"&&be(true);let L=reactNative.AppState.addEventListener("change",U=>{U==="active"&&be(true);});return ()=>L.remove()},[v]);let we=v==="waitingForDeposit"&&Me||v==="depositProcessing",ze=W||F||A?.chain_types[0]||o||"ethereum",ut=an(Y,ze),ht=ut?.address||"",xt=ut?.id??"",lr=`${ze}:${n||""}`;ta.useEffect(()=>(h.current=true,()=>{h.current=false;}),[]),ta.useEffect(()=>{Qe();},[t]),ta.useEffect(()=>{Se&&g?.(Se);},[Se]),ta.useEffect(()=>{p?.(ke);},[ke]);let[Ue,me]=ta.useState(false);ta.useEffect(()=>{!ot||!Se||(Ye(false),Se.status==="succeeded"?(I("depositComplete"),l?.({message:"Deposit completed successfully",executionId:Se.id,transaction:Se})):Se.status==="failed"||Se.status==="refunded"?(I("failed"),c?.({message:`Deposit ${Se.status}`,code:Se.status})):I("depositProcessing"));},[ot,Se]),ta.useEffect(()=>{v!=="depositProcessing"||!Se||(Se.status==="succeeded"?(I("depositComplete"),l?.({message:"Deposit completed successfully",executionId:Se.id,transaction:Se})):(Se.status==="failed"||Se.status==="refunded")&&(I("failed"),c?.({message:`Deposit ${Se.status}`,code:Se.status})));},[Se?.status]);let{showWaitingUi:Je}=si({depositConfirmationMode:"auto_ui",enabled:we,depositAddress:ht,chain:lr,externalUserId:e,publishableKey:t,modalOpenedAt:dt??Ge,depositWalletId:xt,depositExecutions:ke,trackedExecutions:Ie,setDepositExecutions:j,setTrackedExecutions:pt,setLatestExecution:qe,setShowStatusSheet:Ye,onExecutionsChange:p,onDepositError:c});async function Qe(){u(true),b(null);try{let L=await Yp(t);if(!h.current)return;let U=L.data.filter(fx),kt=U.map(Lu).filter(Boolean);if(kt.length>0&&await Hc(kt),!h.current)return;P(U);}catch(L){if(!h.current)return;b(L instanceof Error?L.message:"Failed to load wallets");}finally{h.current&&u(false);}}function Ve(L){O(L),N(null),te(null),L.chain_types.length>1?(B(null),I("selectNetwork")):Ne(L);}function he(L){B(L),A&&Ne(A,L);}async function Ne(L,U){if(w.current)return;w.current=true,ce(true),I("connecting");let kt=U||L.chain_types[0]||null;try{let Le=await Zo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:i,recipient_address:r},t);if(!h.current)return;rt(Le.data);let Fe=Le.data.map(Mt=>({chain_type:Mt.chain_type,address:Mt.address})),bt=kt?Fe.filter(Mt=>Mt.chain_type===kt):Fe,nt=bt.length>0,ee=nt?bt:Fe,vr=nt?kt:ee[0]?.chain_type??kt;N(vr??null);let ft=await Jp(L.id,ee,t);if(!h.current)return;if(je(ft),ce(!1),!ft.supported||!ft.deeplink&&!ft.pay_url){te(`${L.name} doesn't support in-app browser on this device`),I("failed");return}let tr=ft.deeplink||ft.pay_url;try{await reactNative.Linking.openURL(tr);}catch{if(!h.current)return;te(`Could not open ${L.name}. Make sure it is installed.`),I("failed");return}if(!h.current)return;st(new Date),I("waitingForDeposit");}catch(Le){if(!h.current)return;ce(false),te(Le instanceof Error?Le.message:"Failed to connect wallet"),I("failed");}}function vt(){if(!Z)return;let L=Z.deeplink||Z.pay_url;reactNative.Linking.openURL(L).catch(()=>{});}function Vt(){w.current=false,O(null),B(null),N(null),je(null),rt([]),st(null),te(null),ce(false),I("selectWallet");}function Ht(){return m?jsxRuntime.jsx(reactNative.View,{style:Dt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary})}):T?jsxRuntime.jsxs(reactNative.View,{style:Dt.centeredContainer,children:[jsxRuntime.jsx(gs,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:T}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Qe,style:[Dt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Dt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):x.length===0?jsxRuntime.jsxs(reactNative.View,{style:Dt.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:Dt.walletList,contentContainerStyle:Dt.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),x.map(L=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Ve(L),activeOpacity:.7,disabled:oe,style:[Dt.walletRow,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor,opacity:oe?.5:1}],children:[jsxRuntime.jsx(hx,{uri:Lu(L),chainTypes:L.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:Dt.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dt.walletName,{color:d.foreground,fontFamily:f.medium}],children:L.name}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.walletChains,{color:d.foregroundMuted,fontFamily:f.regular}],children:L.chain_types.map(U=>U.charAt(0).toUpperCase()+U.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(co,{size:16,color:d.foregroundMuted,strokeWidth:2})]},L.id))]})}function lt(){if(!A)return null;let L=Lu(A),U=Le=>Le==="n1"?"N1":Le==="xrpl"?"XRPL":Le.charAt(0).toUpperCase()+Le.slice(1),kt=A.chain_types.map(Le=>({id:Le,name:U(Le),Icon:Le==="ethereum"?Xa:rl}));return jsxRuntime.jsxs(reactNative.View,{style:Dt.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Dt.networkPickerHeader,children:[jsxRuntime.jsx(en,{uri:L,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.statusTitle,{color:d.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",A.name]})]}),jsxRuntime.jsx(reactNative.View,{style:Dt.networkList,children:kt.map(({id:Le,name:Fe,Icon:bt})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>he(Le),activeOpacity:.7,disabled:oe,style:[Dt.networkRow,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor,opacity:oe?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:Dt.networkIconContainer,children:jsxRuntime.jsx(bt,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.networkName,{color:d.foreground,fontFamily:f.medium}],children:Fe}),jsxRuntime.jsx(co,{size:16,color:d.foregroundMuted,strokeWidth:2})]},Le))})]})}function er(){return jsxRuntime.jsxs(reactNative.View,{style:Dt.centeredContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Opening ",A?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function Xe(){let L=A?.name??"your wallet",U=A?Lu(A):null;return jsxRuntime.jsxs(reactNative.View,{style:Dt.centeredContainer,children:[U?jsxRuntime.jsx(Ct,{size:80,children:jsxRuntime.jsx(en,{uri:U,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Continue in ",L]}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:vt,activeOpacity:.8,style:[Dt.primaryButton,{backgroundColor:d.primary,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:[jsxRuntime.jsx(En,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",L]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(od,{showWaitingUi:Je,latestExecution:Se})})]})}function yt(L,U){let kt=parseFloat(L)/Math.pow(10,U);return kt===0?"0.00":kt>=1?kt.toFixed(2):parseFloat(kt.toPrecision(6)).toString()}function gt(L,U){let kt={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return L==="n1"?"N1":L==="cardano"?"Cardano":kt[U]??`${L.charAt(0).toUpperCase()+L.slice(1)} (${U})`}function De(L){if(!L)return "";let U=L.indexOf(".");return U!==-1?L.slice(0,U).toUpperCase()+L.slice(U):L.toUpperCase()}function at(L){return L.length<=12?L:`${L.slice(0,6)}...${L.slice(-4)}`}function X(L){if(!L)return "";try{return new Date(L).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Pe(L){let U=L.destination_amount_base_unit;return U?yt(U,L.destination_token_metadata?.decimals??6):"\u2014"}function _(L){let U=L.destination_token_metadata;return U?U.icon_urls?.length?ui(U.icon_urls,"png")??U.icon_url??null:U.icon_url??null:null}function C(){if(!Se)return null;let L=_(Se);return jsxRuntime.jsx(reactNative.View,{style:mt.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:mt.centeredContent,children:[jsxRuntime.jsx(Ct,{size:84,strokeWidth:4,iconSize:48,children:L?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(L)},style:mt.loaderIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[mt.loaderIcon,{backgroundColor:d.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[mt.stateTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Deposit Processing"}),jsxRuntime.jsx(reactNative.Text,{style:[mt.stateDescription,{color:d.foregroundMuted,fontFamily:f.regular}],children:"This usually takes less than a minute."})]})})}function M(){if(!Se)return C();let L=Se,U=["pending","waiting","delayed"].includes(L.status),kt=_(L),Le=X(L.created_at);return jsxRuntime.jsxs(reactNative.View,{style:mt.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:mt.flex,contentContainerStyle:mt.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:mt.tokenIconWrapper,children:[kt?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(kt)},style:mt.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[mt.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[mt.statusBadge,{backgroundColor:U?d.warning:S.container.iconBackgroundColor}],children:U?jsxRuntime.jsx(reactNative.Text,{style:mt.statusBadgeText,children:"\u21BB"}):jsxRuntime.jsx(It,{size:14,color:S.container.iconColor,strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.statusDot,{backgroundColor:U?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[mt.statusText,{color:d.foreground,fontFamily:f.semibold}],children:U?"In Progress":"Completed"})]}),Le?jsxRuntime.jsx(reactNative.Text,{style:[mt.dateText,{color:d.foregroundMuted,fontFamily:f.regular}],children:Le}):null,jsxRuntime.jsxs(reactNative.View,{style:[mt.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[L.source_amount_usd?jsxRuntime.jsxs(reactNative.View,{style:mt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:["$",parseFloat(L.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxRuntime.jsxs(reactNative.View,{style:mt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:[Pe(L)," ",De(L.destination_currency)]})]}),L.source_chain_id?jsxRuntime.jsxs(reactNative.View,{style:mt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[mt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:gt(L.source_chain_type??"",L.source_chain_id)})]}):null,L.destination_chain_id?jsxRuntime.jsxs(reactNative.View,{style:mt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[mt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:gt(L.destination_chain_type??"",L.destination_chain_id)})]}):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:mt.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),me(Fe=>!Fe);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.seeMoreText,{color:d.foreground,fontFamily:f.medium}],children:Ue?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[mt.seeMoreChevron,{color:d.foregroundMuted}],children:Ue?"\u25B2":"\u25BC"})]}),Ue&&jsxRuntime.jsxs(reactNative.View,{style:mt.txHashSection,children:[L.explorer_url?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[mt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(L.explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:mt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.txHash,{color:d.foregroundMuted}],children:at(L.transaction_hash)}),jsxRuntime.jsx(reactNative.Text,{style:[mt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!U&&L.destination_explorer_url&&L.destination_transaction_hashes?.[0]?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[mt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(L.destination_explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:mt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.txHash,{color:d.foregroundMuted}],children:at(L.destination_transaction_hashes[0])}),jsxRuntime.jsx(reactNative.Text,{style:[mt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsxRuntime.jsx(reactNative.View,{style:mt.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Dt.primaryButton,{backgroundColor:d.primary,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],onPress:a,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Dt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.medium}],children:"Done"})})})]})}function q(){return jsxRuntime.jsxs(reactNative.View,{style:Dt.centeredContainer,children:[jsxRuntime.jsx(gs,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:ae||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Vt,activeOpacity:.8,style:[Dt.primaryButton,{backgroundColor:d.primary,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Dt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function J(){switch(v){case "selectWallet":return Ht();case "selectNetwork":return lt();case "connecting":return er();case "waitingForDeposit":return Xe();case "depositProcessing":return C();case "depositComplete":return M();case "failed":return q()}}let K=v==="selectWallet"||v==="selectNetwork"||v==="failed",_e=v==="selectNetwork"?A?.name??"Select Network":v==="depositProcessing"?"Deposit Processing":v==="depositComplete"?"Deposit Summary":"Connect Wallet";function et(){v==="selectNetwork"?(w.current=false,O(null),B(null),N(null),I("selectWallet")):s();}return jsxRuntime.jsxs(reactNative.View,{style:Dt.container,children:[jsxRuntime.jsx(fo,{title:_e,showBack:K,onBack:et,onClose:a}),J()]})}var Dt=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}}),mt=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 Zi=7,Ji=4,El=4;function Tx(e,t,r){return e<Zi&&t<Zi||e<Zi&&t>=r-Zi||e>=r-Zi&&t<Zi}function js({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:i,badgeSize:s=20}){let{isDark:a}=z(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,g=ta.useMemo(()=>{try{return Sx__default.default(e||"placeholder","H")}catch{return null}},[e]),k=g?g.length:0,d=k?(t-Ji*2)/k:0,f=d*.38,S=o+12,h=S/2+4,w=t/2,v=t/2,I=k?[{x:Ji,y:Ji},{x:Ji+(k-Zi)*d,y:Ji},{x:Ji,y:Ji+(k-Zi)*d}]:[],x=Zi*d,P=5*d,m=d,u=3*d,T=2*d;return jsxRuntime.jsxs(reactNative.View,{style:[dm.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Ir__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Ir.Rect,{x:0,y:0,width:t,height:t,fill:l}),g?.map((b,A)=>b.map((O,F)=>{if(!O||Tx(A,F,k))return null;let B=Ji+F*d+d/2,W=Ji+A*d+d/2;if(r){let N=B-w,Z=W-v;if(Math.sqrt(N*N+Z*Z)<h)return null}return jsxRuntime.jsx(Ir.Circle,{cx:B,cy:W,r:f,fill:c},`${A}-${F}`)})),I.map((b,A)=>jsxRuntime.jsxs(ta__namespace.default.Fragment,{children:[jsxRuntime.jsx(Ir.Rect,{x:b.x,y:b.y,width:x,height:x,rx:El,ry:El,fill:c}),jsxRuntime.jsx(Ir.Rect,{x:b.x+m,y:b.y+m,width:P,height:P,rx:El-1,ry:El-1,fill:l}),jsxRuntime.jsx(Ir.Rect,{x:b.x+T,y:b.y+T,width:u,height:u,rx:El-1.5,ry:El-1.5,fill:c})]},`finder-${A}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[dm.logoContainer,{width:S,height:S,top:v-S/2,left:w-S/2,backgroundColor:p,borderRadius:S/2}],children:[jsxRuntime.jsx(en,{uri:r,width:o,height:o,borderRadius:o/2}),i&&jsxRuntime.jsx(reactNative.View,{style:[dm.badgeContainer,{width:s+4,height:s+4,borderRadius:(s+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(en,{uri:i,width:s,height:s,borderRadius:s/2})})]})]})}var dm=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 Rx=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ml=(e,t)=>`${t}:${e}`,Ix=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Nu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:k,onDepositError:d,onLatestExecution:f,onShowStatusSheet:S,onSelectedTokenIconUrl:h,borderTopLeftRadius:w,borderTopRightRadius:v,sheetBorderRadius:I}){let{colors:x,fonts:P,components:m}=z(),u=a&&l?`${a}:${l}`:"solana:mainnet",[T,b]=ta.useState("USDC"),[A,O]=ta.useState(u),[F,B]=ta.useState([]),[W,N]=ta.useState(true),[Z,je]=ta.useState([]),[Y,rt]=ta.useState(true),[oe,ce]=ta.useState(false),[ae,te]=ta.useState(false),[ke,j]=ta.useState(false),[Ie,pt]=ta.useState(false),[Ge,Se]=ta.useState([]),[qe,ot]=ta.useState(new Map),[Ye]=ta.useState(()=>new Date),[dt,st]=ta.useState(null),[Me,be]=ta.useState(false),[we,ze]=ta.useState(null),[ut,ht]=ta.useState(false);ta.useEffect(()=>{we&&f?.(we);},[we]),ta.useEffect(()=>{Me&&(S?.(true),be(false));},[Me]);let xt=new Map;Z.forEach(_=>{_.chains.forEach(C=>{let M=`${C.chain_type}:${C.chain_id}`;xt.has(M)||xt.set(M,C);});});let lr=Array.from(xt.values()),Ue=Ix(A),Je=lr.find(_=>_.chain_type===Ue.chainType&&_.chain_id===Ue.chainId)?.chain_type||"ethereum",Qe=an(F,Je),Ve=Qe?.address||"",he=ta.useRef(false);ta.useEffect(()=>{async function _(){try{rt(!0),st(null);let M=await Wi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(je(M.data),M.data.length>0&&!he.current){he.current=!0;let q,J;if(a&&l)if(c)for(let K of M.data){let _e=K.chains.find(et=>et.chain_type===a&&et.chain_id===l&&et.token_address.toLowerCase()===c.toLowerCase());if(_e){q=K,J=_e;break}}else {let K=et=>et.chain_type===a&&et.chain_id===l,_e=M.data.find(et=>et.symbol==="USDC"&&et.chains.some(K));if(_e)q=_e,J=_e.chains.find(K);else for(let et of M.data){let L=et.chains.find(K);if(L){q=et,J=L;break}}}if(!q&&i)for(let K of M.data){let _e=K.chains.find(et=>et.token_address.toLowerCase()===i.toLowerCase());if(_e){q=K,J=_e;break}}q||(q=M.data.find(K=>K.symbol==="USDC"),q&&q.chains.length>0&&(J=q.chains[0])),q||(q=M.data.find(K=>K.symbol==="USDT"),q&&q.chains.length>0&&(J=q.chains[0])),q||(q=M.data[0],q.chains.length>0&&(J=q.chains[0])),q&&b(q.symbol),J&&O(Ml(J.chain_id,J.chain_type));}}catch(C){console.error("Error fetching supported tokens:",C),st("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:C});}finally{rt(false);}}_();},[t,d,a,l,c,i,n,o]),ta.useEffect(()=>{async function _(){try{N(!0),st(null);let C=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);B(C.data);}catch(C){console.error("Error fetching wallets:",C),st("Failed to load wallets"),d?.({message:"Failed to load wallets",error:C});}finally{N(false);}}_();},[e,r,o,n,i,t,d]);let Ne=Qe?.id??"",{showWaitingUi:vt,handleIveDeposited:Vt}=si({depositConfirmationMode:p,depositAddress:Ve,chain:A,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Ne,depositExecutions:Ge,trackedExecutions:qe,setDepositExecutions:Se,setTrackedExecutions:ot,setLatestExecution:ze,setShowStatusSheet:be,onDepositSuccess:k,onExecutionsChange:g,onDepositError:d});ta.useEffect(()=>{if(!Z.length)return;let _=Z.find(M=>M.symbol===T);if(!_||_.chains.length===0){let M=Z.find(q=>q.symbol==="USDC")||Z[0];M&&(b(M.symbol),M.chains.length>0&&O(Ml(M.chains[0].chain_id,M.chains[0].chain_type)));return}if(!_.chains.some(M=>Ml(M.chain_id,M.chain_type)===A)){let M=_.chains[0];O(Ml(M.chain_id,M.chain_type));}},[T,Z,A]);let Ht=Z.find(_=>_.symbol===T),lt=it(Ht,"png")||void 0;ta.useEffect(()=>{h?.(lt);},[lt]);let er=Ht?.chains||[],Xe=er.find(_=>Ml(_.chain_id,_.chain_type)===A),yt=async()=>{if(Ve)try{reactNative.Clipboard.setString(Ve),ce(!0),setTimeout(()=>ce(!1),2e3);}catch(_){console.error("Failed to copy:",_);}},gt=Xe?.estimated_price_impact_percent??0,De=Xe?.max_slippage_percent??.25,at=Xe?.minimum_deposit_amount_usd??3;if(Y)return jsxRuntime.jsxs(reactNative.View,{style:re.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:x.primary}),jsxRuntime.jsx(reactNative.Text,{style:[re.loadingText,{color:x.foregroundMuted,fontFamily:P.regular}],children:"Loading currencies..."})]});if(dt&&Z.length===0)return jsxRuntime.jsxs(reactNative.View,{style:re.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.errorText,{color:x.error,fontFamily:P.regular}],children:dt}),jsxRuntime.jsx(reactNative.Text,{style:[re.errorHint,{color:x.foregroundMuted,fontFamily:P.regular}],children:"Please check your network connection and try again."})]});let X=()=>jsxRuntime.jsxs(rr,{visible:ke,onClose:()=>j(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:I?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:I?.tokenSelector?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:m.header.titleColor,fontFamily:P.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>j(false),style:re.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Yt,{style:re.sheetList,contentContainerStyle:re.sheetListContent,showsVerticalScrollIndicator:false,children:Z.map(_=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{b(_.symbol),j(false);},activeOpacity:.7,style:[re.sheetItem,{backgroundColor:T===_.symbol?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(_,"png"))},style:re.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:re.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.sheetItemTitle,{color:m.card.titleColor,fontFamily:P.medium}],children:_.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[re.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:P.regular}],children:[_.chains.length," network",_.chains.length!==1?"s":""," available"]})]}),T===_.symbol&&jsxRuntime.jsx(It,{size:20,color:x.primary,strokeWidth:2})]},_.symbol))})]}),Pe=()=>jsxRuntime.jsxs(rr,{visible:Ie,onClose:()=>pt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:I?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:I?.chainSelector?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:m.header.titleColor,fontFamily:P.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>pt(false),style:re.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Yt,{style:re.sheetList,contentContainerStyle:re.sheetListContent,showsVerticalScrollIndicator:false,children:er.map(_=>{let C=Ml(_.chain_id,_.chain_type),M=A===C;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{O(C),pt(false);},activeOpacity:.7,style:[re.sheetItem,{backgroundColor:M?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(_,"png"))},style:re.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:re.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.sheetItemTitle,{color:m.card.titleColor,fontFamily:P.medium}],children:_.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[re.sheetItemSubtitle,{fontFamily:P.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:m.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:x.warning},children:["$",_.minimum_deposit_amount_usd]})]})]}),M&&jsxRuntime.jsx(It,{size:20,color:x.primary,strokeWidth:2})]},C)})})]});return jsxRuntime.jsxs(reactNative.View,{style:re.container,children:[jsxRuntime.jsxs(reactNative.View,{style:re.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.selectorLabel,{color:m.card.labelColor,fontFamily:P.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>j(true),style:[re.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Ht&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(Ht,"png"))},style:re.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[re.selectorText,{color:m.card.titleColor,fontFamily:P.medium}],children:T}),jsxRuntime.jsx(Ar,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:re.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[re.selectorLabel,{color:m.card.labelColor,fontFamily:P.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[re.minDeposit,{color:x.warning,fontFamily:P.regular}],children:["($",at," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>pt(true),style:[re.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Xe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(Xe,"png"))},style:re.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[re.selectorText,{color:m.card.titleColor,fontFamily:P.medium}],numberOfLines:1,children:Xe?.chain_name||"Select network"}),jsxRuntime.jsx(Ar,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.intentAddressLabel,{color:x.foregroundMuted,fontFamily:P.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:re.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[re.qrWrapper,{backgroundColor:x.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:W?jsxRuntime.jsxs(reactNative.View,{style:re.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primary}),jsxRuntime.jsx(reactNative.Text,{style:[re.loadingText,{color:x.foregroundMuted,fontFamily:P.regular}],children:"Loading..."})]}):Ve?jsxRuntime.jsx(js,{value:Ve,size:160,logoUri:ye(it(Xe,"png")||kr("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:re.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[re.errorText,{color:x.error,fontFamily:P.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:yt,disabled:W||!Ve,style:re.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.addressTruncated,{color:x.foregroundMuted,fontFamily:P.regular}],numberOfLines:1,children:W?"Loading...":Ve?Rx(Ve):"No address"}),oe?jsxRuntime.jsx(It,{size:16,color:x.success,strokeWidth:2}):jsxRuntime.jsx(Gn,{size:16,color:x.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(od,{showWaitingUi:vt,latestExecution:we}),jsxRuntime.jsxs(reactNative.View,{style:[re.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(!ae),style:re.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx($o,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:P.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:re.chevronContainer,children:ae?jsxRuntime.jsx(di,{size:16,color:m.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ar,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),ae&&jsxRuntime.jsxs(reactNative.View,{style:re.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:P.regular}],children:["Price impact: ",gt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:P.regular}],children:["Slippage: Auto \u2022 ",De.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:P.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:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.detailsLabel,{color:x.primary,fontFamily:P.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(im,{depositConfirmationMode:p,depositAddress:Ve,showWaitingUi:vt,onIveDeposited:Vt}),X(),Pe(),jsxRuntime.jsxs(rr,{visible:ut,onClose:()=>ht(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:I?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:I?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:m.header.titleColor,fontFamily:P.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(false),style:re.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[re.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardTitle,{color:m.card.titleColor,fontFamily:P.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[re.infoCardValue,{color:m.card.titleColor,fontFamily:P.medium}],children:[gt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardDescription,{color:m.card.descriptionColor,fontFamily:P.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[re.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[re.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardTitle,{color:m.card.titleColor,fontFamily:P.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[re.infoCardValue,{color:m.card.titleColor,fontFamily:P.medium}],children:[De.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardDescription,{color:m.card.descriptionColor,fontFamily:P.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var re=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 Hu({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=z();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ia.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ia.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ia.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(e,"png"))},style:Ia.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ia.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ia.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ia.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(It,{size:16,color:o.primary,strokeWidth:2})]})}var Ia=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 id({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=z();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:db.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[db.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(Hu,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var db=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function ju({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=z(),[g,k]=ta.useState(""),d=o.map(x=>r.find(P=>P.currency_code.toLowerCase()===x.toLowerCase())).filter(x=>x!==void 0),f=r.filter(x=>!o.includes(x.currency_code.toLowerCase())),S=x=>{if(!g)return x;let P=g.toLowerCase();return x.filter(m=>m.name.toLowerCase().includes(P)||m.currency_code.toLowerCase().includes(P))},h=S(d),w=S(f),v=x=>{i(x),t(false),k("");},I=()=>{t(false),k("");};return jsxRuntime.jsxs(rr,{visible:e,onClose:I,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(fo,{title:"Currency",showBack:false,onClose:I}),jsxRuntime.jsx(reactNative.View,{style:Pa.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pa.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:k,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(Yt,{style:Pa.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Pa.listContent,children:[jsxRuntime.jsx(id,{title:"Popular currencies",currencies:h,selectedCurrency:n,onSelect:v}),h.length>0&&w.length>0&&jsxRuntime.jsx(reactNative.View,{style:Pa.sectionSpacer}),jsxRuntime.jsx(id,{title:"All currencies",currencies:w,selectedCurrency:n,onSelect:v}),h.length===0&&w.length===0&&jsxRuntime.jsx(reactNative.View,{style:Pa.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Pa.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Pa=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 hm(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 Ku({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:g,onLatestExecution:k,onShowStatusSheet:d,onSelectedTokenIconUrl:f,borderTopLeftRadius:S,borderTopRightRadius:h,sheetBorderRadius:w}){let{colors:v,fonts:I,components:x}=z(),[P,m]=ta.useState(""),[u,T]=ta.useState("usd"),[b,A]=ta.useState(false),[O,F]=ta.useState(false),[B,W]=ta.useState([]),[N,Z]=ta.useState(false),[je,Y]=ta.useState(null),[rt,oe]=ta.useState(null),[ce,ae]=ta.useState("amount"),[te,ke]=ta.useState(null),[j,Ie]=ta.useState(true),[pt,Ge]=ta.useState(null),[Se,qe]=ta.useState(false),ot=ta.useRef(null),Ye=ta.useRef(false);ta.useEffect(()=>{ot.current=te;},[te]),ta.useEffect(()=>{Ye.current=Se;},[Se]);let[dt,st]=ta.useState([]),[Me,be]=ta.useState(true),[we,ze]=ta.useState(60),[ut,ht]=ta.useState([]),[xt,lr]=ta.useState([]),[Ue,me]=ta.useState(null),[Je,Qe]=ta.useState(null),[Ve,he]=ta.useState(true),[Ne,vt]=ta.useState(null),[Vt,Ht]=ta.useState(false),[lt,er]=ta.useState(null),[Xe,yt]=ta.useState(false),[gt,De]=ta.useState(false),[at,X]=ta.useState(false),[Pe,_]=ta.useState(null),C=r??ce,M=ta.useRef(null),q=ut.find(ne=>ne.currency_code.toLowerCase()===u.toLowerCase()),J=ta.useCallback(ne=>{ae(ne),ne==="quotes"?o?.(ne,B.length):o?.(ne);},[B.length,o]);ta.useEffect(()=>{async function ne(){try{let ue=await aa();Qe(ue);}catch(ue){console.error("Error fetching user IP:",ue);}finally{he(false);}}ne();},[]),ta.useEffect(()=>{async function ne(){try{let ue=await Zo({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);st(ue.data);}catch(ue){console.error("Error fetching wallets:",ue),Y("Failed to load wallet addresses");}finally{be(false);}}ne();},[e,i,s,a,l,t]);let K=n||Ue?.symbol.toUpperCase()||"USDC",_e=ui(Ue?.icon_urls,"png")||Ue?.icon_url,et=ui(Ue?.chain_icon_urls,"png")||Ue?.chain_icon_url,[L,U]=ta.useState([]),[kt,Le]=ta.useState(new Map),[Fe]=ta.useState(()=>new Date),[bt,nt]=ta.useState(null),[ee,vr]=ta.useState(false),[ft,tr]=ta.useState(null);ta.useEffect(()=>{C==="onramp"&&!ft&&tr(new Date);},[C,ft]);let Mt=Ne?.destination_token_metadata?.chain_type||s||"ethereum",qr=Ne?.destination_token_metadata?.chain_id||a||"",Mr=`${Mt}:${qr}`,li=an(dt,Mt),on=li?.address||"",yo=li?.id??"";ta.useEffect(()=>{bt&&k?.(bt);},[bt]),ta.useEffect(()=>{ee&&(d?.(true),vr(false));},[ee]),ta.useEffect(()=>{f?.(_e||void 0);},[_e]),ta.useEffect(()=>{g?.(L);},[L]),si({depositConfirmationMode:"auto_silent",enabled:C==="onramp",depositAddress:on,chain:Mr,externalUserId:e,publishableKey:t,modalOpenedAt:ft??Fe,depositWalletId:yo,depositExecutions:L,trackedExecutions:kt,setDepositExecutions:U,setTrackedExecutions:Le,setLatestExecution:nt,setShowStatusSheet:vr,onDepositSuccess:c,onExecutionsChange:g,onDepositError:p}),ta.useEffect(()=>{async function ne(){try{let ue=await bc(t);ht(ue.data),lr(ue.preferred||[]);}catch(ue){console.error("Error fetching fiat currencies:",ue);}}ne();},[t]),ta.useEffect(()=>{if(b||ut.length===0||!Je?.alpha2)return;let ne=Je.alpha2.toUpperCase(),ue=ut.find(zt=>zt.country_codes.includes(ne));if(ue)T(ue.currency_code.toLowerCase()),!P&&!O&&m(String(ue.default_amount??100));else if(!P&&!O){let zt=ut.find(ur=>ur.currency_code.toLowerCase()==="usd");zt&&m(String(zt.default_amount??100));}},[ut,Je,b,P,O]),ta.useEffect(()=>{if(ut.length!==0){if(M.current!==null&&M.current!==u){let ne=ut.find(ue=>ue.currency_code.toLowerCase()===u.toLowerCase());ne&&m(String(ne.default_amount??100));}M.current=u;}},[u,ut]),ta.useEffect(()=>{async function ne(){try{let ue=await Np({chain_type:s||"",chain_id:a||"",token_address:l||""},t);me(ue);}catch(ue){console.error("Error fetching supported tokens:",ue);}}ne();},[s,a,l,t]),ta.useEffect(()=>{async function ne(){if(!(!l||!a||!s)&&!Ve){Ht(true);try{let ue=await yc({country_code:Je?.alpha2?.toUpperCase()||"US",subdivision_code:Je?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);vt(ue);}catch(ue){console.error("Error fetching default onramp token:",ue);}finally{Ht(false);}}}ne();},[l,a,s,Je,Ve,t]),ta.useEffect(()=>{let ne=parseFloat(P);if(isNaN(ne)||ne<=0){W([]),oe(null);return}if(!Ne||Vt){W([]),ke(null);return}let ue=ut.find(ur=>ur.currency_code.toLowerCase()===u.toLowerCase());if(ue){if(ne<ue.minimum_amount){W([]),ke(null),oe(`Minimum amount is ${hm(u)}${ue.minimum_amount.toLocaleString()}`);return}if(ne>ue.maximum_amount){W([]),ke(null),oe(`Maximum amount is ${hm(u)}${ue.maximum_amount.toLocaleString()}`);return}}oe(null);let zt=setTimeout(()=>{Bo(ne);},500);return ()=>clearTimeout(zt)},[P,u,t,Ne,Vt,ut]);let Bo=async ne=>{if(!Ne){Y("Loading token information...");return}Z(true),Y(null);try{let ue={country_code:Je?.alpha2?.toUpperCase()||"US",source_amount:ne.toString(),source_currency:u.toLowerCase(),destination_currency:Ne.destination_currency,destination_network:Ne.destination_network,subdivision_code:Je?.state||void 0},zt=await Hp(ue,t);W(zt.data);let ur=Ye.current,Go=ot.current;if(ur&&Go){let sn=zt.data.find(D=>D.service_provider===Go.service_provider);if(sn){if(ke(sn),zt.data.length>0){let D=zt.data[0];pt||Ge(D.service_provider),Ie(sn.service_provider===pt);}}else if(zt.data.length>0){let D=zt.data[0];ke(D),Ge(D.service_provider),Ie(!0),qe(!1);}}else if(zt.data.length>0){let sn=zt.data[0];ke(sn),Ge(sn.service_provider),Ie(!0);}ze(60);}catch(ue){console.error("Failed to fetch quotes:",ue),Y("Failed to fetch quotes. Please try again."),W([]);}finally{Z(false);}};ta.useEffect(()=>{if(B.length===0)return;let ne=setInterval(()=>{ze(ue=>{if(ue<=1){let zt=parseFloat(P);return !isNaN(zt)&&zt>0&&Bo(zt),60}return ue-1});},1e3);return ()=>clearInterval(ne)},[B.length,P]);let nn=ne=>{(/^\d*\.?\d{0,2}$/.test(ne)||ne==="")&&(m(ne),F(true));},ko=ne=>{m(ne.toString()),F(true);},na=async()=>{if(te&&Ne)try{let ne=Ne.destination_token_metadata.chain_type,ue=an(dt,ne);if(!ue?.address){Y("Wallet address not available");return}let zt={service_provider:te.service_provider,country_code:te.country_code?.toUpperCase()||Je?.alpha2?.toUpperCase()||"US",source_currency:te.source_currency,source_amount:P,destination_currency:te.destination_currency,destination_network:te.destination_network,wallet_address:ue.address,subdivision_code:Je?.state||void 0},ur=await $p(zt,t);er({provider:te,sourceCurrency:u,sourceAmount:P,sessionUrl:ur.url}),_(ur.url),X(!0);}catch(ne){console.error("Failed to create session:",ne),Y("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:ne});}},bo=hm(u),Lt=()=>{X(false),J("onramp"),c?.({message:"Payment flow completed"});},Qr=()=>jsxRuntime.jsx(Nx,{visible:at,onClose:Lt,url:Pe,providerName:te?.service_provider_display_name||"Complete Payment",colors:v,fonts:I,borderTopLeftRadius:w?.webView?.borderTopLeftRadius??S,borderTopRightRadius:w?.webView?.borderTopRightRadius??h});return C==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:xe.amountViewContainer,children:[jsxRuntime.jsxs(Yt,{style:xe.scrollContainer,contentContainerStyle:xe.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:xe.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(true),style:[xe.currencyButton,{backgroundColor:x.card.backgroundColor,borderRadius:x.input.borderRadius,borderWidth:x.input.borderWidth,borderColor:x.input.borderColor}],children:[q&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(q,"png"))},style:xe.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[xe.currencyText,{color:x.card.titleColor,fontFamily:I.medium}],children:u.toUpperCase()}),jsxRuntime.jsx(Ar,{size:16,color:x.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(ju,{open:Xe,onOpenChange:yt,currencies:ut,preferredCurrencyCodes:xt,selectedCurrency:u,onSelectCurrency:ne=>{T(ne.toLowerCase()),A(true);},borderTopLeftRadius:w?.currencyModal?.borderTopLeftRadius??S,borderTopRightRadius:w?.currencyModal?.borderTopRightRadius??h}),jsxRuntime.jsx(reactNative.View,{style:xe.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:xe.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.currencySymbol,{color:x.container.titleColor,fontFamily:I.medium}],children:bo}),jsxRuntime.jsx(reactNative.TextInput,{style:[xe.amountInput,{color:x.container.titleColor,fontFamily:I.medium}],value:P,onChangeText:nn,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:v.foregroundMuted})]})}),q?.suggested_amounts&&q.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:xe.quickAmounts,children:q.suggested_amounts.map(ne=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ko(ne),style:[xe.quickAmountButton,{backgroundColor:x.card.backgroundColor,borderRadius:x.button.borderRadius,borderWidth:parseFloat(P)===ne?2:x.button.borderWidth,borderColor:parseFloat(P)===ne?v.primary:x.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[xe.quickAmountText,{color:x.card.titleColor,fontFamily:I.medium}],children:[bo,ne.toLocaleString()]})},ne))}),rt&&jsxRuntime.jsx(reactNative.Text,{style:[xe.validationError,{color:v.error,fontFamily:I.regular}],children:rt}),jsxRuntime.jsxs(reactNative.View,{style:xe.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.providerLabel,{color:x.card.labelColor,fontFamily:I.medium}],children:"Provider"}),B.length>0&&!N&&jsxRuntime.jsxs(reactNative.Text,{style:[xe.refreshText,{color:x.card.labelRightColor,fontFamily:I.regular}],children:["Refreshing in ",we,"s"]})]}),jsxRuntime.jsx(jr,{cardTokens:x.depositCard.quoteProvider.card,onPress:N||B.length===0?void 0:()=>De(true),contentStyle:reactNative.StyleSheet.flatten([xe.providerButton,(N||B.length===0)&&xe.disabled]),children:N?jsxRuntime.jsxs(reactNative.View,{style:xe.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:v.primary}),jsxRuntime.jsx(reactNative.Text,{style:[xe.loadingText,{color:x.container.subtitleColor,fontFamily:I.regular}],children:"Finding best rates..."})]}):te?jsxRuntime.jsxs(reactNative.View,{style:xe.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.providerInfo,children:[j&&jsxRuntime.jsx(reactNative.Text,{style:[xe.autoPickedText,{color:x.container.subtitleColor,fontFamily:I.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:xe.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(Ld(te.icon_urls,"png",te.icon_url))},style:xe.providerIconImage},`provider-${te.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.providerName,{color:x.card.titleColor,fontFamily:I.medium}],children:te.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.bestPriceText,{color:x.container.subtitleColor,fontFamily:I.regular}],children:[te.destination_amount.toFixed(2)," ",K]})]})]})]}),jsxRuntime.jsx(co,{size:20,color:x.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[xe.noProviderText,{color:x.container.subtitleColor,fontFamily:I.regular}],children:parseFloat(P)>0?"No providers available":"Enter an amount to see providers"})}),je&&jsxRuntime.jsx(reactNative.Text,{style:[xe.errorText,{color:v.error,fontFamily:I.regular}],children:je})]}),jsxRuntime.jsxs(rr,{visible:gt,onClose:()=>De(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:w?.providerModal?.borderTopLeftRadius??S,borderTopRightRadius:w?.providerModal?.borderTopRightRadius??h,children:[jsxRuntime.jsx(fo,{title:"Select Provider",showBack:false,onClose:()=>De(false)}),jsxRuntime.jsx(Yt,{style:xe.providerModalList,contentContainerStyle:xe.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:xe.quotesList,children:B.map(ne=>{let ue=te?.service_provider===ne.service_provider;return jsxRuntime.jsxs(jr,{cardTokens:x.depositCard.quoteProvider.card,onPress:()=>{ke(ne),qe(true),Ie(ne.service_provider===pt),De(false);},contentStyle:reactNative.StyleSheet.flatten([xe.quoteItem,ue&&{borderWidth:2,borderColor:v.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:xe.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(Ld(ne.icon_urls,"png",ne.icon_url))},style:xe.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[xe.quoteName,{color:x.card.titleColor,fontFamily:I.medium}],children:ne.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:xe.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[xe.quoteAmount,{color:x.card.textRightColor,fontFamily:I.medium}],children:[ne.destination_amount.toFixed(2)," ",K]}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.quoteSource,{color:x.card.subtextRightColor,fontFamily:I.regular}],children:["Fee: ",bo,ne.total_fee.toFixed(2)]})]})]},ne.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.continueButtonContainer,{backgroundColor:v.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:N||Me||!te||parseFloat(P)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:na,disabled:N||Me||!te||parseFloat(P)<=0,style:[xe.continueButton,{backgroundColor:x.container.buttonColor,borderRadius:x.button.borderRadius,borderWidth:x.button.borderWidth,borderColor:x.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[xe.continueButtonText,{color:x.container.buttonTitleColor,fontFamily:I.medium}],children:Me?"Loading...":"Continue"})})})})]}),Qr()]}):C==="onramp"&<?jsxRuntime.jsxs(reactNative.View,{style:xe.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(Ld(lt.provider.icon_urls,"png",lt.provider.icon_url))},style:xe.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.onrampTitle,{color:x.container.titleColor,fontFamily:I.medium}],children:["Complete transaction with ",lt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.onrampSubtitle,{color:x.container.subtitleColor,fontFamily:I.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[xe.flowDiagram,{backgroundColor:x.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xe.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:kr(`/icons/currencies/png/${lt.sourceCurrency.toLowerCase()}.png`)},style:xe.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[xe.flowLabel,{color:x.card.subtitleColor,fontFamily:I.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.flowValue,{color:x.card.titleColor,fontFamily:I.medium}],children:lt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(co,{size:16,color:x.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:xe.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ui(Ne?.destination_token_metadata?.icon_urls,"png")||Ne?.destination_token_metadata?.icon_url||kr("/icons/tokens/png/usdc.png")},style:xe.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ui(Ne?.destination_token_metadata?.chain?.icon_urls,"png")||Ne?.destination_token_metadata?.chain?.icon_url||kr("/icons/networks/png/polygon.png")},style:[xe.flowNetworkBadge,{borderColor:v.background,borderRadius:x.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.flowLabel,{color:x.card.subtitleColor,fontFamily:I.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.flowValue,{color:x.card.titleColor,fontFamily:I.medium}],children:"USDC"})]}),jsxRuntime.jsx(co,{size:16,color:x.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:xe.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:_e||kr("/icons/tokens/png/usdc.png")},style:xe.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:et||kr("/icons/networks/png/polygon.png")},style:[xe.flowNetworkBadge,{borderColor:v.background,borderRadius:x.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.flowLabel,{color:x.card.subtitleColor,fontFamily:I.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.flowValue,{color:x.card.titleColor,fontFamily:I.medium}],children:K})]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.onrampInfoBox,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[xe.onrampInfoText,{color:x.card.descriptionColor,fontFamily:I.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function Nx({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(rr,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Fa.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Fa.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(It,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Fa.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Fa.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Fa.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Fa.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Fa.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Fa=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"}}),xe=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 qx(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 Qx(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Ju({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=z(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ye(it(e.destination_token_metadata,"png")||kr("/icons/tokens/png/usdc.png")),c=s?"Deposit Processing":"Deposit Completed",p=qx(e.created_at||new Date().toISOString()),g=Qx(e.source_amount_usd);return jsxRuntime.jsxs(jr,{cardTokens:i,onPress:t,contentStyle:ts.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ts.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:ts.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ts.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(It,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ts.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ts.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[ts.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:ts.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ts.amount,{color:i.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(co,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var ts=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 mb(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function hb(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 Gx(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var gb=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function yb(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Yx(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 Jx({count:e=4}){let{colors:t,components:r}=z(),o=ta.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,i=t.cardHover;return ta.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Da.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Da.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.icon,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Da.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.titleBar,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.subtitleBar,{backgroundColor:i,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.amountBar,{backgroundColor:i,opacity:o}]})]},a))})}var Da=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 bm({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:i,fonts:s,components:a}=z(),[l,c]=ta.useState(r),[p,g]=ta.useState(false),[k,d]=ta.useState(null),[f,S]=ta.useState(false),h=ta.useRef(null);ta.useEffect(()=>{if(!e||!o)return;let u=async()=>{g(true);try{let A=[...(await ln(o,n,"deposit")).data].sort((O,F)=>{let B=O.created_at?new Date(O.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-B});c(A);}catch(b){console.error("Failed to fetch executions:",b),c(r);}finally{g(false);}};u();let T=setInterval(u,1e4);return ()=>clearInterval(T)},[e,o,n,r]),ta.useEffect(()=>{r.length>0&&c(u=>{let T=new Set(u.map(A=>A.id)),b=r.filter(A=>!T.has(A.id));return b.length>0?[...b,...u]:u});},[r]),ta.useEffect(()=>{e||d(null);},[e]);let w=u=>{d(u);},v=()=>{d(null),S(false);},I=()=>{d(null),t();},x=()=>{if(!k)return null;let u=k,T=u.status==="pending"||u.status==="waiting"||u.status==="delayed",b=u.status==="succeeded",A=ye(it(u.destination_token_metadata,"png")||kr("/icons/tokens/png/usdc.png")),O=u.provider_metadata?.details,F=O?.currencyIn,B=O?.currencyOut;F?.currency?.symbol||"USDC";B?.currency?.symbol||"USDC";let Z=hb(u.source_amount_base_unit,u.source_token_metadata?.decimals),je=hb(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),Y=Gx(u.source_amount_usd),rt=mb(u.source_chain_type,u.source_chain_id),oe=mb(u.destination_chain_type,u.destination_chain_id),ce=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},ae=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(Yt,{ref:h,style:ct.scrollContainer,contentContainerStyle:ct.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ct.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ct.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:A},style:ct.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ct.statusBadge,{backgroundColor:T?i.warning:i.success,borderColor:i.background}],children:T?jsxRuntime.jsx(Ar,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(It,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ct.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ct.statusDot,{backgroundColor:T?i.warning:i.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ct.statusText,{color:a.container.titleColor,fontFamily:s.semibold}],children:T?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[ct.dateText,{color:a.container.subtitleColor,fontFamily:s.regular}],children:Yx(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[ct.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[Z," ",yb(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ct.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[je," ",yb(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ct.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:Y})]}),jsxRuntime.jsx(reactNative.View,{style:[ct.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:rt})]}),jsxRuntime.jsx(reactNative.View,{style:[ct.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:oe})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let te=!f;S(te),te?setTimeout(()=>{h.current?.scrollToEnd({animated:true});},100):h.current?.scrollTo({y:0,animated:true});},style:ct.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.toggleText,{color:a.container.actionTitle,fontFamily:s.regular}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(di,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ar,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:[ct.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:ce,style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ct.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:gb(u.transaction_hash)}),jsxRuntime.jsx(En,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ct.cardDivider,{backgroundColor:i.border}]})]}),u.destination_explorer_url&&b&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ae,style:ct.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ct.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:gb(u.destination_transaction_hashes[0])}),jsxRuntime.jsx(En,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},P=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:k?"Deposit Details":"Deposit Tracker",onClose:I,showClose:!k,showBack:!!k,onBack:v}),k?x():P?jsxRuntime.jsx(Jx,{}):jsxRuntime.jsx(Yt,{style:ct.scrollContainer,contentContainerStyle:ct.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:ct.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.emptyText,{color:a.container.titleColor,fontFamily:s.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[ct.emptySubtext,{color:a.container.subtitleColor,fontFamily:s.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:ct.executionsList,children:l.map(u=>jsxRuntime.jsx(Ju,{execution:u,onPress:()=>w(u)},u.id))})})]})}var ct=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 sd(e,t=true){let[r,o]=ta.useState(null),[n,i]=ta.useState(null),[s,a]=ta.useState(false),[l,c]=ta.useState(false),[p,g]=ta.useState(null),[k,d]=ta.useState(null);ta.useEffect(()=>{!t||r||(a(true),aa().then(w=>{o(w),g(null);}).catch(w=>{g(w instanceof Error?w:new Error(String(w)));}).finally(()=>{a(false);}));},[t,r]),ta.useEffect(()=>{!t||!e||n||(c(true),wc(e).then(w=>{i(w),d(null);}).catch(w=>{d(w instanceof Error?w:new Error(String(w)));}).finally(()=>{c(false);}));},[t,e,n]);let f=s||l,S=p||k||null,h=null;if(r&&n){let w=n.blocked_country_codes||[],v=r.alpha2.toUpperCase();h=!w.some(I=>I.toUpperCase()===v);}return {isAllowed:h,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:S}}var Sm="unifold_recent_tokens",r1=5,kb=[{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 rp(){try{let e=await Tf__default.default.getItem(Sm);return e?JSON.parse(e):[]}catch{return []}}async function o1(e){try{let r=(await rp()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,r1);await Tf__default.default.setItem(Sm,JSON.stringify(o));}catch{}}async function n1(e){try{let r=(await rp()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Tf__default.default.setItem(Sm,JSON.stringify(r)),r}catch{return []}}function Tm({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:g=true}){let{colors:k,fonts:d,components:f}=z(),[S,h]=ta.useState(""),[w,v]=ta.useState([]);ta.useEffect(()=>{e&&rp().then(v);},[e]),ta.useEffect(()=>{e||h("");},[e]);let I=ta.useMemo(()=>{let b=[];return r.forEach(A=>{A.chains.forEach(O=>{b.push({token:A,chain:O});});}),b},[r]),x=ta.useMemo(()=>{let b=[],A=new Set,O=(F,B,W,N)=>{let Z=`${F}-${B}:${W}`;if(A.has(Z))return;let je=r.find(rt=>rt.symbol===F);if(!je)return;let Y=je.chains.find(rt=>rt.chain_type===B&&rt.chain_id===W);Y&&(A.add(Z),b.push({token:je,chain:Y,isRecent:N}));};return w.forEach(F=>{O(F.symbol,F.chainType,F.chainId,true);}),kb.forEach(F=>{O(F.symbol,F.chainType,F.chainId,false);}),b},[r,w]),P=ta.useMemo(()=>{if(!S.trim())return I;let b=S.toLowerCase();return I.filter(({token:A,chain:O})=>A.symbol.toLowerCase().includes(b)||A.name.toLowerCase().includes(b)||O.chain_name.toLowerCase().includes(b))},[I,S]),m=(b,A,O)=>kb.some(F=>F.symbol===b&&F.chainType===A&&F.chainId===O),u=async(b,A)=>{let O=`${A.chain_type}:${A.chain_id}`;if(!m(b.symbol,A.chain_type,A.chain_id)){await o1({symbol:b.symbol,chainType:A.chain_type,chainId:A.chain_id});let F=await rp();v(F);}h(""),i(b.symbol,O),t();},T=async(b,A)=>{let O=await n1({symbol:b.symbol,chainType:A.chain_type,chainId:A.chain_id});v(O);};return jsxRuntime.jsxs(rr,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:g,heightPercent:p,borderTopLeftRadius:s,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[wr.header,!g&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:wr.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[wr.headerTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:wr.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx($t,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:wr.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[wr.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:d.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:S,onChangeText:h,autoCapitalize:"none",autoCorrect:false})}),!l&&x.length>0&&!S&&jsxRuntime.jsxs(reactNative.View,{style:wr.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:wr.quickSelectScroll,children:x.map(({token:b,chain:A,isRecent:O})=>{let F=`${A.chain_type}:${A.chain_id}`;b.symbol===o&&F===n;return jsxRuntime.jsxs(reactNative.View,{children:[O&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>T(b,A),style:wr.removeButton,children:jsxRuntime.jsx($t,{size:12,color:k.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(b,A),activeOpacity:.7,style:[wr.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:wr.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(b,"png"))},style:wr.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(A,"png"))},style:[wr.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.quickSelectSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[wr.quickSelectChain,{color:f.card.subtitleColor,fontFamily:d.regular}],children:A.chain_name})]})]})]},`quick-${b.symbol}-${F}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[wr.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Yt,{style:wr.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:wr.tokenListContent,children:P.length===0?jsxRuntime.jsx(reactNative.View,{style:wr.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[wr.emptyText,{color:k.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):P.map(({token:b,chain:A})=>{let O=`${A.chain_type}:${A.chain_id}`,F=b.symbol===o&&O===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(b,A),activeOpacity:.7,style:[wr.tokenItem,{backgroundColor:F?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:wr.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(b,"png"))},style:wr.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(A,"png"))},style:[wr.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.tokenSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[wr.tokenChainName,{color:f.card.subtitleColor,fontFamily:d.regular}],children:A.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[wr.minDeposit,{color:f.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",A.minimum_deposit_amount_usd]})]})]},`${b.symbol}-${O}`)})})]})}var wr=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 ad=(e,t)=>`${t}:${e}`,c1=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function km({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:k,onDepositError:d,onLatestExecution:f,onShowStatusSheet:S,onSelectedTokenIconUrl:h,wallets:w,borderTopLeftRadius:v,borderTopRightRadius:I,sheetBorderRadius:x}){let{colors:P,fonts:m,components:u}=z(),T=a&&l?`${a}:${l}`:"solana:mainnet",[b,A]=ta.useState("USDC"),[O,F]=ta.useState(T),[B,W]=ta.useState([]),[N,Z]=ta.useState(!w?.length),je=w?.length?w:B,[Y,rt]=ta.useState([]),[oe,ce]=ta.useState(true),[ae,te]=ta.useState(false),[ke,j]=ta.useState(false),[Ie,pt]=ta.useState(false),[Ge,Se]=ta.useState([]),[qe,ot]=ta.useState(new Map),[Ye]=ta.useState(()=>new Date),[dt,st]=ta.useState(null),[Me,be]=ta.useState(false),[we,ze]=ta.useState(null),[ut,ht]=ta.useState(false);ta.useEffect(()=>{we&&f?.(we);},[we]),ta.useEffect(()=>{Me&&(S?.(true),be(false));},[Me]);let xt=new Map;Y.forEach(X=>{X.chains.forEach(Pe=>{let _=`${Pe.chain_type}:${Pe.chain_id}`;xt.has(_)||xt.set(_,Pe);});});let lr=Array.from(xt.values()),Ue=c1(O),me=lr.find(X=>X.chain_type===Ue.chainType&&X.chain_id===Ue.chainId),Je=me?.chain_type||"ethereum",Qe=an(je,Je),Ve=Qe?.address||"",he=ta.useRef(false);ta.useEffect(()=>{async function X(){try{ce(!0),st(null);let _=await Wi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(rt(_.data),_.data.length>0&&!he.current){he.current=!0;let C,M;if(a&&l)if(c)for(let q of _.data){let J=q.chains.find(K=>K.chain_type===a&&K.chain_id===l&&K.token_address.toLowerCase()===c.toLowerCase());if(J){C=q,M=J;break}}else {let q=K=>K.chain_type===a&&K.chain_id===l,J=_.data.find(K=>K.symbol==="USDC"&&K.chains.some(q));if(J)C=J,M=J.chains.find(q);else for(let K of _.data){let _e=K.chains.find(q);if(_e){C=K,M=_e;break}}}if(!C&&i)for(let q of _.data){let J=q.chains.find(K=>K.token_address.toLowerCase()===i.toLowerCase());if(J){C=q,M=J;break}}C||(C=_.data.find(q=>q.symbol==="USDC"),C&&C.chains.length>0&&(M=C.chains[0])),C||(C=_.data.find(q=>q.symbol==="USDT"),C&&C.chains.length>0&&(M=C.chains[0])),C||(C=_.data[0],C.chains.length>0&&(M=C.chains[0])),C&&A(C.symbol),M&&F(ad(M.chain_id,M.chain_type));}}catch(Pe){console.error("Error fetching supported tokens:",Pe),st("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Pe});}finally{ce(false);}}X();},[t,i,n,o,a,l,c,d]),ta.useEffect(()=>{g&&g(Ge);},[Ge,g]),ta.useEffect(()=>{if(w?.length){Z(false);return}if(B.length>0){Z(false);return}let X=null,Pe=false,_=async()=>{if(!Pe){Z(true);try{let C=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);Pe||(W(C.data),st(null),Z(!1));}catch(C){console.error("Error fetching wallets, retrying in 5s:",C),Pe||(st(C instanceof Error?C.message:"Failed to load wallets"),Z(false),X=setTimeout(_,5e3));}}};return _(),()=>{Pe=true,X&&clearTimeout(X);}},[e,r,o,n,i,t,w,B.length]);let Ne=Qe?.id??"",{showWaitingUi:vt,handleIveDeposited:Vt}=si({depositConfirmationMode:p,depositAddress:Ve,chain:O,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Ne,depositExecutions:Ge,trackedExecutions:qe,setDepositExecutions:Se,setTrackedExecutions:ot,setLatestExecution:ze,setShowStatusSheet:be,onDepositSuccess:k,onExecutionsChange:g,onDepositError:d});ta.useEffect(()=>{if(!Y.length)return;let X=Y.find(_=>_.symbol===b);if(!X||X.chains.length===0){let _=Y.find(C=>C.symbol==="USDC")||Y[0];_&&(A(_.symbol),_.chains.length>0&&F(ad(_.chains[0].chain_id,_.chains[0].chain_type)));return}if(!X.chains.some(_=>ad(_.chain_id,_.chain_type)===O)){let _=X.chains[0];F(ad(_.chain_id,_.chain_type));}},[b,Y,O]);let Ht=Y.find(X=>X.symbol===b),lt=it(Ht,"png")||void 0;ta.useEffect(()=>{h?.(lt);},[lt]);let Xe=(Ht?.chains||[]).find(X=>ad(X.chain_id,X.chain_type)===O),yt=async()=>{if(Ve)try{reactNative.Clipboard.setString(Ve),te(!0),setTimeout(()=>te(!1),2e3);}catch(X){console.error("Failed to copy:",X);}},gt=Xe?.estimated_price_impact_percent??0,De=Xe?.max_slippage_percent??.25,at=Xe?.minimum_deposit_amount_usd??3;return oe?jsxRuntime.jsxs(reactNative.View,{style:Ce.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:P.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.loadingText,{color:P.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):dt&&Y.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ce.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorText,{color:P.error,fontFamily:m.regular}],children:dt}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorHint,{color:P.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Ce.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>pt(true),disabled:oe||Y.length===0,style:[Ce.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:oe?jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingIcon,{backgroundColor:P.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingLine,{backgroundColor:P.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingLine,{backgroundColor:P.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenIconWrapper,children:[Ht&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(Ht,"png"))},style:Ce.tokenMainIcon}),(Xe||me)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(Xe||me,"png"))},style:[Ce.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:Ht?.symbol||b}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:Xe?.chain_name||me?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ce.minDepositText,{color:P.warning,fontFamily:m.medium}],children:["$",at," minimum"]}),jsxRuntime.jsx(co,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Tm,{visible:Ie,onClose:()=>pt(false),tokens:Y,selectedToken:b,selectedChainKey:O,onSelect:(X,Pe)=>{A(X),F(Pe);},borderTopLeftRadius:x?.tokenSelector?.borderTopLeftRadius??v,borderTopRightRadius:x?.tokenSelector?.borderTopRightRadius??I}),jsxRuntime.jsx(reactNative.View,{style:Ce.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Ce.qrWrapper,{backgroundColor:P.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:N?jsxRuntime.jsxs(reactNative.View,{style:Ce.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:P.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.loadingText,{color:P.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):Ve?jsxRuntime.jsx(js,{value:Ve,size:180,logoUri:ye(it(Xe,"png")||kr("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:Ce.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorText,{color:P.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:Ce.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),ae&&jsxRuntime.jsxs(reactNative.View,{style:Ce.copiedIndicator,children:[jsxRuntime.jsx(It,{size:14,color:P.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.copiedText,{color:P.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(jr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!N&&Ve?yt:void 0,contentStyle:Ce.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:N?"Loading...":Ve||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:Ce.addressCopyIcon,children:jsxRuntime.jsx(Gn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ce.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>j(!ke),style:Ce.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx($o,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:Ce.chevronContainer,children:ke?jsxRuntime.jsx(di,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ar,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),ke&&jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",gt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",De.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Zy,{depositConfirmationMode:p,depositAddress:Ve,showWaitingUi:vt,latestExecution:we,onIveDeposited:Vt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:Ce.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.termsText,{color:P.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(rr,{visible:ut,onClose:()=>ht(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:x?.infoSheet?.borderTopLeftRadius??v,borderTopRightRadius:x?.infoSheet?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ce.sheetHeader,{borderBottomColor:P.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(false),style:Ce.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ce.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[gt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ce.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[De.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var Ce=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 Nl=(e,t)=>`${t}:${e}`,m1=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},h1=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function ip({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:k,onDepositError:d,onLatestExecution:f,onShowStatusSheet:S,onSelectedTokenIconUrl:h,onShowInfoSheet:w,onInfoSheetData:v,wallets:I,borderTopLeftRadius:x,borderTopRightRadius:P,sheetBorderRadius:m}){let{colors:u,fonts:T,components:b}=z(),A=a&&l?`${a}:${l}`:"solana:mainnet",[O,F]=ta.useState("USDC"),[B,W]=ta.useState(A),[N,Z]=ta.useState([]),[je,Y]=ta.useState(!I?.length),rt=I?.length?I:N,[oe,ce]=ta.useState([]),[ae,te]=ta.useState(true),[ke,j]=ta.useState(false),[Ie,pt]=ta.useState(false),[Ge,Se]=ta.useState(false),[qe,ot]=ta.useState([]),[Ye,dt]=ta.useState(new Map),[st]=ta.useState(()=>new Date),[Me,be]=ta.useState(null),[we,ze]=ta.useState(false),[ut,ht]=ta.useState(null),[xt,lr]=ta.useState(false),[Ue,me]=ta.useState(false),[Je,Qe]=ta.useState(""),[Ve,he]=ta.useState(""),Ne=ta.useRef(new reactNative.Animated.Value(0)).current;ta.useEffect(()=>{let Fe=reactNative.Animated.loop(reactNative.Animated.timing(Ne,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Fe.start(),()=>Fe.stop()},[Ne]);let vt=Ne.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});ta.useEffect(()=>{ut&&f?.(ut);},[ut]),ta.useEffect(()=>{we&&(S?.(true),ze(false));},[we]);let Vt=new Map;oe.forEach(Fe=>{Fe.chains.forEach(bt=>{let nt=`${bt.chain_type}:${bt.chain_id}`;Vt.has(nt)||Vt.set(nt,bt);});});let Ht=Array.from(Vt.values()),lt=m1(B),er=Ht.find(Fe=>Fe.chain_type===lt.chainType&&Fe.chain_id===lt.chainId),Xe=er?.chain_type||"ethereum",yt=an(rt,Xe),gt=yt?.address||"",De=ta.useRef(false);ta.useEffect(()=>{async function Fe(){try{te(!0),be(null);let nt=await Wi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(ce(nt.data),nt.data.length>0&&!De.current){De.current=!0;let ee,vr;if(a&&l)if(c)for(let ft of nt.data){let tr=ft.chains.find(Mt=>Mt.chain_type===a&&Mt.chain_id===l&&Mt.token_address.toLowerCase()===c.toLowerCase());if(tr){ee=ft,vr=tr;break}}else {let ft=Mt=>Mt.chain_type===a&&Mt.chain_id===l,tr=nt.data.find(Mt=>Mt.symbol==="USDC"&&Mt.chains.some(ft));if(tr)ee=tr,vr=tr.chains.find(ft);else for(let Mt of nt.data){let qr=Mt.chains.find(ft);if(qr){ee=Mt,vr=qr;break}}}if(!ee&&i)for(let ft of nt.data){let tr=ft.chains.find(Mt=>Mt.token_address.toLowerCase()===i.toLowerCase());if(tr){ee=ft,vr=tr;break}}ee||(ee=nt.data.find(ft=>ft.symbol==="USDC"),ee&&ee.chains.length>0&&(vr=ee.chains[0])),ee||(ee=nt.data.find(ft=>ft.symbol==="USDT"),ee&&ee.chains.length>0&&(vr=ee.chains[0])),ee||(ee=nt.data[0],ee.chains.length>0&&(vr=ee.chains[0])),ee&&F(ee.symbol),vr&&W(Nl(vr.chain_id,vr.chain_type));}}catch(bt){console.error("Error fetching supported tokens:",bt),be("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:bt});}finally{te(false);}}Fe();},[t,i,n,o,a,l,c,d]),ta.useEffect(()=>{g&&g(qe);},[qe,g]),ta.useEffect(()=>{if(I?.length){Y(false);return}if(N.length>0){Y(false);return}let Fe=null,bt=false,nt=async()=>{if(!bt){Y(true);try{let ee=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);bt||(Z(ee.data),be(null),Y(!1));}catch(ee){console.error("Error fetching wallets, retrying in 5s:",ee),bt||(be(ee instanceof Error?ee.message:"Failed to load wallets"),Y(false),Fe=setTimeout(nt,5e3));}}};return nt(),()=>{bt=true,Fe&&clearTimeout(Fe);}},[e,r,o,n,i,t,I,N.length]);let at=yt?.id??"",{showWaitingUi:X,handleIveDeposited:Pe}=si({depositConfirmationMode:p,depositAddress:gt,chain:B,externalUserId:e,publishableKey:t,modalOpenedAt:st,depositWalletId:at,depositExecutions:qe,trackedExecutions:Ye,setDepositExecutions:ot,setTrackedExecutions:dt,setLatestExecution:ht,setShowStatusSheet:ze,onDepositSuccess:k,onExecutionsChange:g,onDepositError:d}),_=p==="manual"&>&&!X;ta.useEffect(()=>{if(!oe.length)return;let Fe=oe.find(nt=>nt.symbol===O);if(!Fe||Fe.chains.length===0){let nt=oe.find(ee=>ee.symbol==="USDC")||oe[0];nt&&(F(nt.symbol),nt.chains.length>0&&W(Nl(nt.chains[0].chain_id,nt.chains[0].chain_type)));return}if(!Fe.chains.some(nt=>Nl(nt.chain_id,nt.chain_type)===B)){let nt=Fe.chains[0];W(Nl(nt.chain_id,nt.chain_type));}},[O,oe,B]);let C=oe.find(Fe=>Fe.symbol===O),M=it(C,"png")||void 0;ta.useEffect(()=>{h?.(M);},[M]);let q=C?.chains||[],J=q.find(Fe=>Nl(Fe.chain_id,Fe.chain_type)===B),K=async()=>{if(gt)try{reactNative.Clipboard.setString(gt),j(!0),setTimeout(()=>j(!1),2e3);}catch(Fe){console.error("Failed to copy:",Fe);}},_e=J?.estimated_price_impact_percent??0,et=J?.max_slippage_percent??.25,L=J?.minimum_deposit_amount_usd??3,U=J?.chain_name||er?.chain_name||"Network",kt=ta.useMemo(()=>{if(!Je.trim())return q;let Fe=Je.toLowerCase();return q.filter(bt=>bt.chain_name.toLowerCase().includes(Fe))},[q,Je]),Le=ta.useMemo(()=>{if(!Ve.trim())return oe;let Fe=Ve.toLowerCase();return oe.filter(bt=>bt.symbol.toLowerCase().includes(Fe)||bt.name?.toLowerCase().includes(Fe)||bt.chains.some(nt=>nt.chain_name.toLowerCase().includes(Fe)))},[oe,Ve]);return ae?jsxRuntime.jsxs(reactNative.View,{style:Re.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Re.loadingText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"Loading currencies..."})]}):Me&&oe.length===0?jsxRuntime.jsxs(reactNative.View,{style:Re.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Re.errorText,{color:u.error,fontFamily:T.regular}],children:Me}),jsxRuntime.jsx(reactNative.Text,{style:[Re.errorHint,{color:u.foregroundMuted,fontFamily:T.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Re.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Re.content,children:[jsxRuntime.jsxs(reactNative.View,{style:Re.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Re.intentAddressLabel,{color:u.foregroundMuted,fontFamily:T.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[Re.qrCard,{backgroundColor:u.background,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth>0?b.card.borderWidth:1,borderColor:b.card.borderColor}],children:je?jsxRuntime.jsxs(reactNative.View,{style:Re.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Re.loadingText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"Loading..."})]}):gt?jsxRuntime.jsx(reactNative.View,{style:Re.qrWrapper,children:jsxRuntime.jsx(js,{value:gt,size:200,logoUri:ye(it(C,"png")||kr("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ye(it(J,"png")||kr("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:Re.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Re.errorText,{color:u.error,fontFamily:T.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:Re.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Qe(""),me(true);},style:[Re.selectorPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[(J||er)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(J||er,"png"))},style:Re.selectorPillIcon}),jsxRuntime.jsx(Ar,{size:14,color:b.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{he(""),Se(true);},disabled:ae||oe.length===0,style:[Re.selectorPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[C&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(C,"png"))},style:Re.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Re.selectorPillText,{color:b.card.titleColor,fontFamily:T.semibold}],children:C?.symbol||O}),jsxRuntime.jsx(Ar,{size:14,color:b.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:Re.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:K,style:[Re.addressPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Re.addressPillText,{color:b.card.titleColor,fontFamily:T.regular}],numberOfLines:1,children:je?"Loading...":gt?h1(gt):"No address"}),ke?jsxRuntime.jsx(It,{size:14,color:u.success,strokeWidth:2}):jsxRuntime.jsx(Gn,{size:14,color:b.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:X&&!ut?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:vt}]},children:jsxRuntime.jsx(cc,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:T.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{v?.({priceImpact:_e,maxSlippage:et,minDepositUsd:L,chainName:U}),w?.(true);},style:Re.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(Jn,{size:14,color:b.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[Re.infoFooterText,{color:b.card.subtitleColor,fontFamily:T.regular}],numberOfLines:1,children:["$",L," ",U," Minimum and ","<","1 min Processing"]})]}),_?jsxRuntime.jsxs(reactNative.View,{style:Re.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:Re.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Pe,activeOpacity:.8,style:[Re.ctaButton,{backgroundColor:u.primary,borderRadius:b.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Re.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:T.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:Re.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:K,activeOpacity:.8,style:[Re.ctaButton,{backgroundColor:b.card.backgroundColor,borderRadius:b.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[Re.ctaText,{color:u.foreground,fontFamily:T.semibold}],children:ke?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:K,activeOpacity:.8,style:[Re.ctaButton,{backgroundColor:u.primary,borderRadius:b.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[Re.ctaText,{color:"#FFFFFF",fontFamily:T.semibold}],children:ke?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(rr,{visible:Ge,onClose:()=>{Se(false),he("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[Re.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Re.sheetTitle,{color:b.header.titleColor,fontFamily:T.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Se(false),he("");},style:Re.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx($t,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Re.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Re.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:T.regular,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:b.search.placeholderColor,value:Ve,onChangeText:he,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Yt,{style:Re.sheetList,contentContainerStyle:Re.sheetListContent,showsVerticalScrollIndicator:false,children:Le.length===0?jsxRuntime.jsx(reactNative.View,{style:Re.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Re.emptyText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"No tokens found"})}):Le.map(Fe=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{F(Fe.symbol),Se(false),he("");},activeOpacity:.7,style:[Re.sheetItem,{backgroundColor:O===Fe.symbol?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(Fe,"png"))},style:Re.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Re.sheetItemTitle,{color:b.card.titleColor,fontFamily:T.medium}],children:Fe.symbol}),jsxRuntime.jsx(reactNative.View,{style:Re.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[Re.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Re.sheetItemBadgeText,{color:b.card.subtitleColor,fontFamily:T.medium}],children:[Fe.chains.length," chain",Fe.chains.length!==1?"s":""]})})]},Fe.symbol))})]}),jsxRuntime.jsxs(rr,{visible:Ue,onClose:()=>{me(false),Qe("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[Re.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Re.sheetTitle,{color:b.header.titleColor,fontFamily:T.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{me(false),Qe("");},style:Re.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx($t,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Re.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Re.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:T.regular,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],placeholder:"Search networks",placeholderTextColor:b.search.placeholderColor,value:Je,onChangeText:Qe,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Yt,{style:Re.sheetList,contentContainerStyle:Re.sheetListContent,showsVerticalScrollIndicator:false,children:kt.length===0?jsxRuntime.jsx(reactNative.View,{style:Re.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Re.emptyText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"No networks found"})}):kt.map(Fe=>{let bt=Nl(Fe.chain_id,Fe.chain_type),nt=B===bt;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{W(bt),me(false),Qe("");},activeOpacity:.7,style:[Re.chainItem,{backgroundColor:nt?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(Fe,"png"))},style:Re.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:Re.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[Re.chainItemName,{color:b.card.titleColor,fontFamily:T.medium}],children:Fe.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[Re.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Re.chainMinBadgeText,{color:u.warning,fontFamily:T.medium}],children:["$",Fe.minimum_deposit_amount_usd," Minimum"]})})]},bt)})})]})]})}var Re=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 Ab(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function b1(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=s<10?`0${s}`:s;return `${r} ${o}, ${n} at ${i}:${l}${a}`}function ap({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:g,heightCompleted:k,heightCompletedExpanded:d}){let{components:f}=z(),[S,h]=ta.useState(false),w=t==="succeeded";return jsxRuntime.jsx(rr,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:w?S?d??k??.55:k??.55:g??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:Br.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Br.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Br.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:Br.scrollContent,children:jsxRuntime.jsx(w1,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,showDetails:S,onToggleDetails:()=>h(!S)})})]})})}function w1({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:i,showDetails:s,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:p,components:g}=z(),[k,d]=ta.useState(false),f=s??k,S=a??(()=>d(P=>!P)),h=e==="pending"||e==="waiting"||e==="delayed",w=e==="succeeded",v=!!r||!!o,I=()=>{r&&reactNative.Linking.openURL(r);},x=()=>{o&&reactNative.Linking.openURL(o);};return jsxRuntime.jsxs(reactNative.View,{style:[Br.container,l],children:[jsxRuntime.jsx(reactNative.View,{style:Br.iconContainer,children:h?jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:56,children:t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(t)},style:Br.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Br.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(t)},style:Br.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Br.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Br.statusBadge,{backgroundColor:g.container.iconBackgroundColor}],children:jsxRuntime.jsx(It,{size:16,color:g.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Br.title,{color:g.container.titleColor,fontFamily:p.semibold}],children:h?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Br.amount,{color:g.container.titleColor,fontFamily:p.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[Br.date,{color:g.container.subtitleColor,fontFamily:p.regular}],children:b1(n)}),jsxRuntime.jsx(reactNative.Text,{style:[Br.subtitle,{color:g.container.subtitleColor,fontFamily:p.regular}],children:h?"This usually takes less than a minute.":"Your account has been credited successfully!"}),w&&v&&jsxRuntime.jsxs(reactNative.View,{style:Br.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Br.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Br.detailsToggle,onPress:S,children:[jsxRuntime.jsx(reactNative.Text,{style:[Br.detailsToggleText,{color:g.container.actionTitle,fontFamily:p.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(di,{size:18,color:g.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ar,{size:18,color:g.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:Br.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Br.txButton,{backgroundColor:g.card.backgroundColor,borderColor:c.border}],onPress:I,children:[jsxRuntime.jsx(reactNative.Text,{style:[Br.txLabel,{color:g.card.titleColor,fontFamily:p.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Br.txHash,{color:g.card.subtitleColor,fontFamily:p.regular}],children:Ab(r)}),jsxRuntime.jsx(En,{size:16,color:g.card.actionColor,strokeWidth:2})]}),o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Br.txButton,{backgroundColor:g.card.backgroundColor,borderColor:c.border}],onPress:x,children:[jsxRuntime.jsx(reactNative.Text,{style:[Br.txLabel,{color:g.card.titleColor,fontFamily:p.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Br.txHash,{color:g.card.subtitleColor,fontFamily:p.regular}],children:Ab(o)}),jsxRuntime.jsx(En,{size:16,color:g.card.actionColor,strokeWidth:2})]})]})]})]})}var Br=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function xm({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:i,borderTopLeftRadius:s,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:g}=z(),k=[{icon:jsxRuntime.jsx($o,{size:14,color:g.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(Yn,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${i}`},{icon:jsxRuntime.jsx(Yn,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(Jo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(rr,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:s,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:Qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.header,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.titleRow,children:[jsxRuntime.jsx(Jn,{size:16,color:g.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.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:Qn.closeButton,children:jsxRuntime.jsx($t,{size:18,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Qn.rows,children:[k.map((d,f)=>jsxRuntime.jsxs(reactNative.View,{style:Qn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:d.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.label,{color:g.card.titleColor,fontFamily:p.regular}],children:d.label})]},f)),jsxRuntime.jsxs(reactNative.View,{style:Qn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:14,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Qn.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 Qn=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 Fn={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 Link",subtitle:"Buy with card or bank"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},coinbaseApplePay:{title:"Pay with Apple Pay",subtitle:"Instant"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function v1(){let{colors:e,components:t}=z(),r=ta.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ta.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]);let i=({rightIcons:s=2})=>jsxRuntime.jsxs(reactNative.View,{style:[Gs.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:Gs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:Gs.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:Gs.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var Gs=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 R1({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=z(),i=({tab:s,label:a,glyph:l})=>{let c=e===s,p=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:cd.item,activeOpacity:.8,onPress:()=>t(s),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[cd.badge,{backgroundColor:p}],children:jsxRuntime.jsx(reactNative.Text,{style:[cd.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[cd.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[cd.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(i,{tab:"crypto",label:Fn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(i,{tab:"cash",label:Fn.tabs.cash,glyph:"$"})]})}var cd=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 I1({visible:e,onClose:t,closeOnBackdropPress:r=false,externalUserId:o,publishableKey:n,modalTitle:i="Deposit",transferCryptoTitle:s,user:a,destinationTokenSymbol:l,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,defaultChainType:d,defaultChainId:f,defaultTokenAddress:S,showBalance:h=false,hideDepositTracker:w,enableTransferCrypto:v,enableCashApp:I,enableConnectWallet:x,enableCoinbaseApplePay:P,enableFiatOnramp:m,enableStripeLink:u,StripeOnrampComponent:T,stripePaymentSelectorPosition:b,stripeSkipSuccessConfirmation:A,stripeTheme:O,depositConfirmationMode:F="auto_ui",transferInputVariant:B="double_input",depositMenuDisplay:W="stacked",initialScreen:N="main",onDepositSuccess:Z,onDepositError:je,sheetBorderRadius:Y}){let rt=Y?.globalBorderTopLeftRadius,oe=Y?.globalBorderTopRightRadius,{colors:ce,fonts:ae}=z(),[te,ke]=ta.useState([]),[j,Ie]=ta.useState(null),[pt,Ge]=ta.useState(false),[Se,qe]=ta.useState(false),ot=ta.useRef(null),[Ye,dt]=ta.useState("amount"),[st,Me]=ta.useState(false),[be,we]=ta.useState(null),[ze,ut]=ta.useState(void 0),[ht,xt]=ta.useState(false),[lr,Ue]=ta.useState(null),me=v??j?.transfer_crypto?.enabled??true,Je=x??j?.connect_wallet?.enabled??false,Qe=I??j?.cash_app?.enabled??false,Ve=P??j?.apple_pay?.enabled??false,he=reactNative.Platform.OS==="ios"&&Ve&&pt,Ne=m??j?.fiat_onramp?.enabled??true,vt=!j?.stripe_link?.is_hidden&&(u??j?.stripe_link?.enabled??false)&&!!T,Vt=w?false:j?.deposit_tracker?.enabled??true,Ht=v??j?.transfer_crypto?.enabled??false,lt=x??j?.connect_wallet?.enabled??false,er=I??j?.cash_app?.enabled??false,Xe=he,yt=!!j&&vt,gt=m??j?.fiat_onramp?.enabled??false,De=w?false:j?.deposit_tracker?.enabled??false,at=N==="tracker"&&De?"tracker":N==="transfer"&&Ht?"transfer":N==="card"&>?"card":N==="cashapp"&&er?"cashapp":N==="apple_pay"&&Xe?"coinbaseApplePay":N==="stripe_link"&&yt?"stripe":N==="wallet"&<?"wallet":"main",[X,Pe]=ta.useState(at==="main"),[_,C]=ta.useState(at),[M,q]=ta.useState("crypto"),{isAllowed:J,isLoading:K}=sd(n,e);ta.useEffect(()=>{if(!e||j)return;let Lt=false;return wc(n).then(async Qr=>{if(Lt)return;let ne=[];for(let ue of Qr?.transfer_crypto?.networks??[]){let zt=ue.icon_urls.find(ur=>ur.format==="png")?.url||ue.icon_urls.find(ur=>ur.format==="svg")?.url;zt&&ne.push(ye(zt));}for(let ue of Qr?.payment_networks?.networks??[]){let zt=ue.icon_urls.find(ur=>ur.format==="png")?.url||ue.icon_urls.find(ur=>ur.format==="svg")?.url;zt&&ne.push(ye(zt));}ne.length>0&&await Hc(ne),Lt||Ie(Qr);}).catch(console.error),()=>{Lt=true;}},[e,j,n]),ta.useEffect(()=>{if(ot.current!==n&&(Ge(false),qe(false)),!e||reactNative.Platform.OS!=="ios"||!Ve||ot.current===n)return;let Lt=false;return (async()=>{for(let ne=1;ne<=4;ne++)try{let ue=await vh(n);if(Lt)return;ot.current=n;let zt=(ue.data??[]).some(ur=>ur.enabled??!0);Ge(zt),qe(!0);return}catch{if(Lt)return;if(ne===4){qe(true);return}await new Promise(ue=>setTimeout(()=>ue(),500*2**(ne-1)));}})(),()=>{Lt=true;}},[e,Ve,n]);let _e=reactNative.Platform.OS!=="ios"||!Ve||Se,et=()=>{t();},L=ta.useRef(false);ta.useEffect(()=>{e&&!L.current&&(C(at),Pe(at==="main"),dt("amount"),xt(false),Ue(null),q("crypto")),L.current=e;},[e,at]),ta.useEffect(()=>{if(!e||_!=="main")return;if(N==="apple_pay"){if(he){C("coinbaseApplePay"),Pe(false);return}_e&&Pe(true);return}if(!j)return;let Lt=N==="wallet"&&Je?"wallet":N==="transfer"&&me?"transfer":N==="card"&&Ne?"card":N==="cashapp"&&Qe?"cashapp":N==="stripe_link"&&vt?"stripe":N==="tracker"&&Vt?"tracker":null;Lt&&(C(Lt),Pe(false));},[e,j,N,_,Je,me,Ne,Qe,he,vt,Vt,_e]),ta.useEffect(()=>{if(!j)return;(_==="transfer"&&!me||_==="card"&&!Ne||_==="cashapp"&&!Qe||_==="coinbaseApplePay"&&!he||_==="stripe"&&!vt||_==="wallet"&&!Je||_==="tracker"&&!Vt)&&(C("main"),Pe(true));},[j,_,me,Ne,Qe,he,vt,Je,Vt]);let U=ta.useCallback(Lt=>{Lt.length!==0&&ke(Qr=>{let ne=new Map(Qr.map(ue=>[ue.id,ue]));for(let ue of Lt)ne.set(ue.id,ue);return Array.from(ne.values())});},[]),kt=ta.useCallback(()=>{xt(false),Ue(null),X?(C("main"),dt("amount")):et();},[X,et]),Le=ta.useRef(reactNative.AppState.currentState==="active"),Fe=ta.useRef(0);ta.useEffect(()=>{if(reactNative.Platform.OS!=="android")return;let Lt=reactNative.AppState.addEventListener("change",Qr=>{Qr==="active"&&!Le.current&&(Fe.current=Date.now()),Le.current=Qr==="active";});return ()=>Lt.remove()},[]);let bt=ta.useCallback(()=>{if(reactNative.Platform.OS==="android"){let Lt=!Le.current,Qr=Date.now()-Fe.current<800;if(Lt||Qr)return}kt();},[kt]),nt=te.filter(Lt=>Lt.status==="pending"||Lt.status==="waiting").length,vr=!!(c&&p&&g&&k&&n)&&h!==false&&!!j,ft=gc.includes(p)?p:void 0,tr=K||e&&!j,Mt=J===false,qr=null;if(_==="stripe"&&T){let Lt=jsxRuntime.jsx(T,{publishableKey:n,email:a?.email,phone:a?.phone,externalUserId:o,recipientAddress:c??"",destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,paymentSelectorPosition:b,skipSuccessConfirmation:A,appName:j?.project_name??"",onClose:kt});qr=O?jsxRuntime.jsx(Ja,{...O,children:Lt}):Lt;}let Mr=(me?1:0)+(Je?1:0)+(Ne?1:0)+(Qe?1:0)+(he?1:0)+(vt?1:0)+(Vt?1:0),li=W!=="tabs"&&Mr>5,on=_==="stripe"||_==="transfer"||_==="card"||_==="cashapp"||_==="coinbaseApplePay"||_==="wallet"?.9:_==="tracker"?.6:_==="main"?li?.9:Qe||Je||he?.6:.5:void 0,yo=_==="main"?.9:void 0,nn={main:Y?.main,transfer:Y?.transferCrypto,card:Y?.buyWithCard,stripe:Y?.stripeLink,cashapp:Y?.cashApp,coinbaseApplePay:Y?.coinbaseApplePay,wallet:Y?.connectWallet,tracker:Y?.depositsTracker}[_],ko=nn?.borderTopLeftRadius??rt,na=nn?.borderTopRightRadius??oe,bo=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[be&&jsxRuntime.jsx(ap,{visible:st,useModal:false,status:be.status,tokenIconUrl:be.destination_token_metadata?.icon_urls?.find(Lt=>Lt.format==="png")?.url||be.destination_token_metadata?.icon_url||ze,explorerUrl:be.explorer_url,completionExplorerUrl:be.destination_explorer_url,date:be.created_at?new Date(be.created_at):void 0,amountUsd:be.source_amount_usd?parseFloat(be.source_amount_usd):void 0,onClose:()=>Me(false),heightProcessing:_==="card"||_==="wallet"?.35:void 0,heightCompleted:_==="card"||_==="wallet"?.41:void 0,heightCompletedExpanded:_==="card"||_==="wallet"?.53:void 0,borderTopLeftRadius:Y?.depositStatus?.borderTopLeftRadius??rt,borderTopRightRadius:Y?.depositStatus?.borderTopRightRadius??oe}),lr&&jsxRuntime.jsx(xm,{visible:ht,useModal:false,onClose:()=>xt(false),priceImpact:lr.priceImpact,maxSlippage:lr.maxSlippage,minDepositUsd:lr.minDepositUsd,chainName:lr.chainName,borderTopLeftRadius:Y?.infoSheet?.borderTopLeftRadius??rt,borderTopRightRadius:Y?.infoSheet?.borderTopRightRadius??oe})]});return jsxRuntime.jsxs(rr,{visible:e,onClose:_==="main"?et:bt,closeOnBackdropPress:r,onBackdropPress:et,enablePanDownToClose:true,showHandle:true,heightPercent:on,maxHeightPercent:yo,borderTopLeftRadius:ko,borderTopRightRadius:na,overlay:bo,children:[_==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:i,showBack:false,onClose:et,showBalance:vr,balanceAddress:c,balanceChainType:ft,balanceChainId:g,balanceTokenAddress:k,publishableKey:n,projectName:j?.project_name}),tr&&jsxRuntime.jsx(v1,{}),!tr&&Mt&&jsxRuntime.jsxs(reactNative.View,{style:To.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[To.iconContainer,{backgroundColor:ce.cardHover}],children:jsxRuntime.jsx(dc,{size:32,color:ce.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[To.blockedTitle,{color:ce.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[To.blockedDescription,{color:ce.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!tr&&!Mt&&(()=>{let Lt=me?jsxRuntime.jsx($c,{onPress:()=>C("transfer"),title:s??Fn.transferCrypto.title,subtitle:Fn.transferCrypto.subtitle,featuredTokens:j?.transfer_crypto?.networks},"transfer"):null,Qr=Ne?jsxRuntime.jsx(qc,{onPress:()=>C("card"),title:Fn.depositWithCard.title,subtitle:Fn.depositWithCard.subtitle,paymentNetworks:j?.payment_networks?.networks},"card"):null,ne=Je?jsxRuntime.jsx(Jc,{onPress:()=>C("wallet"),featuredWallets:j?.connect_wallet?.wallets},"wallet"):null,ue=Qe?jsxRuntime.jsx(Yc,{onPress:()=>C("cashapp")},"cashapp"):null,zt=he?jsxRuntime.jsx(Zc,{onPress:()=>C("coinbaseApplePay"),title:Fn.coinbaseApplePay.title,subtitle:Fn.coinbaseApplePay.subtitle},"coinbaseApplePay"):null,ur=vt?jsxRuntime.jsx(Gc,{onPress:()=>C("stripe"),title:Fn.stripeLinkPay.title,subtitle:Fn.stripeLinkPay.subtitle},"stripe"):null,Go=Vt?jsxRuntime.jsx(Qc,{onPress:()=>C("tracker"),title:Fn.depositTracker.title,subtitle:Fn.depositTracker.subtitle,badge:nt>0?nt:void 0},"tracker"):null;return jsxRuntime.jsxs(reactNative.View,{style:To.optionsContainer,children:[W==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(R1,{selected:M,onSelect:q}),M==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Lt,ne]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Qr,ue,zt,ur]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Lt,ne,Qr,ue,zt,ur]}),Go]})})()]}),_==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:s??Fn.transferCrypto.title,showBack:false,onClose:kt,showBalance:vr,balanceAddress:c,balanceChainType:ft,balanceChainId:g,balanceTokenAddress:k,publishableKey:n,projectName:j?.project_name}),K&&jsxRuntime.jsx(reactNative.View,{style:[To.centeredContainer,To.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:ce.primary})}),!K&&Mt&&jsxRuntime.jsxs(reactNative.View,{style:[To.centeredContainer,To.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[To.iconContainer,{backgroundColor:ce.cardHover}],children:jsxRuntime.jsx(dc,{size:32,color:ce.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[To.blockedTitle,{color:ce.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[To.blockedDescription,{color:ce.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!K&&!Mt&&jsxRuntime.jsx(Yt,{style:To.transferScrollContainer,contentContainerStyle:B==="compact"?To.scrollContentCompact:To.scrollContent,showsVerticalScrollIndicator:false,children:B==="compact"?jsxRuntime.jsx(ip,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:f,defaultTokenAddress:S,depositConfirmationMode:F,onExecutionsChange:U,onDepositSuccess:Z,onDepositError:je,onLatestExecution:we,onShowStatusSheet:Me,onSelectedTokenIconUrl:ut,onShowInfoSheet:xt,onInfoSheetData:Ue,borderTopLeftRadius:rt,borderTopRightRadius:oe,sheetBorderRadius:{tokenSelector:Y?.tokenSelector,chainSelector:Y?.chainSelector,infoSheet:Y?.infoSheet,depositStatus:Y?.depositStatus}}):B==="single_input"?jsxRuntime.jsx(km,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:f,defaultTokenAddress:S,depositConfirmationMode:F,onExecutionsChange:U,onDepositSuccess:Z,onDepositError:je,onLatestExecution:we,onShowStatusSheet:Me,onSelectedTokenIconUrl:ut,borderTopLeftRadius:rt,borderTopRightRadius:oe,sheetBorderRadius:{tokenSelector:Y?.tokenSelector,infoSheet:Y?.infoSheet,depositStatus:Y?.depositStatus}}):jsxRuntime.jsx(Nu,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:f,defaultTokenAddress:S,depositConfirmationMode:F,onExecutionsChange:U,onDepositSuccess:Z,onDepositError:je,onLatestExecution:we,onShowStatusSheet:Me,onSelectedTokenIconUrl:ut,borderTopLeftRadius:rt,borderTopRightRadius:oe,sheetBorderRadius:{tokenSelector:Y?.tokenSelector,chainSelector:Y?.chainSelector,infoSheet:Y?.infoSheet,depositStatus:Y?.depositStatus}})})]}),_==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:`Deposit ${l||"USDC"}`,showBack:Ye==="onramp",onBack:()=>dt("amount"),onClose:kt,showBalance:vr,balanceAddress:c,balanceChainType:ft,balanceChainId:g,balanceTokenAddress:k,publishableKey:n,projectName:j?.project_name}),jsxRuntime.jsx(reactNative.View,{style:To.buyWithCardContainer,children:jsxRuntime.jsx(Ku,{externalUserId:o,publishableKey:n,destinationTokenSymbol:l,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,onDepositSuccess:Z,onDepositError:je,onExecutionsChange:U,onLatestExecution:we,onShowStatusSheet:Me,onSelectedTokenIconUrl:ut,view:Ye,onViewChange:Lt=>dt(Lt),borderTopLeftRadius:rt,borderTopRightRadius:oe,sheetBorderRadius:{providerModal:Y?.providerModal,webView:Y?.webView,currencyModal:Y?.currencyModal}})})]}),_==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:To.cashAppContainer,children:jsxRuntime.jsx(vu,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,onBack:kt,onClose:kt,onDepositSuccess:Z})}),_==="coinbaseApplePay"&&jsxRuntime.jsx(reactNative.View,{style:To.coinbaseApplePayContainer,children:jsxRuntime.jsx(Du,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,destinationTokenSymbol:l,user:a,enabled:he,onBack:kt,onClose:kt,onDepositSuccess:Z,onDepositError:je,onExecutionsChange:U})}),_==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:To.connectWalletContainer,children:jsxRuntime.jsx(Wu,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:p,destinationChainId:g,destinationTokenAddress:k,onBack:kt,onClose:kt,onDepositSuccess:Z,onDepositError:je,onExecutionsChange:U,onLatestExecution:we,onShowStatusSheet:Me})}),_==="stripe"&&qr&&jsxRuntime.jsx(reactNative.View,{style:To.stripeLinkPayContainer,children:qr}),_==="tracker"&&jsxRuntime.jsx(bm,{active:_==="tracker",onClose:kt,executions:te,externalUserId:o,publishableKey:n})]})}function dp({theme:e="auto",...t}){return jsxRuntime.jsx(I1,{...t})}var To=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},coinbaseApplePayContainer:{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 $l=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 La,Js,jl,Lb,F1=(Lb=class extends $l{constructor(){super();pe(this,La);pe(this,Js);pe(this,jl);G(this,jl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Js)||this.setEventListener(y(this,jl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Js))==null||t.call(this),G(this,Js,void 0));}setEventListener(t){var r;G(this,jl,t),(r=y(this,Js))==null||r.call(this),G(this,Js,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,La)!==t&&(G(this,La,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,La)=="boolean"?y(this,La):globalThis.document?.visibilityState!=="hidden"}},La=new WeakMap,Js=new WeakMap,jl=new WeakMap,Lb),Bb=new F1;var D1={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Oi,Ba,Eb,A1=(Eb=class{constructor(){pe(this,Oi,D1);pe(this,Ba,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,Ba)&&e!==y(this,Oi)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,Oi),provider:e}),G(this,Oi,e),process.env.NODE_ENV!=="production"&&G(this,Ba,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,Ba,true),y(this,Oi).setTimeout(e,t)}clearTimeout(e){y(this,Oi).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,Ba,true),y(this,Oi).setInterval(e,t)}clearInterval(e){y(this,Oi).clearInterval(e);}},Oi=new WeakMap,Ba=new WeakMap,Eb),ud=new A1;function Wb(e){setTimeout(e,0);}var vm=typeof window>"u"||"Deno"in globalThis;function ql(){}function Rm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Nb(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ql(e,t){return typeof e=="function"?e(t):e}function Dn(e,t){return typeof e=="function"?e(t):e}var O1=Object.prototype.hasOwnProperty;function up(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Mb(e)&&Mb(t);if(!o&&!(zb(e)&&zb(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let g=o?p:s[p],k=e[g],d=t[g];if(k===d){l[g]=k,(o?p<i:O1.call(e,g))&&c++;continue}if(k===null||d===null||typeof k!="object"||typeof d!="object"){l[g]=d;continue}let f=up(k,d,r+1);l[g]=f,f===k&&c++;}return i===a&&c===i?e:l}function pp(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 Mb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function zb(e){if(!Ub(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Ub(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ub(e){return Object.prototype.toString.call(e)==="[object Object]"}function Im(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 up(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 up(e,t)}return t}function fp(e,t){return typeof e=="function"?e(...t):!!e}var Kl=(()=>{let e=()=>vm;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Pm(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Hb=Wb;function V1(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Hb,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var pd=V1();var Gl,Zs,Yl,$b,L1=($b=class extends $l{constructor(){super();pe(this,Gl,true);pe(this,Zs);pe(this,Yl);G(this,Yl,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,Zs)||this.setEventListener(y(this,Yl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Zs))==null||t.call(this),G(this,Zs,void 0));}setEventListener(t){var r;G(this,Yl,t),(r=y(this,Zs))==null||r.call(this),G(this,Zs,t(this.setOnline.bind(this)));}setOnline(t){y(this,Gl)!==t&&(G(this,Gl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,Gl)}},Gl=new WeakMap,Zs=new WeakMap,Yl=new WeakMap,$b),jb=new L1;function qb(e){return (e??"online")==="online"?jb.isOnline():true}function Qb(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qb(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var yn,Zt,md,tn,Ea,Jl,as,Xs,hd,Zl,Xl,Wa,Ma,ea,ec,Cr,fd,Fm,Dm,Am,Om,Vm,Lm,Bm,Jb,Yb,Wm=(Yb=class extends $l{constructor(t,r){super();pe(this,Cr);pe(this,yn);pe(this,Zt);pe(this,md);pe(this,tn);pe(this,Ea);pe(this,Jl);pe(this,as);pe(this,Xs);pe(this,hd);pe(this,Zl);pe(this,Xl);pe(this,Wa);pe(this,Ma);pe(this,ea);pe(this,ec,new Set);this.options=r,G(this,yn,t),G(this,Xs,null),G(this,as,Pm()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(y(this,Zt).addObserver(this),Kb(y(this,Zt),this.options)?Wt(this,Cr,fd).call(this):this.updateResult(),Wt(this,Cr,Om).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Em(y(this,Zt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Em(y(this,Zt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Wt(this,Cr,Vm).call(this),Wt(this,Cr,Lm).call(this),y(this,Zt).removeObserver(this);}setOptions(t){let r=this.options,o=y(this,Zt);if(this.options=y(this,yn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Dn(this.options.enabled,y(this,Zt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Wt(this,Cr,Bm).call(this),y(this,Zt).setOptions(this.options),r._defaulted&&!pp(this.options,r)&&y(this,yn).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,Zt),observer:this});let n=this.hasListeners();n&&Gb(y(this,Zt),o,this.options,r)&&Wt(this,Cr,fd).call(this),this.updateResult(),n&&(y(this,Zt)!==o||Dn(this.options.enabled,y(this,Zt))!==Dn(r.enabled,y(this,Zt))||Ql(this.options.staleTime,y(this,Zt))!==Ql(r.staleTime,y(this,Zt)))&&Wt(this,Cr,Fm).call(this);let i=Wt(this,Cr,Dm).call(this);n&&(y(this,Zt)!==o||Dn(this.options.enabled,y(this,Zt))!==Dn(r.enabled,y(this,Zt))||i!==y(this,ea))&&Wt(this,Cr,Am).call(this,i);}getOptimisticResult(t){let r=y(this,yn).getQueryCache().build(y(this,yn),t),o=this.createResult(r,t);return E1(this,o)&&(G(this,tn,o),G(this,Jl,this.options),G(this,Ea,y(this,Zt).state)),o}getCurrentResult(){return y(this,tn)}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,as).status==="pending"&&y(this,as).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){y(this,ec).add(t);}getCurrentQuery(){return y(this,Zt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=y(this,yn).defaultQueryOptions(t),o=y(this,yn).getQueryCache().build(y(this,yn),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Wt(this,Cr,fd).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),y(this,tn)))}createResult(t,r){let o=y(this,Zt),n=this.options,i=y(this,tn),s=y(this,Ea),a=y(this,Jl),c=t!==o?t.state:y(this,md),{state:p}=t,g={...p},k=false,d;if(r._optimisticResults){let b=this.hasListeners(),A=!b&&Kb(t,r),O=b&&Gb(t,o,r,n);(A||O)&&(g={...g,...Qb(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:f,errorUpdatedAt:S,status:h}=g;d=g.data;let w=false;if(r.placeholderData!==void 0&&d===void 0&&h==="pending"){let b;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(b=i.data,w=true):b=typeof r.placeholderData=="function"?r.placeholderData(y(this,Xl)?.state.data,y(this,Xl)):r.placeholderData,b!==void 0&&(h="success",d=Im(i?.data,b,r),k=true);}if(r.select&&d!==void 0&&!w)if(i&&d===s?.data&&r.select===y(this,hd))d=y(this,Zl);else try{G(this,hd,r.select),d=r.select(d),d=Im(i?.data,d,r),G(this,Zl,d),G(this,Xs,null);}catch(b){G(this,Xs,b);}y(this,Xs)&&(f=y(this,Xs),d=y(this,Zl),S=Date.now(),h="error");let v=g.fetchStatus==="fetching",I=h==="pending",x=h==="error",P=I&&v,m=d!==void 0,T={status:h,fetchStatus:g.fetchStatus,isPending:I,isSuccess:h==="success",isError:x,isInitialLoading:P,isLoading:P,data:d,dataUpdatedAt:g.dataUpdatedAt,error:f,errorUpdatedAt:S,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>c.dataUpdateCount||g.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!I,isLoadingError:x&&!m,isPaused:g.fetchStatus==="paused",isPlaceholderData:k,isRefetchError:x&&m,isStale:Mm(t,r),refetch:this.refetch,promise:y(this,as),isEnabled:Dn(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let b=T.data!==void 0,A=T.status==="error"&&!b,O=W=>{A?W.reject(T.error):b&&W.resolve(T.data);},F=()=>{let W=G(this,as,T.promise=Pm());O(W);},B=y(this,as);switch(B.status){case "pending":t.queryHash===o.queryHash&&O(B);break;case "fulfilled":(A||T.data!==B.value)&&F();break;case "rejected":(!A||T.error!==B.reason)&&F();break}}return T}updateResult(){let t=y(this,tn),r=this.createResult(y(this,Zt),this.options);if(G(this,Ea,y(this,Zt).state),G(this,Jl,this.options),y(this,Ea).data!==void 0&&G(this,Xl,y(this,Zt)),pp(r,t))return;G(this,tn,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!y(this,ec).size)return true;let s=new Set(i??y(this,ec));return this.options.throwOnError&&s.add("error"),Object.keys(y(this,tn)).some(a=>{let l=a;return y(this,tn)[l]!==t[l]&&s.has(l)})};Wt(this,Cr,Jb).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Wt(this,Cr,Om).call(this);}},yn=new WeakMap,Zt=new WeakMap,md=new WeakMap,tn=new WeakMap,Ea=new WeakMap,Jl=new WeakMap,as=new WeakMap,Xs=new WeakMap,hd=new WeakMap,Zl=new WeakMap,Xl=new WeakMap,Wa=new WeakMap,Ma=new WeakMap,ea=new WeakMap,ec=new WeakMap,Cr=new WeakSet,fd=function(t){Wt(this,Cr,Bm).call(this);let r=y(this,Zt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(ql)),r},Fm=function(){Wt(this,Cr,Vm).call(this);let t=Ql(this.options.staleTime,y(this,Zt));if(Kl.isServer()||y(this,tn).isStale||!Rm(t))return;let o=Nb(y(this,tn).dataUpdatedAt,t)+1;G(this,Wa,ud.setTimeout(()=>{y(this,tn).isStale||this.updateResult();},o));},Dm=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,Zt)):this.options.refetchInterval)??false},Am=function(t){Wt(this,Cr,Lm).call(this),G(this,ea,t),!(Kl.isServer()||Dn(this.options.enabled,y(this,Zt))===false||!Rm(y(this,ea))||y(this,ea)===0)&&G(this,Ma,ud.setInterval(()=>{(this.options.refetchIntervalInBackground||Bb.isFocused())&&Wt(this,Cr,fd).call(this);},y(this,ea)));},Om=function(){Wt(this,Cr,Fm).call(this),Wt(this,Cr,Am).call(this,Wt(this,Cr,Dm).call(this));},Vm=function(){y(this,Wa)!==void 0&&(ud.clearTimeout(y(this,Wa)),G(this,Wa,void 0));},Lm=function(){y(this,Ma)!==void 0&&(ud.clearInterval(y(this,Ma)),G(this,Ma,void 0));},Bm=function(){let t=y(this,yn).getQueryCache().build(y(this,yn),this.options);if(t===y(this,Zt))return;let r=y(this,Zt);G(this,Zt,t),G(this,md,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Jb=function(t){pd.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(y(this,tn));}),y(this,yn).getQueryCache().notify({query:y(this,Zt),type:"observerResultsUpdated"});});},Yb);function B1(e,t){return Dn(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Dn(t.retryOnMount,e)===false)}function Kb(e,t){return B1(e,t)||e.state.data!==void 0&&Em(e,t,t.refetchOnMount)}function Em(e,t,r){if(Dn(t.enabled,e)!==false&&Ql(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Mm(e,t)}return false}function Gb(e,t,r,o){return (e!==t||Dn(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Mm(e,r)}function Mm(e,t){return Dn(t.enabled,e)!==false&&e.isStaleByTime(Ql(t.staleTime,e))}function E1(e,t){return !pp(e.getCurrentResult(),t)}var W1=ta__namespace.createContext(void 0),Zb=e=>{let t=ta__namespace.useContext(W1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var Xb=ta__namespace.createContext(false),ew=()=>ta__namespace.useContext(Xb);Xb.Provider;function M1(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var z1=ta__namespace.createContext(M1()),tw=()=>ta__namespace.useContext(z1);var ow=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?fp(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},nw=e=>{ta__namespace.useEffect(()=>{e.clearReset();},[e]);},iw=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||fp(r,[e.error,o]));var sw=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));}},aw=(e,t)=>e.isLoading&&e.isFetching&&!t,lw=(e,t)=>e?.suspense&&t.isPending,zm=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function cw(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=ew(),n=tw(),i=Zb(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;s._optimisticResults=o?"isRestoring":l?"optimistic":void 0,sw(s),ow(s,n,a),nw(n);let c=!i.getQueryCache().get(s.queryHash),[p]=ta__namespace.useState(()=>new t(i,s)),g=p.getOptimisticResult(s),k=!o&&l;if(ta__namespace.useSyncExternalStore(ta__namespace.useCallback(d=>{let f=k?p.subscribe(pd.batchCalls(d)):ql;return p.updateResult(),f},[p,k]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ta__namespace.useEffect(()=>{p.setOptions(s);},[s,p]),lw(s,g))throw zm(s,p,n);if(iw({result:g,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw g.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,g),s.experimental_prefetchInRender&&!Kl.isServer()&&aw(g,o)&&(c?zm(s,p,n):a?.promise)?.catch(ql).finally(()=>{p.updateResult();}),s.notifyOnChangeProps?g:p.trackResult(g)}function ls(e,t){return cw(e,Wm)}function hp(e,t=true){return ls({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ed(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Um(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return ls({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await Wi(i),c=null,p=null,g=null,k=null,d,f,S,h=l.data.some(w=>w.chains.some(v=>{let I=v.chain_type===t&&v.chain_id===r&&v.token_address.toLowerCase()===o.toLowerCase();return I&&(c=v.minimum_deposit_amount_usd,p=v.estimated_processing_time,g=v.max_slippage_percent,k=v.estimated_price_impact_percent,S=v.chain_name,f=w),I}));if(f){let w=it(f,"png");w&&(d=ye(w));}return {isSupported:h,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:k,errorMessage:h?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:S}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Nm(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return ls({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await Wd(t,r,o,n,i);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,k=BigInt(g),d=BigInt(10**c),f=k/d,h=(k%d).toString().padStart(c,"0").replace(/0+$/,""),w=h?`${f}.${h}`:f.toString();return {balanceBaseUnit:g,balanceHuman:w,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var U1=2500,N1=3e3,H1=6e4;function Hm({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=ta.useState([]),[l,c]=ta.useState(false),p=ta.useRef(new Date),g=ta.useRef(new Map),k=ta.useRef(false),d=ta.useRef(n),f=ta.useRef(i);return ta.useEffect(()=>{d.current=n;},[n]),ta.useEffect(()=>{f.current=i;},[i]),ta.useEffect(()=>{o&&!k.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),k.current=o;},[o]),ta.useEffect(()=>{if(!e||!o)return;let S=p.current,h=async()=>{try{let v=await ln(e,t,"withdraw"),I=new Date(S.getTime()-H1),x=[...v.data].sort((T,b)=>{let A=T.created_at?new Date(T.created_at).getTime():0;return (b.created_at?new Date(b.created_at).getTime():0)-A}),P=["pending","waiting","delayed"],m=["succeeded","failed"],u=null;for(let T of x){let b=T.created_at?new Date(T.created_at):null;if(!b||b<I)continue;let A=g.current.get(T.id);if(!A){u=T;break}if(P.includes(A)&&m.includes(T.status)){u=T;break}}if(u){let T=u,b=T.created_at?new Date(T.created_at):null;if(!b||b<p.current)return;let A=g.current.get(T.id);g.current.set(T.id,T.status),a(O=>{let F=O.findIndex(B=>B.id===T.id);if(F>=0){let B=[...O];return B[F]=T,B}return [...O,T]}),T.status==="succeeded"&&(!A||P.includes(A))?d.current?.({message:"Withdrawal completed successfully",transaction:T}):T.status==="failed"&&A!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:T});}}catch(v){console.error("Failed to fetch withdraw executions:",v),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:v});}};h();let w=setInterval(h,U1);return c(true),()=>{clearInterval(w),c(false);}},[e,t,o]),ta.useEffect(()=>{if(!o||!r)return;let S=async()=>{try{await Cc({deposit_wallet_id:r},t);}catch{}};S();let h=setInterval(S,N1);return ()=>clearInterval(h)},[o,r,t]),{executions:s,isPolling:l}}var $m=(e,t)=>`${t}:${e}`;function Cd({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:k,fonts:d,components:f}=z(),[S,h]=ta.useState(false),[w,v]=ta.useState(false),I=f.card,x=t?e.find(T=>T.symbol===t):void 0,P=x?.chains||[],m=r?P.find(T=>$m(T.chain_id,T.chain_type)===r):void 0,u={backgroundColor:I.backgroundColor,borderRadius:I.borderRadius,borderWidth:I.borderWidth||1,borderColor:I.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:ir.row,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.label,{color:I.labelColor,fontFamily:d.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.selectButton,u],onPress:()=>!i&&e.length>0&&h(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[ir.placeholder,{color:I.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):x?jsxRuntime.jsxs(reactNative.View,{style:ir.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(x,"png"))},style:ir.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.selectedText,{color:I.titleColor,fontFamily:d.medium}],numberOfLines:1,children:x.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[ir.placeholder,{color:I.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsxRuntime.jsx(Ar,{size:16,color:I.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ir.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.label,{color:I.labelColor,fontFamily:d.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.selectButton,u,(!x||P.length===0)&&ir.disabled],onPress:()=>!i&&x&&P.length>0&&v(true),activeOpacity:.7,disabled:i||!x||P.length===0,children:[m?jsxRuntime.jsxs(reactNative.View,{style:ir.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(m,"png"))},style:ir.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.selectedText,{color:I.titleColor,fontFamily:d.medium}],numberOfLines:1,children:m.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[ir.placeholder,{color:I.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsxRuntime.jsx(Ar,{size:16,color:I.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(rr,{visible:S,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:ir.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerTitle,{color:k.foreground,fontFamily:d.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ir.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Za,{data:e,keyExtractor:T=>T.symbol,contentContainerStyle:ir.listContent,showsVerticalScrollIndicator:false,renderItem:({item:T})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.pickerItem,{backgroundColor:T.symbol===t?k.cardHover:"transparent"}],onPress:()=>{o(T.symbol),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(T,"png"))},style:ir.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerItemText,{color:k.foreground,fontFamily:d.medium}],children:T.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerItemSub,{color:k.foregroundMuted,fontFamily:d.regular}],children:T.name}),T.symbol===t&&jsxRuntime.jsx(It,{size:18,color:k.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(rr,{visible:w,onClose:()=>v(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:ir.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerTitle,{color:k.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ir.pickerHeaderClose,onPress:()=>v(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Za,{data:P,keyExtractor:T=>$m(T.chain_id,T.chain_type),contentContainerStyle:ir.listContent,showsVerticalScrollIndicator:false,renderItem:({item:T})=>{let b=$m(T.chain_id,T.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.pickerItem,{backgroundColor:b===r?k.cardHover:"transparent"}],onPress:()=>{n(b),v(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(it(T,"png"))},style:ir.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerItemText,{color:k.foreground,fontFamily:d.medium}],children:T.chain_name}),b===r&&jsxRuntime.jsx(It,{size:18,color:k.primary,strokeWidth:2.5})]})}})]})]})}var ir=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 jm(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:i,enabled:s=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return ls({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>qp({chain_type:t,chain_id:r,token_address:o,recipient_address:a},i),enabled:s&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Q1(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function K1(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),i=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(i)).toString()}function G1(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function yp({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:k,estimatedProcessingTime:d,maxSlippagePercent:f,priceImpactPercent:S,canWithdraw:h,onDepositWalletCreation:w,onWithdraw:v,onWithdrawError:I,onWithdrawSubmitted:x,onViewTracker:P}){let m="https://unifold.io/terms",u="https://unifold.io/support",{colors:T,fonts:b,components:A}=z(),[O,F]=ta.useState(a||""),[B,W]=ta.useState(""),[N,Z]=ta.useState(false),[je,Y]=ta.useState(null),[rt,oe]=ta.useState(false),[ce,ae]=ta.useState(""),te=ta.useRef(null);ta.useEffect(()=>{F(a||""),W(""),Y(null);},[a]);let ke=O.trim();ta.useEffect(()=>{let he=setTimeout(()=>ae(ke),500);return ()=>clearTimeout(he)},[ke]);let{data:j,isLoading:Ie,error:pt}=jm({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:ce,publishableKey:e,enabled:ce.length>5&&!!c}),Ge=ke!==ce,Se=ta.useMemo(()=>!ke||ke.length<=5||Ge||Ie?null:pt?"Invalid address":j&&!j.valid?j.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:j.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[ke,Ge,Ie,pt,j,c,l]),qe=!Ge&&!!j?.valid&&!Se,ot=ta.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),Ye=ta.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),dt=n||p?.symbol||"TOKEN",st=p?.decimals??6,Me=ta.useMemo(()=>{let he=parseFloat(B);return !he||he<=0?0:he},[B]),be=ta.useMemo(()=>{let he=parseFloat(B);return !he||he<=0?0:he*ot},[B,ot]),we=ta.useCallback(async()=>{try{let Ne=await eC("expo-clipboard").getStringAsync();Ne&&(F(Ne.trim()),Y(null));}catch{}},[]),ze=ta.useCallback(()=>{Ye<=0||W(p?.balanceHuman??"0");},[Ye,p]),ut=k!==null&&be>0&&be<k,ht=Me>0&&Ye>0&&Me>Ye,xt=ke.length>0&&B.trim().length>0&&Me>0&&qe&&!ut&&!ht&&!!p,lr=ta.useCallback(async()=>{if(!(!l||!c||!xt||!h)){Z(true),Y(null);try{let he=await w({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:ke}),Ne=K1(Me,st),vt=G1(Me,st),Vt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:dt,sourceTokenIconUrl:s,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ye(it(l,"png")):void 0,amount:vt,amountBaseUnit:Ne,submittedAt:new Date,withdrawIntentAddress:he.address,recipientAddress:ke};await v(Vt),x(Vt);}catch(he){let Ne=he instanceof Error?he.message:"Withdrawal failed. Please try again.",vt=Ne.length>120?"Withdrawal failed. Please try again.":Ne;Y(vt),I?.({message:Ne,error:he,code:"WITHDRAW_FAILED"});}finally{Z(false);}}},[l,c,xt,h,ke,t,r,o,dt,s,B,Ye,p,Me,st,be,w,v,I,x]),Ue=A.input,me=A.card,Je=A.button,Qe=Se?T.error:Ue.borderColor,Ve=ta.useMemo(()=>N?"Processing...":ht?"Insufficient balance":ut?`Minimum $${k?.toFixed(2)}`:je?"Withdrawal failed \u2014 try again":"Withdraw",[N,ht,ut,k,je]);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:me.labelColor,fontFamily:b.medium}],children:"Recipient address"}),(Ge||Ie)&&ke.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:we,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(mh,{size:16,color:T.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Xt.inputRow,{backgroundColor:Ue.backgroundColor,borderRadius:Ue.borderRadius,borderWidth:Ue.borderWidth,borderColor:Qe}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Xt.textInput,{color:Ue.textColor,fontFamily:b.regular}],placeholder:"Enter wallet address",placeholderTextColor:Ue.placeholderColor,value:O,onChangeText:he=>{F(he),Y(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>te.current?.focus()})}),Se?jsxRuntime.jsx(reactNative.Text,{style:[Xt.errorText,{color:T.error,fontFamily:b.regular}],children:Se}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Xt.label,{color:me.labelColor,fontFamily:b.medium,paddingBottom:8}],children:["Amount",k!=null&&k>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:T.warning,fontFamily:b.regular},children:` ($${k.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xt.amountRow,{backgroundColor:Ue.backgroundColor,borderRadius:Ue.borderRadius,borderWidth:Ue.borderWidth,borderColor:Ue.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:[Xt.amountInput,{color:Ue.textColor,fontFamily:b.regular}],placeholder:"0.00",placeholderTextColor:Ue.placeholderColor,value:B,onChangeText:he=>{(he===""||/^\d*\.?\d*$/.test(he))&&(W(he),Y(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.unitLabel,{color:T.foregroundMuted,fontFamily:b.medium}],children:dt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xt.maxButton,{backgroundColor:`${T.primary}20`}],onPress:ze,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xt.maxText,{color:T.primary,fontFamily:b.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xt.detailsCard,{marginTop:24,backgroundColor:me.backgroundColor,borderRadius:me.borderRadius,borderWidth:me.borderWidth||1,borderColor:me.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Xt.detailsToggle,onPress:()=>oe(!rt),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xt.detailIcon,{backgroundColor:me.iconBackgroundColor,borderRadius:me.iconContainerBorderRadius}],children:jsxRuntime.jsx($o,{size:12,color:me.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xt.detailsLabel,{color:me.titleColor,fontFamily:b.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:b.medium},children:Q1(d)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:rt?"180deg":"0deg"}]},children:jsxRuntime.jsx(Ar,{size:16,color:me.actionColor,strokeWidth:2})})]})}),rt&&jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xt.detailIcon,{backgroundColor:me.iconBackgroundColor,borderRadius:me.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:me.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xt.detailsLabel,{color:me.titleColor,fontFamily:b.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:b.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xt.detailIcon,{backgroundColor:me.iconBackgroundColor,borderRadius:me.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:me.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xt.detailsLabel,{color:me.titleColor,fontFamily:b.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:b.medium},children:[(S??0).toFixed(2),"%"]})]})]})]})]}),je&&jsxRuntime.jsx(reactNative.Text,{style:[Xt.errorText,{color:T.error,fontFamily:b.regular,textAlign:"center"}],children:je}),jsxRuntime.jsxs(reactNative.View,{style:Xt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xt.withdrawButton,{backgroundColor:Je.primaryBackground,borderRadius:Je.borderRadius,borderWidth:Je.borderWidth,borderColor:Je.borderColor,opacity:!xt||!h||N?.5:1}],onPress:lr,disabled:!xt||!h||N,activeOpacity:.8,children:[N&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Je.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.withdrawButtonText,{color:Je.primaryText,fontFamily:b.medium}],children:Ve})]}),jsxRuntime.jsxs(reactNative.View,{style:Xt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xt.historyLink,onPress:P,activeOpacity:.7,children:[jsxRuntime.jsx($o,{size:14,color:T.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.historyText,{color:T.foregroundMuted,fontFamily:b.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Xt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(m),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xt.legalText,{color:T.foregroundMuted,fontFamily:b.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.legalSeparator,{color:T.foregroundMuted,fontFamily:b.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xt.legalText,{color:T.foregroundMuted,fontFamily:b.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 Z1(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 X1(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Cp({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=z(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,c=ye(it(e.destination_token_metadata,"png")||kr("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",g=Z1(e.created_at||new Date().toISOString()),k=X1(e.source_amount_usd);return jsxRuntime.jsxs(jr,{cardTokens:i,onPress:t,contentStyle:ds.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ds.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:ds.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ds.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(gs,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(It,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ds.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ds.title,{color:i.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[ds.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:ds.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ds.amount,{color:i.textRightColor,fontFamily:o.medium}],children:k}),jsxRuntime.jsx(co,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var ds=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 Km(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),i=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),l=s>=12?"PM":"AM";s=s%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${c} ${l}`}catch{return e}}function Cw(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 t0(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 Sw(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Tw(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Sd({label:e,value:t,isLast:r}){let{fonts:o,components:n}=z(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Nt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Nt.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Nt.divider,{backgroundColor:i.borderColor}]})]})}function Ym({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=z(),[c,p]=ta.useState([]),[g,k]=ta.useState(!!n),d=l.card,f=l.button,S=l.header,h=l.container;ta.useEffect(()=>{jp().then(Z=>p(Z.data)).catch(()=>{});},[]),ta.useEffect(()=>{k(!!n);},[e?.id]);let w=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,v=e?e.status==="failed"||e.status==="refunded":false,I=v?s.error:w?s.warning:s.success,x=v?"Failed":w?"Processing":"Completed",P=e?.destination_token_metadata?ye(it(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ye(t.destinationTokenIconUrl):ye(kr("/icons/tokens/png/usdc.png")),m=e?.created_at?Km(e.created_at):t.submittedAt?Km(t.submittedAt.toISOString()):Km(new Date().toISOString()),u=e?`${Cw(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Sw(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,T=e?`${Cw(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Sw(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,b=e?t0(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?Bd(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,O=e?Bd(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,B=e?.explorer_url,W=e?.destination_transaction_hashes?.[0],N=e?.destination_explorer_url;return jsxRuntime.jsxs(Yt,{style:Nt.scroll,contentContainerStyle:Nt.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Nt.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ka,{size:22,color:S.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Nt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.headerTitle,{color:S.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Nt.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:S.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Nt.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:P},style:Nt.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Nt.statusBadge,{backgroundColor:I}],children:v?jsxRuntime.jsx(gs,{size:10,color:"#FFFFFF",strokeWidth:3}):w?jsxRuntime.jsx(reactNative.View,{style:Nt.spinnerDot}):jsxRuntime.jsx(It,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Nt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Nt.statusDot,{backgroundColor:I}]}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.statusText,{color:I,fontFamily:a.medium}],children:x})]}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.dateText,{color:h.subtitleColor,fontFamily:a.regular}],children:m}),jsxRuntime.jsxs(reactNative.View,{style:[Nt.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsxRuntime.jsx(Sd,{label:"Amount Sent",value:u}),jsxRuntime.jsx(Sd,{label:"Amount Received",value:T}),jsxRuntime.jsx(Sd,{label:"USD Value",value:b}),jsxRuntime.jsx(Sd,{label:"Source Network",value:A}),jsxRuntime.jsx(Sd,{label:"Destination Network",value:O,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Nt.moreDetailsRow,onPress:()=>k(Z=>!Z),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Nt.moreDetailsText,{color:h.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(di,{size:16,color:h.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ar,{size:16,color:h.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[Nt.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:F&&B?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Nt.txRow,onPress:()=>reactNative.Linking.openURL(B),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Nt.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Tw(F)}),jsxRuntime.jsx(En,{size:14,color:d.actionColor,strokeWidth:2})]}),!w&&W&&N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Nt.divider,{backgroundColor:d.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Nt.txRow,onPress:()=>reactNative.Linking.openURL(N),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Nt.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Tw(W)}),jsxRuntime.jsx(En,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Nt.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Nt.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Nt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Nt.button,Nt.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Nt.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Nt.button,Nt.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Nt.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var Nt=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 kw(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Sp({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=z(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Wr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wr.closeButton,onPress:r,children:jsxRuntime.jsx($t,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Wr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(It,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Wr.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",kw(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Wr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Wr.button,Wr.halfButton,p,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Wr.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Wr.button,Wr.halfButton,p,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Wr.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:Wr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wr.closeButton,onPress:r,children:jsxRuntime.jsx($t,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Wr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx($t,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Wr.button,Wr.fullButton,p,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Wr.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Wr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wr.closeButton,onPress:r,children:jsxRuntime.jsx($t,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(e.sourceTokenIconUrl)},style:Wr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Wr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Wr.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.sourceTokenSymbol," to"," ",kw(e.recipientAddress)]})]})}var Wr=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 a0(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:ye(it(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:ye(it(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 xw=(e,t)=>`${t}:${e}`;function l0(){let{colors:e}=z(),t=ta.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ta.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 xp({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,defaultDestinationChainType:s,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:k,heightPercent:d=.94,sheetBorderRadius:f,sourceChainType:S,sourceChainId:h,sourceTokenAddress:w,sourceTokenSymbol:v,sourceChainName:I,sourceTokenIconUrl:x}){let{colors:P,fonts:m}=z(),[u,T]=ta.useState("form"),[b,A]=ta.useState(S),[O,F]=ta.useState(h),[B,W]=ta.useState(w),[N,Z]=ta.useState(v),[je,Y]=ta.useState(I),[rt,oe]=ta.useState(x),[ce,ae]=ta.useState(null),[te,ke]=ta.useState(null),[j,Ie]=ta.useState(null),[pt,Ge]=ta.useState(),[Se,qe]=ta.useState([]),[ot,Ye]=ta.useState(null),[dt,st]=ta.useState("form"),Me=ta.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,be=ta.useRef(null),we=!!b&&!!O&&!!B,{data:ze,isLoading:ut}=hp(r,e&&u==="form"),ht=ze?.data??[],{data:xt,isLoading:lr}=Um({sourceChainType:b,sourceChainId:O,sourceTokenAddress:B,sourceTokenSymbol:N,publishableKey:r,enabled:e&&we&&u==="form"}),Ue=gc.includes(b)?b:void 0,{data:me,isLoading:Je}=Nm({address:n,chainType:Ue,chainId:O,tokenAddress:B,publishableKey:r,enabled:e&&we}),{executions:Qe}=Hm({userId:o,publishableKey:r,depositWalletId:pt,enabled:!!pt&&e,onWithdrawSuccess:g,onWithdrawError:k});ta.useEffect(()=>{if(!e||u!=="tracker")return;let J=false;return ln(o,r,"withdraw").then(K=>{J||qe(K.data);}).catch(console.error),()=>{J=true;}},[e,u,o,r]),ta.useEffect(()=>{e&&(be.current&&(clearTimeout(be.current),be.current=null),T("form"),A(S),F(h),W(w),Z(v),Y(I),oe(x),ae(null),ke(null),Ie(null),Ge(void 0),qe([]),Ye(null),st("form"),Me.setValue(reactNative.Dimensions.get("window").width));},[e]),ta.useEffect(()=>()=>{be.current&&clearTimeout(be.current);},[]),ta.useEffect(()=>{rt||xt?.iconUrl&&oe(xt.iconUrl);},[xt?.iconUrl,rt]),ta.useEffect(()=>{je||xt?.chainName&&Y(xt.chainName);},[xt?.chainName,je]),ta.useEffect(()=>{if(!ht.length||ce)return;let J,K;if(s&&a)if(l)for(let _e of ht){let et=_e.chains.find(L=>L.chain_type===s&&L.chain_id===a&&L.token_address.toLowerCase()===l.toLowerCase());if(et){J=_e,K=et;break}}else for(let _e of ht){let et=_e.chains.find(L=>L.chain_type===s&&L.chain_id===a);if(et){J=_e,K=et;break}}J||(J=ht[0]),J&&(ae(J),ke(K??J.chains[0]??null));},[ht,ce,s,a,l]),ta.useEffect(()=>{u==="confirming"&&Qe.length>0&&T("details");},[u,Qe]);let Ve=ta.useCallback(()=>{t(),be.current=setTimeout(()=>{T("form"),A(S),F(h),W(w),Z(v),Y(I),oe(x),ae(null),ke(null),Ie(null),Ge(void 0),qe([]),Ye(null),st("form"),be.current=null;},300);},[t,S,h,w,v,I,x]),he=ta.useCallback(J=>{let K=ht.find(_e=>_e.symbol===J);K&&(ae(K),K.chains.length>0&&ke(K.chains[0]));},[ht]),Ne=ta.useCallback(J=>{if(!ce)return;let K=ce.chains.find(_e=>xw(_e.chain_id,_e.chain_type)===J);K&&ke(K);},[ce]),vt=ta.useCallback(async J=>{let K=await Zo({external_user_id:o,destination_chain_type:J.destinationChainType,destination_chain_id:J.destinationChainId,destination_token_address:J.destinationTokenAddress,recipient_address:J.recipientAddress,action_type:"withdraw"},r);if(!b)throw new Error("sourceChainType is required for withdrawal");let _e=an(K.data,b);if(!_e)throw new Error(`No deposit wallet found for chain type: ${b}`);return Ge(_e.id),{id:_e.id,address:_e.address}},[o,r,b]),Vt=ta.useCallback(J=>{Ie(J),T("confirming");},[]),Ht=ta.useCallback(J=>{Ye(J),Me.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Me,{toValue:0,duration:280,useNativeDriver:true}).start();},[Me]),lt=ta.useCallback(()=>{reactNative.Animated.timing(Me,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ye(null));},[Me]),er=ut||lr,Xe=xt?.isSupported??null,yt=u==="confirming"?"Withdrawal Status":c,gt=f?.globalBorderTopLeftRadius,De=f?.globalBorderTopRightRadius,at=f?.main?.borderTopLeftRadius??gt,X=f?.main?.borderTopRightRadius??De,Pe=f?.tokenSelector?.borderTopLeftRadius??gt,_=f?.tokenSelector?.borderTopRightRadius??De,C=f?.chainSelector?.borderTopLeftRadius??gt,M=f?.chainSelector?.borderTopRightRadius??De,q=(()=>{if(u!=="form"||!we||Je||!me)return;let J=N||me.symbol,K=me.balanceUsd;if(K!=null){let L=`$${parseFloat(K).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return J?`Balance: ${L} ${J}`:`Balance: ${L}`}let _e=me.balanceHuman;if(!(!_e||_e==="0"))return J?`Balance: ${_e} ${J}`:`Balance: ${_e}`})();return jsxRuntime.jsx(rr,{visible:e,onClose:Ve,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:at,borderTopRightRadius:X,children:u==="confirming"&&j?jsxRuntime.jsx(Sp,{txInfo:j,executions:Qe,onClose:Ve,onViewTracker:()=>{st("confirming"),T("tracker");}}):u==="details"&&j?jsxRuntime.jsx(Ym,{execution:Qe.length>0?Qe[Qe.length-1]:null,txInfo:j,onClose:Ve,onViewHistory:()=>{st("details"),T("tracker");},onHeaderClose:()=>T("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Vi.trackerContainer,children:[jsxRuntime.jsx(fo,{title:"Withdrawal History",onClose:()=>T(dt)}),Se.length===0?jsxRuntime.jsx(reactNative.View,{style:Vi.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Vi.emptyText,{color:P.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Za,{data:Se,keyExtractor:J=>J.id,contentContainerStyle:Vi.listContent,showsVerticalScrollIndicator:false,renderItem:({item:J})=>jsxRuntime.jsx(Cp,{execution:J,onPress:()=>Ht(J)})}),ot&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Vi.historyDetailOverlay,{backgroundColor:P.background,transform:[{translateX:Me}]}],children:jsxRuntime.jsx(Ym,{execution:ot,txInfo:a0(ot),onClose:Ve,onBack:lt,onViewHistory:lt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:yt,subtitle:q,onClose:Ve}),er?jsxRuntime.jsx(l0,{}):Xe===false?jsxRuntime.jsxs(reactNative.View,{style:Vi.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vi.unsupportedTitle,{color:P.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Vi.unsupportedMessage,{color:P.foregroundMuted,fontFamily:m.regular}],children:xt?.errorMessage})]}):jsxRuntime.jsx(c0,{publishableKey:r,sourceChainType:b??"",sourceChainId:O??"",sourceTokenAddress:B??"",sourceTokenSymbol:N,sourceChainName:je,sourceTokenIconUrl:rt,recipientAddressProp:i,destinationTokens:ht,selectedToken:ce,selectedChain:te,selectedChainKey:te?xw(te.chain_id,te.chain_type):null,onTokenChange:he,onChainChange:Ne,tokensLoading:ut,balanceData:me??null,isLoadingBalance:Je,sourceValidation:xt??null,onDepositWalletCreation:vt,onWithdraw:p,onWithdrawError:k,onWithdrawSubmitted:Vt,onViewTracker:()=>{st("form"),T("tracker");},tokenSelectorLeft:Pe,tokenSelectorRight:_,chainSelectorLeft:C,chainSelectorRight:M})]})})}function c0({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:g,onTokenChange:k,onChainChange:d,tokensLoading:f,balanceData:S,isLoadingBalance:h,sourceValidation:w,onDepositWalletCreation:v,onWithdraw:I,onWithdrawError:x,onWithdrawSubmitted:P,onViewTracker:m,tokenSelectorLeft:u,tokenSelectorRight:T,chainSelectorLeft:b,chainSelectorRight:A}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Yt,{style:{flex:1,paddingTop:16},contentContainerStyle:Vi.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Vi.doubleInputWrapper,children:jsxRuntime.jsx(Cd,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:g,onTokenChange:k,onChainChange:d,isLoading:f,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:T,chainPickerBorderTopLeftRadius:b,chainPickerBorderTopRightRadius:A})}),jsxRuntime.jsx(yp,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:S,isLoadingBalance:h,minimumWithdrawAmountUsd:w?.minimumAmountUsd??null,estimatedProcessingTime:w?.estimatedProcessingTime??null,maxSlippagePercent:w?.maxSlippagePercent??null,priceImpactPercent:w?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:v,onWithdraw:I,onWithdrawError:x,onWithdrawSubmitted:P,onViewTracker:m})]})})}var Vi=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 Rw=ta.createContext(null);function C0({children:e,publishableKey:t,config:r}){let[o]=ta.useState(()=>new Bf({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=ta.useState(false),[s,a]=ta.useState(null),[l,c]=ta.useState(false),[p,g]=ta.useState(null),k=reactNative.useColorScheme(),d=ta.useRef(false);d.current||(Ad({publishableKey:t}),d.current=true);let f=ta.useMemo(()=>{let W=r?.appearance||"dark";return W==="auto"?k==="dark"?"dark":"light":W},[r?.appearance,k]);ta.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.'),Ad({publishableKey:t});},[t]),ta.useEffect(()=>()=>{h.current&&clearTimeout(h.current),u.current&&clearTimeout(u.current);},[]);let S=ta.useRef(null),h=ta.useRef(null),w=ta.useRef(void 0),v=ta.useCallback(W=>{h.current&&(clearTimeout(h.current),h.current=null),S.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),S.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),S.current=null);let N=new Promise((Z,je)=>{S.current={resolve:Z,reject:je};});return w.current=W.onDismiss,a(W),i(true),N},[]),I=ta.useCallback(()=>{let W=S.current!==null;S.current&&(S.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),S.current=null);let N=w.current;w.current=void 0,i(false),h.current=setTimeout(()=>{a(null),h.current=null;},200),W&&N?.();},[]),x=ta.useCallback(W=>{s?.onSuccess&&s.onSuccess(W),S.current&&(S.current.resolve(W),S.current=null);},[s]),P=ta.useCallback(W=>{console.error("[UnifoldProvider] Deposit error:",W),s?.onError&&s.onError(W),S.current&&(S.current.reject(W),S.current=null);},[s]),m=ta.useRef(null),u=ta.useRef(null),T=ta.useRef(void 0),b=ta.useCallback(W=>{u.current&&(clearTimeout(u.current),u.current=null),m.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),m.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),m.current=null);let N=new Promise((Z,je)=>{m.current={resolve:Z,reject:je};});return T.current=W.onClose,g(W),c(true),N},[]),A=ta.useCallback(()=>{m.current&&(m.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),m.current=null),T.current?.(),T.current=void 0,c(false),u.current=setTimeout(()=>{g(null),u.current=null;},200);},[]),O=ta.useCallback(W=>{p?.onSuccess&&p.onSuccess(W),m.current&&(m.current.resolve(W),m.current=null);},[p]),F=ta.useCallback(W=>{console.error("[UnifoldProvider] Withdraw error:",W),p?.onError&&p.onError(W),m.current&&(m.current.reject(W),m.current=null);},[p]),B=ta.useMemo(()=>({publishableKey:t,beginDeposit:v,closeDeposit:I,beginWithdraw:b,closeWithdraw:A}),[t,v,I,b,A]);return jsxRuntime.jsx(Ef,{client:o,children:jsxRuntime.jsx(Rw.Provider,{value:B,children:jsxRuntime.jsxs(Ja,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(dp,{visible:n,onClose:I,closeOnBackdropPress:s.closeOnBackdropPress??false,publishableKey:t,modalTitle:r?.modalTitle,transferCryptoTitle:r?.transferCryptoTitle,externalUserId:s.externalUserId,user:s.user,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeTheme:{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",initialScreen:s.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLink:r?.enableStripeLink,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableCoinbaseApplePay:r?.enableCoinbaseApplePay,enableFiatOnramp:r?.enableFiatOnramp,stripePaymentSelectorPosition:r?.stripeLink?.paymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeLink?.skipSuccessConfirmation,StripeOnrampComponent:Og(),onDepositSuccess:x,onDepositError:P,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(xp,{visible:l,onClose:A,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:O,onWithdrawError:F,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function S0(){let e=ta.useContext(Rw);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
125
|
-
exports.AmountScreen=Xd;exports.BottomSheet=rr;exports.KYCWizardScreen=eu;exports.OnrampScreen=du;exports.StripeOnramp=uu;exports.StripeOnrampPreconfigure=
|
|
124
|
+
`}function Du({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,enabled:a=true,user:l,prefilledEmail:c,preloadedWallets:u,onBack:h,onClose:k,onDepositSuccess:d,onDepositError:p,onExecutionsChange:T}){let{colors:m,fonts:w,components:R}=z(),v=R.input.borderRadius,x=R.input.borderWidth,F=R.button.borderRadius,f=R.card.borderRadius,g=l?.email?.trim(),b=g&&Iu.test(g)?g:null,C=`${t}:${e}`,O=yk,[V,P]=ta.useState("loading"),[B,W]=ta.useState(""),[j,Z]=ta.useState(""),[Oe,G]=ta.useState(false),[ot,te]=ta.useState([]),[de,ae]=ta.useState(null),[re,xe]=ta.useState(null),[$,Re]=ta.useState(""),[dt,Xe]=ta.useState(""),[Se,Ke]=ta.useState(null),[nt,Ge]=ta.useState(false),[pt,st]=ta.useState(0),[Ne,ye]=ta.useState(""),[be,He]=ta.useState(""),[ft,yt]=ta.useState(null),[xt,lr]=ta.useState(null),[$e,fe]=ta.useState(null),[Ye,Je]=ta.useState(null),[Ee,me]=ta.useState(false),[je,vt]=ta.useState(u??[]),[Bt,Nt]=ta.useState(null),[ct,er]=ta.useState(false),[tt,Ct]=ta.useState(false),[bt,Ae]=ta.useState(false),[at,X]=ta.useState(null),[Fe,_]=ta.useState(null),[S,M]=ta.useState(false),[q,J]=ta.useState(""),[K,ve]=ta.useState(""),[Ve,L]=ta.useState(null),[U,Ot]=ta.useState(false),We=j.length===10?`+1${j}`:"",De=Iu.test(B),wt=/^\+1\d{10}$/.test(We),lt=ft??bk,ee=ta.useRef(true),$r=zo(V),mt=zo(be),tr=zo(B),Ht=zo(xt),jr=zo($e),Rr=zo(Ye),ai=zo(je),on=zo(Bt),yo=zo(tt),Io=zo(Fe),Vn=zo(at),bo=zo(ct),na=zo(Ee),wo=zo(We),Li=zo(De),_t=zo(wt),oe=zo(U),we=ta.useRef(null),ht=ta.useRef(null),Cr=ta.useRef(null),Or=ta.useRef(null),$o=ta.useRef(null),D=ta.useRef(null),H=ta.useRef(null),ke=ta.useRef(null),Le=ta.useRef(null),qe=ta.useRef(null),et=ta.useRef(null),It=ta.useRef(null),Tr=ta.useRef(null),Et=ta.useRef(null),Kr=ta.useRef(null);ta.useEffect(()=>(ee.current=true,yn(),()=>{ee.current=false,Co();}),[]),ta.useEffect(()=>{let I=null;if(V==="emailInput"?I=It:V==="phoneInput"?I=Tr:V==="emailOtp"||V==="phoneOtp"?I=Et:V==="limitUpgradeForm"&&(I=Kr),!I)return;let E=setTimeout(()=>I?.current?.focus(),300);return ()=>clearTimeout(E)},[V]);function Co(){Cr.current&&clearTimeout(Cr.current),Cr.current=null,Or.current&&(Or.current.cancelled=true),Or.current=null,Bi(),D.current&&(D.current.cancelled=true),D.current=null,H.current&&clearInterval(H.current),H.current=null,Le.current&&clearTimeout(Le.current),Le.current=null,et.current&&clearTimeout(et.current),et.current=null;}function eo(){let I,E=on.current;if(E){let Q=E.destination_token_metadata?.chain_type;I=Q&&Fk.includes(Q)?Q:o;}else I=o;if(I)return ai.current.find(Q=>Q.chain_type===I)}async function yn(){if(!a){P("disabled");return}u&&u.length>0?(vt(u),ai.current=u):await vr(),ke.current=An(),Yo(),await Eo();}async function vr(){try{let I=await Zo({external_user_id:e,destination_chain_type:o??"ethereum",destination_chain_id:n,destination_token_address:i,recipient_address:r},t);if(!ee.current)return;vt(I.data),ai.current=I.data;}catch{}}async function An(){if(!i||!n||!o)return;let I="US",E;try{let Q=await aa();I=(Q.alpha2||"US").toUpperCase(),E=Q.state&&Q.state.length>0?Q.state:void 0;}catch{}for(let Q=0;Q<Ey;Q++)try{let he=await bc({token_address:i,chain_id:n,chain_type:o,country_code:I,subdivision_code:E},t);if(!ee.current)return;Nt(he),on.current=he;return}catch{if(!ee.current)return;Q<Ey-1&&await od(Pk);}}async function Yo(){try{let I=await _h(t);if(!ee.current)return;te(I.agreements??[]);}catch{}}async function Eo(){let I=await Us.get(C),E=c&&Iu.test(c)?c:null;if(b){W(b),tr.current=b,G(true);let Wt=I&&I.email.toLowerCase()===b.toLowerCase()?om(I.phone):"";Z(Wt);}else if(I){W(I.email),tr.current=I.email;let Wt=om(I.phone);Z(Wt),G(true);}else G(false),E&&(W(E),tr.current=E);if(!I){P(b?"phoneInput":"emailInput");return}if(b&&I.email.toLowerCase()!==b.toLowerCase()){wo.current="",_t.current=false,P("phoneInput");return}let Q=om(I.phone),he=Q.length===10?`+1${Q}`:"";if(wo.current=he,_t.current=/^\+1\d{10}$/.test(he),Us.isOnrampTokenFresh(I)&&I.onrampToken&&I.onrampTokenExpiresAtMs!=null){let Wt={token:I.onrampToken,token_type:"Bearer",expires_in:Math.max(0,Math.floor((I.onrampTokenExpiresAtMs-Date.now())/1e3))};lr(Wt),Ht.current=Wt;}let ur=Us.isPhoneVerificationFresh(I),cr=/^\+1\d{10}$/.test(he)&&I.phone===he&&ur;if(cr)try{let Wt=await Tc(he,t);bn(Wt);let Gr=fs(Wt);if(Gr){ia(Gr,Wt.upgradeStatus);return}}catch{}if(Ht.current!=null&&cr){P("amount");return}Iu.test(tr.current)&&/^\+1\d{10}$/.test(he)?await xd():P("phoneInput");}function bn(I){let E=null;for(let Q of I.limits){if(!Q.currency)continue;let he=parseFloat(Q.remaining);Number.isFinite(he)&&(E=E==null?he:Math.min(E,he));}E!=null&&ee.current&&yt(Math.max(0,E));}function fs(I){if(!I.limitReached)return null;switch(I.upgradeStatus){case Ok:return "limitUpgradeIntro";case rm:return "limitUpgradeForm";case Vk:return "limitUpgradeSubmitting";case Wy:return null;case void 0:return I.limitUpgradeOptions&&I.limitUpgradeOptions.length>0?"limitUpgradeIntro":"guestLimitReached";default:return "guestLimitReached"}}function Ln(){if(!_t.current){P("guestLimitReached");return}(async()=>{try{let I=await Tc(wo.current,t);if(!ee.current)return;bn(I);let E=fs(I);E?ia(E,I.upgradeStatus):Ht.current!=null?P("amount"):await xd();}catch{ee.current&&P("guestLimitReached");}})();}function ia(I,E){fe(null),jr.current=null,Je(null),Rr.current=null,er(false),bo.current=false,L(I==="limitUpgradeForm"&&E===rm?se.upgradeVerifyFailed:null),P(I),I==="limitUpgradeSubmitting"&&th();}async function vp(){!Li.current||!_t.current||await xd();}async function xd(){P("submittingSession"),ye("");try{let I=await Rh({email:tr.current,phone:wo.current,terms_accepted:!0,email_already_verified:!0},t),E=I.client_secret;if(!E)throw new Error("Missing required field: client_secret");await Dp();let Q=Md(I.email)?"phone":"email";if(await zd(I.id,Q,E,t),!ee.current)return;ae(I),xe(E),Ip(),P(Q==="phone"?"phoneOtp":"emailOtp");}catch(I){if(!ee.current)return;ye(Bl(I)),P("phoneInput");}}async function Sw(){let I=de,E=re;if(!(!I||!E||$.length!==vu||nt)){Ke(null),Ge(true);try{let Q=await Xp(I.id,"email",E,$,t);if(Md(Q.email)){if(await Dp({emailVerifiedAt:Q.email.verified_at}),await zd(Q.id,"phone",E,t),!ee.current)return;ae(Q),Re(""),Ip(),Ge(!1),P("phoneOtp");}else {if(!ee.current)return;Ke(se.incorrectCode),Re(""),Ge(!1);}}catch(Q){if(!ee.current)return;Ke(Bl(Q)),Re(""),Ge(false);}}}async function Tw(){let I=de,E=re;if(!(!I||!E||dt.length!==vu||nt)){Ke(null),Ge(true);try{let Q=await Xp(I.id,"phone",E,dt,t);if(Md(Q.phone)&&Q.status==="verified"){let he=await vh(Q.id,E,t);if(await Dp({emailVerifiedAt:Q.email.verified_at,phoneVerifiedAt:Q.phone.verified_at,onrampToken:he.token,onrampTokenExpiresAtMs:Date.now()+he.expires_in*1e3}),!ee.current)return;ae(Q),lr(he),Ht.current=he,G(!0),Xe("");try{let ur=await Tc(wo.current,t);bn(ur);let cr=fs(ur);if(cr){if(!ee.current)return;Ge(!1),ia(cr,ur.upgradeStatus);return}}catch{}if(!ee.current)return;Ge(!1),P("amount");}else {if(!ee.current)return;Ke(se.incorrectCode),Xe(""),Ge(!1);}}catch(Q){if(!ee.current)return;Ke(Bl(Q)),Xe(""),Ge(false);}}}function kw(I){let E=de,Q=re;!E||!Q||(async()=>{try{if(await zd(E.id,I?"email":"phone",Q,t),!ee.current)return;Ke(null),Ip();}catch(he){ee.current&&Ke(Bl(he));}})();}function Ip(){st(Ck),H.current&&clearInterval(H.current),H.current=setInterval(()=>{st(I=>I<=1?(H.current&&clearInterval(H.current),H.current=null,0):I-1);},1e3);}function ja(I){let E=I;if(!(E===""||/^\d*\.?\d{0,2}$/.test(E))){let Gr=Rr.current??"";He(Gr),mt.current=Gr;return}if(E.length>1&&E.startsWith("0")&&!E.startsWith("0.")&&(E=E.replace(/^0+/,""),E===""&&(E="0")),He(E),mt.current=E,ye(""),Rr.current===E&&jr.current!=null)return;let Q=parseFloat(E)||0,he=E!==""&&Q>=O&&Q<=lt;Rr.current!==E&&(fe(null),jr.current=null,Je(null),Rr.current=null,er(false),bo.current=false),Cr.current&&clearTimeout(Cr.current),Cr.current=null,Or.current&&(Or.current.cancelled=true),Or.current=null;let ur=Ht.current?.token;if(!he||!ur){me(false);return}let cr={cancelled:false};Or.current=cr;let Wt=E;Cr.current=setTimeout(()=>{(async()=>{if(!cr.cancelled){me(true);try{await _w(ur,Wt,cr);}finally{ee.current&&Or.current===cr&&(jr.current!=null&&Rr.current===Wt||me(false));}}})();},Sk);}function xw(I){if(na.current)return;let E=mt.current;if(I==="\u232B"){E.length>0&&ja(E.slice(0,-1));return}if(I==="."){if(E.includes("."))return;ja(E===""?"0.":E+".");return}let Q=E.indexOf(".");if(Q>=0){if(E.length-(Q+1)>=2)return;ja(E+I);}else {let he=E+I;for(;he.length>1&&he.startsWith("0");)he=he.slice(1);ja(he);}}function Jm(){if(Ht.current==null||jr.current!=null)return;let I=parseFloat(mt.current)||0;mt.current!==""&&I>=O&&I<=lt&&ja(mt.current);}async function _w(I,E,Q){if(ke.current&&await ke.current,Q.cancelled)return;let he=!!i&&!!n&&!!o;if(on.current==null&&he){let St=An();if(ke.current=St,await St,Q.cancelled||!ee.current)return}let ur,cr,Wt=on.current;if(Wt)ur=Wt.destination_currency,cr=Wt.destination_network;else {if(!o||!n){if(!ee.current)return;ye(se.destinationNotConfigured);return}let St=Mk(o,n);if(!St){if(!ee.current)return;ye(he?se.networkError:se.networkUnsupported);return}cr=St,ur=(s??"USDC").toLowerCase();}let Gr=eo()?.address;if(!Gr){if(!ee.current)return;ye(se.depositWalletUnavailable);return}let Yr=Ay("orsext");try{let St=await Ih({source_currency:"usd",source_amount:E,destination_currency:ur,destination_network:cr,wallet_address:Gr,email:tr.current||b||void 0,external_id:Yr},I,t);if(Q.cancelled||!ee.current||E!==mt.current)return;fe({url:St.url}),jr.current={url:St.url},Je(E),Rr.current=E;}catch(St){if(Q.cancelled||!ee.current)return;let Po=St instanceof Error?St.message:String(St);if($k(St)){let ms=await Us.get(C);if(ms&&(ms.onrampToken=null,ms.onrampTokenExpiresAtMs=null,await Us.set(C,ms)),!ee.current)return;lr(null),Ht.current=null,fe(null),jr.current=null,Je(null),Rr.current=null,G(true),P("phoneInput");return}if(Hk(Po)){fe(null),jr.current=null,Je(null),Rr.current=null,ye(""),Ln();return}fe(null),jr.current=null,Je(null),Rr.current=null,ye(Bl(St));}}function Zm(I,E,Q){switch(I){case "unifold.pay_authorized":{if($r.current!=="amount"||yo.current)return;Ct(true),yo.current=true,Pp();break}case "unifold.pay_cancelled":{if($r.current!=="amount"||!yo.current||Io.current!=null||Vn.current!=null)return;Bi(),Ae(false),we.current=null,Ct(false),yo.current=false;break}case "onramp_api.commit_success":case "onramp_api.polling_success":{if($r.current!=="amount"||Vn.current!=null)return;let he=Io.current;if(he&&["succeeded","failed","refunded"].includes(he.status))return;yo.current?$o.current==null&&Pp():(Ct(true),yo.current=true,Pp());break}case "onramp_api.commit_error":{E&&["ERROR_CODE_GUEST_TRANSACTION_COUNT","ERROR_CODE_GUEST_DAILY_TRANSACTION_COUNT","ERROR_CODE_GUEST_TRANSACTION_LIMIT"].includes(E)?(Bi(),Ct(false),yo.current=false,Ln()):Xm(Q);break}case "onramp_api.polling_error":case "onramp_api.polling_failed":{Xm(Q);break}}}function Xm(I){if($r.current!=="amount")return;let E=Io.current;if(E&&["succeeded","failed","refunded"].includes(E.status))return;Bi(),Ae(false),_(null),Io.current=null,we.current=null;let Q=I&&I.trim().length>0?I.trim():se.paymentErrorFallback;X(Q),Vn.current=Q,yo.current||(Ct(true),yo.current=true),p?.({message:Q});}function Bi(){$o.current&&($o.current.cancelled=true),$o.current=null;}function Pp(){Bi(),Ae(false),X(null),Vn.current=null;let I={cancelled:false};$o.current=I;let E=Date.now();(async()=>{let Q=E+xk,he=ht.current,ur=he!=null;if(he==null)for(let St=0;St<Ly&&!I.cancelled&&Date.now()<Q;St++){if(he=await eh(),I.cancelled)return;if(he!=null){ur=St===0;break}await od(By);}if(I.cancelled)return;let cr=he!=null&&ur,Wt=cr?he:new Set,Gr=cr?E-Rk:E;for(;!I.cancelled&&Date.now()<Q;){if(await vw(I,Gr,Wt),I.cancelled)return;let St=eo()?.id;if(St)try{await Sc({deposit_wallet_id:St},t);}catch{}await od(_k);}if(I.cancelled||!ee.current)return;let Yr=Io.current;Yr&&["succeeded","failed","refunded"].includes(Yr.status)||yo.current&&(Ae(true),p?.({message:"Timed out waiting for the deposit to be detected. It may still complete.",code:"polling_timeout"}));})();}async function eh(){try{let I=await sn(e,t,"deposit");return new Set(I.data.map(E=>E.id))}catch{return null}}async function Rw(){for(let I=0;I<Ly&&ee.current;I++){let E=await eh();if(!ee.current)return;if(E!=null){ht.current=E;return}await od(By);}}async function vw(I,E,Q){try{let ur=[...(await sn(e,t,"deposit")).data].sort((Gr,Yr)=>{let St=Fu(Gr.created_at)??0;return (Fu(Yr.created_at)??0)-St}),cr=eo()?.id,Wt=ur.find(Gr=>{let Yr=we.current;if(Yr)return Gr.id===Yr;let St=Fu(Gr.created_at);return St===null||St<=E||!cr||Gr.deposit_wallet_id!==cr?!1:!Q.has(Gr.id)});if(!Wt||I.cancelled||!ee.current)return;we.current==null&&(we.current=Wt.id),_(Wt),Io.current=Wt,T?.([Wt]),Wt.status==="succeeded"?(Bi(),Ct(!1),yo.current=!1,P("success"),d?.({message:"Deposit completed successfully",executionId:Wt.id,transaction:Wt})):(Wt.status==="failed"||Wt.status==="refunded")&&(Bi(),Ct(!1),yo.current=!1,P("success"),p?.({message:`Deposit ${Wt.status}`}));}catch{}}function Fp(){ve(""),J("");}function Iw(){if(oe.current)return;let I=Uy(q);!I||!/^\d{4}$/.test(K)||(Ot(true),oe.current=true,L(null),P("limitUpgradeSubmitting"),D.current&&(D.current.cancelled=true),D.current=null,(async()=>{try{await Ph({phone:wo.current,fields:{ssnLast4:K,dateOfBirth:I}},t);}catch(E){if(!ee.current)return;let Q=E instanceof Error?E.message:String(E);Ot(false),oe.current=false,jk(Q)?(Fp(),L(null),P("guestLimitReached")):(L(Bl(E)),P("limitUpgradeForm"));return}ee.current&&(Ot(false),oe.current=false,th());})());}function th(){D.current&&(D.current.cancelled=true);let I={cancelled:false};D.current=I,Pw(I);}async function Pw(I){let E=Date.now(),Q=true;for(;Date.now()-E<Ik;){if(I.cancelled||(Q||await od(vk),Q=false,I.cancelled))return;let he;try{he=await Tc(wo.current,t);}catch{continue}if(I.cancelled||!ee.current)return;bn(he);let ur=he.upgradeStatus,cr=he.limitReached;if(ur===Wy||!cr){let Wt=Ht.current!=null;if(Fp(),L(null),Wt)P("amount");else {if(I.cancelled)return;await xd();}return}if(ur===Ak){Fp(),L(null),P("guestLimitReached");return}if(ur===rm){ve(""),L(se.upgradeVerifyFailed),P("limitUpgradeForm");return}}I.cancelled||!ee.current||(L(null),P("limitUpgradeFailed"));}async function Dp(I){let E=await Us.get(C),he=E?.phone===wo.current&&E?.email.toLowerCase()===tr.current.toLowerCase()?E:null,ur={email:tr.current,phone:wo.current,termsAcceptedAt:he?.termsAcceptedAt??Qk(),phoneVerifiedAt:I?.phoneVerifiedAt??he?.phoneVerifiedAt??null,emailVerifiedAt:I?.emailVerifiedAt??he?.emailVerifiedAt??null,onrampToken:I?.onrampToken??he?.onrampToken??null,onrampTokenExpiresAtMs:I?.onrampTokenExpiresAtMs??he?.onrampTokenExpiresAtMs??null};await Us.set(C,ur);}function rh(){if(tt){Bi(),Ct(false),yo.current=false,Ae(false),X(null),Vn.current=null,_(null),Io.current=null,we.current=null,ye(""),fe(null),jr.current=null,Je(null),Rr.current=null,er(false),bo.current=false,Jm();return}switch(V){case "phoneInput":Oe?h():P("emailInput");break;case "emailOtp":Re(""),P("phoneInput");break;case "phoneOtp":Xe(""),P("phoneInput");break;case "checkingDeposit":Bi(),Ae(false),X(null),Vn.current=null,fe(null),jr.current=null,Je(null),Rr.current=null,ye(""),_(null),Io.current=null,we.current=null,P("amount");break;case "limitUpgradeForm":L(null),P("limitUpgradeIntro");break;default:h();break}}function Op(){Co(),k();}let Fw=(()=>{if(tt)return se.checkingHeaderTitle;switch(V){case "emailInput":case "phoneInput":case "submittingSession":return se.title;case "emailOtp":return se.emailOtpHeaderTitle;case "phoneOtp":return se.phoneHeaderTitle;case "amount":return se.amountHeaderTitle;case "checkingDeposit":return se.checkingHeaderTitle;case "guestLimitReached":case "limitUpgradeIntro":case "limitUpgradeFailed":return se.guestLimitHeaderTitle;case "limitUpgradeForm":case "limitUpgradeSubmitting":return se.upgradeHeaderTitle;default:return se.title}})(),Dw=(()=>{if(tt)return true;switch(V){case "emailInput":case "phoneInput":case "amount":case "emailOtp":case "phoneOtp":case "checkingDeposit":case "limitUpgradeForm":return true;default:return false}})();function li({title:I,enabled:E,loading:Q,onPress:he}){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:he,disabled:!E,activeOpacity:.85,style:[A.primaryButton,{backgroundColor:E?m.primary:`${m.primary}80`,borderRadius:F}],children:[Q&&jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:m.primaryForeground,gradientTo:m.primaryForeground}),jsxRuntime.jsx(reactNative.Text,{style:[A.primaryButtonText,{color:m.primaryForeground,fontFamily:w.medium}],children:I})]})}function oh(){let I=ot.length>0?ot:Dk;return jsxRuntime.jsx(reactNative.View,{style:A.legalWrapper,children:jsxRuntime.jsxs(reactNative.Text,{style:[A.legalText,{color:m.foregroundMuted,fontFamily:w.regular}],children:[se.disclaimerPrefix,I.map((E,Q)=>{let he="";return Q<I.length-2?he=", ":Q===I.length-2&&(he=", and "),jsxRuntime.jsxs(reactNative.Text,{children:[jsxRuntime.jsx(reactNative.Text,{style:{color:m.foreground,textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL(E.url).catch(()=>{}),children:E.name}),he]},E.key)}),se.disclaimerSuffix]})})}function _d(I,E){return jsxRuntime.jsxs(reactNative.View,{style:A.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.detailLabel,{color:m.foregroundMuted,fontFamily:w.regular}],children:I}),jsxRuntime.jsx(reactNative.Text,{style:[A.detailValue,{color:m.foreground,fontFamily:w.medium}],children:E})]},I)}function nh(I,E,Q){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[A.txRow,{backgroundColor:m.card,borderColor:m.border,borderRadius:f}],onPress:()=>reactNative.Linking.openURL(Q).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.txLabel,{color:m.foreground,fontFamily:w.medium}],children:I}),jsxRuntime.jsxs(reactNative.View,{style:A.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.txHash,{color:m.foregroundMuted}],children:E}),jsxRuntime.jsx(reactNative.Text,{style:[A.txArrow,{color:m.foregroundMuted}],children:"\u2197"})]})]},I)}function Ow(){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredFull,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.centerIcon,{color:m.foregroundMuted}],children:"\u26A0\uFE0E"}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.medium}],children:se.disabledTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.disabledDescription})]})}function Vw(){return jsxRuntime.jsxs(reactNative.View,{style:A.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:A.flex}),jsxRuntime.jsx(reactNative.Text,{style:[A.fieldLabel,{color:m.foregroundMuted,fontFamily:w.medium}],children:se.emailLabel}),jsxRuntime.jsx(reactNative.TextInput,{ref:It,value:B,onChangeText:I=>{let E=I.replace(/\s/g,"");W(E),tr.current=E;},placeholder:se.emailPlaceholder,placeholderTextColor:m.foregroundMuted,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,style:[A.input,{color:m.foreground,backgroundColor:m.card,borderColor:m.border,borderRadius:v,borderWidth:x,fontFamily:w.regular}]}),jsxRuntime.jsx(reactNative.View,{style:{height:24}}),oh(),jsxRuntime.jsx(li,{title:se.continueButton,enabled:De,loading:false,onPress:()=>P("phoneInput")}),jsxRuntime.jsx(reactNative.View,{style:A.flex})]})}function Aw(){let I=V==="submittingSession";return jsxRuntime.jsxs(reactNative.View,{style:A.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:A.flex}),jsxRuntime.jsx(reactNative.Text,{style:[A.fieldLabel,{color:m.foregroundMuted,fontFamily:w.medium}],children:se.phoneLabel}),jsxRuntime.jsxs(reactNative.View,{style:[A.phoneRow,{backgroundColor:m.card,borderColor:m.border,borderRadius:v,borderWidth:x}],children:[jsxRuntime.jsx(reactNative.View,{style:[A.phonePrefix,{borderRightColor:m.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[A.phonePrefixText,{color:m.foregroundMuted,fontFamily:w.medium}],children:"+1"})}),jsxRuntime.jsx(reactNative.TextInput,{ref:Tr,value:j,editable:!I,onChangeText:E=>{let Q=E.replace(/\D/g,"");Q.length===11&&Q.startsWith("1")&&(Q=Q.slice(1)),Q.length>10&&(Q=Q.slice(0,10)),Z(Q);},placeholder:se.phonePlaceholder,placeholderTextColor:m.foregroundMuted,keyboardType:"number-pad",style:[A.phoneInput,{color:m.foreground,fontFamily:w.regular}]})]}),j.length>0&&!wt?jsxRuntime.jsx(reactNative.Text,{style:[A.warningText,{color:m.warning,fontFamily:w.regular}],children:se.phoneInvalid}):null,Ne.length>0?jsxRuntime.jsx(reactNative.Text,{style:[A.warningText,{color:m.warning,fontFamily:w.regular}],children:Ne}):null,jsxRuntime.jsx(reactNative.View,{style:{height:24}}),Oe?oh():null,jsxRuntime.jsx(li,{title:se.sendCode,enabled:wt&&!I,loading:I,onPress:()=>{vp();}}),jsxRuntime.jsx(reactNative.View,{style:A.flex})]})}function Lw(){let I=V==="emailOtp",E=I?Lk(B):Bk(We),Q=I?$:dt,he=Q.length===vu&&!nt;return jsxRuntime.jsxs(reactNative.View,{style:A.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:A.flex}),jsxRuntime.jsx(reactNative.Text,{style:[A.otpSentTo,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.sentTo(E)}),jsxRuntime.jsx(reactNative.TextInput,{ref:Et,value:Q,onChangeText:ur=>{let cr=ur.replace(/\D/g,"").slice(0,vu);I?Re(cr):Xe(cr),Ke(null);},placeholder:se.otpPlaceholder,placeholderTextColor:m.foregroundMuted,keyboardType:"number-pad",style:[A.otpInput,{color:m.foreground,backgroundColor:m.card,borderColor:Se?m.error:m.border,borderRadius:v,fontFamily:w.medium}]}),Se?jsxRuntime.jsx(reactNative.Text,{style:[A.errorTextCentered,{color:m.error,fontFamily:w.regular}],children:Se}):null,jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>kw(I),disabled:pt>0||!de||!re,style:A.resendButton,children:jsxRuntime.jsx(reactNative.Text,{style:[A.resendText,{color:m.foregroundMuted,fontFamily:w.regular}],children:pt>0?se.resendIn(pt):se.resendCode})}),jsxRuntime.jsx(reactNative.View,{style:{height:24}}),jsxRuntime.jsx(li,{title:se.verify,enabled:he,loading:nt,onPress:()=>I?void Sw():void Tw()}),jsxRuntime.jsx(reactNative.View,{style:A.flex})]})}function Bw(){let I=parseFloat(be)||0,E=be!==""&&I>0,Q=E&&I<O,he=E&&I>lt,ur=E&&!Q&&!he,cr=Ye===be&&ur&&$e?.url?Kk($e.url):null,Wt=Math.max(60-be.length*2.5,32),Gr=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];return jsxRuntime.jsxs(reactNative.View,{style:A.flex,children:[jsxRuntime.jsx(reactNative.View,{style:{flex:1,minHeight:24}}),jsxRuntime.jsxs(reactNative.View,{style:A.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:A.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.amountDollar,{color:m.foreground,fontSize:Wt}],children:"$"}),jsxRuntime.jsx(reactNative.Text,{style:[A.amountValue,{color:be===""?m.foregroundMuted:m.foreground,fontSize:Wt}],children:be===""?"0":be})]}),Q?jsxRuntime.jsx(reactNative.Text,{style:[A.amountHint,{color:m.warning,fontFamily:w.regular}],children:se.minimumAmount(My(O))}):null,he?jsxRuntime.jsx(reactNative.Text,{style:[A.amountHint,{color:m.warning,fontFamily:w.regular}],children:se.maximumAmount(My(lt))}):null,Ne.length>0?jsxRuntime.jsx(reactNative.Text,{style:[A.amountHint,{color:m.warning,fontFamily:w.regular,textAlign:"center"}],children:Ne}):null]}),jsxRuntime.jsx(reactNative.View,{style:{flex:1,minHeight:24}}),jsxRuntime.jsxs(reactNative.View,{style:[A.keypadArea,{opacity:Ee?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:A.quickAmountsRow,children:wk.map(Yr=>{let St=parseFloat(be)===Yr,Po=Yr>lt;return jsxRuntime.jsx(reactNative.TouchableOpacity,{disabled:Ee||Po,onPress:()=>ja(String(Yr)),activeOpacity:.7,style:[A.quickAmountButton,{backgroundColor:m.card,borderColor:St?m.primary:m.border,borderRadius:v,opacity:Po?.4:1}],children:jsxRuntime.jsxs(reactNative.Text,{style:[A.quickAmountText,{color:m.foreground,fontFamily:w.medium}],children:["$",Yr]})},Yr)})}),jsxRuntime.jsx(reactNative.View,{style:A.keypad,children:Gr.map((Yr,St)=>jsxRuntime.jsx(reactNative.View,{style:A.keypadRow,children:Yr.map(Po=>jsxRuntime.jsx(reactNative.TouchableOpacity,{disabled:Ee,onPress:()=>xw(Po),activeOpacity:.6,style:A.keypadKey,children:jsxRuntime.jsx(reactNative.Text,{style:[A.keypadKeyText,{color:m.foreground,fontFamily:w.medium}],children:Po==="\u232B"?"\u232B":Po})},Po))},St))})]}),jsxRuntime.jsx(reactNative.View,{style:A.payButtonContainer,children:cr?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ct?jsxRuntime.jsxs(reactNative.View,{style:A.applePayMarkRow,children:[jsxRuntime.jsx(Gk,{size:16,color:m.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[A.applePayMarkText,{color:m.foregroundMuted,fontFamily:w.medium}],children:"Pay"})]}):null,jsxRuntime.jsxs(reactNative.View,{style:A.applePayButtonStack,children:[jsxRuntime.jsx(reactNativeWebview.WebView,{ref:qe,source:{uri:cr},style:[A.applePayWebView,{opacity:ct?.02:0}],containerStyle:A.applePayWebViewContainer,pointerEvents:ct?"auto":"none",originWhitelist:["*"],javaScriptEnabled:true,domStorageEnabled:true,scrollEnabled:false,bounces:false,androidLayerType:"hardware",injectedJavaScriptBeforeContentLoaded:Yk(F,Hy),onMessage:Yr=>{try{let St=JSON.parse(Yr.nativeEvent.data);if(!St)return;if(!St.__uf){if(typeof St.eventName=="string"){let Po=St.data||{};Zm(St.eventName,Po.errorCode,Po.errorMessage);}return}if(St.channel==="cbSize")Number(St.body)>0&&(et.current&&(clearTimeout(et.current),et.current=null),bo.current||(er(!0),bo.current=!0),me(!1));else if(St.channel==="cbProbe")ah(Number(St.body)===1);else if(St.channel==="cbOnramp"){let Po=typeof St.body=="string"?JSON.parse(St.body):St.body;if(!Po)return;let ms=Po.data||{};Zm(Po.eventName,ms.errorCode,ms.errorMessage);}}catch{}}},cr),ct?jsxRuntime.jsx(reactNative.View,{pointerEvents:"none",style:[A.applePayBrandButton,{backgroundColor:m.primary,borderRadius:F}],children:jsxRuntime.jsx(reactNative.Text,{style:[A.applePayBrandText,{color:"#fff",fontFamily:w.semibold}],children:se.continuePay})}):null,ct?null:ih(ur)]})]}):ih(ur)})]})}function ih(I){return jsxRuntime.jsxs(reactNative.View,{style:[A.preparingButton,{backgroundColor:`${m.primary}80`,borderRadius:F}],children:[I?jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:"#fff",gradientTo:"#fff"}):null,jsxRuntime.jsx(reactNative.Text,{style:[A.preparingButtonText,{color:"#fff",fontFamily:w.medium}],children:I?se.preparingApplePay:se.enterAmount})]})}function sh(){return at?Ww(at):bt?Ew():Fe?Mw(Fe):jsxRuntime.jsxs(reactNative.View,{style:A.centeredFull,children:[jsxRuntime.jsx(Te,{size:80,strokeWidth:4}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.checkingTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.checkingDescription})]})}function Ew(){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:A.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.centerIcon,{color:m.foregroundMuted}],children:"\u23F1"}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.checkingTimeoutTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.checkingTimeoutDescription})]}),jsxRuntime.jsx(reactNative.View,{style:A.bottomButton,children:jsxRuntime.jsx(li,{title:se.done,enabled:true,loading:false,onPress:Op})})]})}function Ww(I){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:A.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.centerIcon,{color:m.error}],children:"\u26A0\uFE0E"}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.paymentErrorTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:I})]}),jsxRuntime.jsx(reactNative.View,{style:A.bottomButton,children:jsxRuntime.jsx(li,{title:se.tryAgain,enabled:true,loading:false,onPress:rh})})]})}function Mw(I){let E=["pending","waiting","delayed"].includes(I.status),Q=["failed","refunded"].includes(I.status),he=Q?m.error:E?m.warning:m.success,ur=Q?se.failed:E?se.inProgress:se.completed,cr=zk(I.created_at),Wt=I.destination_token_metadata,Gr=Wt?.icon_urls?.find(Yr=>Yr.format==="png")?.url??Wt?.icon_url??null;return jsxRuntime.jsxs(reactNative.View,{style:A.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{contentContainerStyle:A.detailScrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:A.tokenIconWrapper,children:[Gr?jsxRuntime.jsx(reactNative.Image,{source:{uri:Gr,cache:"force-cache"},style:A.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[A.tokenIconFallback,{backgroundColor:m.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[A.tokenIconFallbackText,{color:m.foreground}],children:"$"})}),jsxRuntime.jsx(reactNative.View,{style:[A.statusBadge,{backgroundColor:he}],children:jsxRuntime.jsx(reactNative.Text,{style:A.statusBadgeText,children:Q?"\u2715":E?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.statusDot,{backgroundColor:he}]}),jsxRuntime.jsx(reactNative.Text,{style:[A.statusText,{color:m.foreground,fontFamily:w.semibold}],children:ur})]}),Q?jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular,marginBottom:8}],children:se.depositFailedDescription}):null,cr?jsxRuntime.jsx(reactNative.Text,{style:[A.dateText,{color:m.foregroundMuted,fontFamily:w.regular}],children:cr}):null,jsxRuntime.jsxs(reactNative.View,{style:[A.detailCard,{backgroundColor:m.card,borderColor:m.border,borderRadius:f}],children:[be!==""?_d(se.amountSent,`$${Ek(be)} USD`):null,_d(se.amountReceived,`${Uk(I)} ${Nk(I)}`),I.source_amount_usd?_d(se.usdValue,`$${(parseFloat(I.source_amount_usd)||0).toFixed(2)}`):null,I.destination_chain_id?_d(se.destinationNetwork,Wk(I.destination_chain_type??"",I.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:A.seeMoreRow,onPress:()=>M(Yr=>!Yr),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.seeMoreText,{color:m.foreground,fontFamily:w.medium}],children:S?se.seeLess:se.seeMoreDetails}),jsxRuntime.jsx(reactNative.Text,{style:[A.seeMoreChevron,{color:m.foregroundMuted}],children:S?"\u25B2":"\u25BC"})]}),S?jsxRuntime.jsxs(reactNative.View,{style:A.txHashSection,children:[I.explorer_url?nh(se.depositTx,zy(I.transaction_hash),I.explorer_url):null,!E&&!Q&&I.destination_explorer_url&&I.destination_transaction_hashes?.[0]?nh(se.completionTx,zy(I.destination_transaction_hashes[0]),I.destination_explorer_url):null]}):null]}),jsxRuntime.jsx(reactNative.View,{style:[A.bottomButton,A.detailBottomButton],children:jsxRuntime.jsx(li,{title:se.done,enabled:true,loading:false,onPress:Op})})]})}function zw(){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:A.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.guestLimitTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.guestLimitDescription})]}),jsxRuntime.jsx(reactNative.View,{style:A.bottomButton,children:jsxRuntime.jsx(li,{title:se.returnButton,enabled:true,loading:false,onPress:h})})]})}function Uw(){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:A.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.guestLimitTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.upgradeIntroDescription})]}),jsxRuntime.jsxs(reactNative.View,{style:A.bottomButton,children:[jsxRuntime.jsx(li,{title:se.continueButton,enabled:true,loading:false,onPress:()=>{L(null),P("limitUpgradeForm");}}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>{L(null),h();},style:A.textButton,children:jsxRuntime.jsx(reactNative.Text,{style:[A.textButtonLabel,{color:m.foregroundMuted,fontFamily:w.medium}],children:se.cancelButton})})]})]})}function Nw(){let I=Uy(q)!=null,E=/^\d{4}$/.test(K),Q=I&&E;return jsxRuntime.jsxs(reactNative.View,{style:A.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:A.flex}),jsxRuntime.jsx(reactNative.Text,{style:[A.fieldLabel,{color:m.foregroundMuted,fontFamily:w.medium}],children:se.dobLabel}),jsxRuntime.jsx(reactNative.TextInput,{ref:Kr,value:q,onChangeText:he=>{J(qk(he)),Ve&&L(null);},placeholder:se.dobPlaceholder,placeholderTextColor:m.foregroundMuted,keyboardType:"number-pad",style:[A.input,{color:m.foreground,backgroundColor:m.card,borderColor:m.border,borderRadius:v,borderWidth:x,fontFamily:w.regular}]}),jsxRuntime.jsx(reactNative.View,{style:{height:16}}),jsxRuntime.jsx(reactNative.Text,{style:[A.fieldLabel,{color:m.foregroundMuted,fontFamily:w.medium}],children:se.ssnLabel}),jsxRuntime.jsx(reactNative.TextInput,{value:K,onChangeText:he=>{ve(he.replace(/\D/g,"").slice(0,4)),Ve&&L(null);},placeholder:se.ssnPlaceholder,placeholderTextColor:m.foregroundMuted,keyboardType:"number-pad",secureTextEntry:true,style:[A.input,{color:m.foreground,backgroundColor:m.card,borderColor:m.border,borderRadius:v,borderWidth:x,fontFamily:w.regular}]}),Ve?jsxRuntime.jsx(reactNative.Text,{style:[A.warningText,{color:m.warning,fontFamily:w.regular}],children:Ve}):null,jsxRuntime.jsx(reactNative.View,{style:A.flex}),jsxRuntime.jsx(li,{title:se.submitButton,enabled:Q&&!U,loading:U,onPress:Iw}),jsxRuntime.jsx(reactNative.View,{style:A.flex})]})}function Hw(){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredFull,children:[jsxRuntime.jsx(Te,{size:80,strokeWidth:4}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.verifyingTitle}),jsxRuntime.jsx(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:se.verifyingDescription})]})}function $w(){return jsxRuntime.jsxs(reactNative.View,{style:A.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:A.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.stateTitle,{color:m.foreground,fontFamily:w.semibold}],children:se.upgradeFailedTitle}),jsxRuntime.jsxs(reactNative.Text,{style:[A.stateDescription,{color:m.foregroundMuted,fontFamily:w.regular}],children:[se.upgradeFailedPrefix,jsxRuntime.jsx(reactNative.Text,{style:{color:m.primary,textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL(se.supportUrl).catch(()=>{}),children:se.contactSupport}),se.upgradeFailedSuffix]})]}),jsxRuntime.jsx(reactNative.View,{style:A.bottomButton,children:jsxRuntime.jsx(li,{title:se.returnButton,enabled:true,loading:false,onPress:()=>{L(null),h();}})})]})}function jw(){switch(V){case "loading":return jsxRuntime.jsx(reactNative.View,{style:A.centeredFull,children:jsxRuntime.jsx(Te,{size:40,strokeWidth:3})});case "disabled":return Ow();case "emailInput":return Vw();case "phoneInput":case "submittingSession":return Aw();case "emailOtp":case "phoneOtp":return Lw();case "amount":return jsxRuntime.jsxs(reactNative.View,{style:A.flex,children:[Bw(),tt?jsxRuntime.jsx(reactNative.View,{style:[A.overlay,{backgroundColor:m.background}],children:sh()}):null]});case "checkingDeposit":case "success":return sh();case "guestLimitReached":return zw();case "limitUpgradeIntro":return Uw();case "limitUpgradeForm":return Nw();case "limitUpgradeSubmitting":return Hw();case "limitUpgradeFailed":return $w();default:return null}}ta.useEffect(()=>{V==="amount"&&Jm();},[V]);function qw(){!ee.current||bo.current||(er(true),bo.current=true,me(false));}function ah(I){if(et.current&&clearTimeout(et.current),et.current=null,!(!ee.current||bo.current)){if(I){qw();return}fe(null),jr.current=null,Je(null),Rr.current=null,er(false),bo.current=false,me(false),ye(se.applePayButtonUnavailable);}}return ta.useEffect(()=>{if(!(!(Ye===be&&$e?.url&&$e.url)||ct))return Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{!ee.current||bo.current||(qe.current?.injectJavaScript(Jk()),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{ah(false);},kk));},Tk),()=>{Le.current&&clearTimeout(Le.current),Le.current=null,et.current&&clearTimeout(et.current),et.current=null;}},[$e,Ye,be,ct]),ta.useEffect(()=>{ct?Rw():ht.current=null;},[ct]),jsxRuntime.jsxs(reactNative.View,{style:[A.root,{backgroundColor:m.background}],children:[jsxRuntime.jsx(fo,{title:Fw,showBack:Dw,showClose:true,onBack:rh,onClose:Op}),jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:A.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jw()})]})}var Pu={position:"absolute",left:0,right:0,top:0,bottom:0},A=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},overlay:{...Pu},formContainer:{flex:1,paddingHorizontal:16,paddingTop:16,paddingBottom:16},fieldLabel:{fontSize:12,paddingHorizontal:4,marginBottom:6},input:{fontSize:15,padding:14},phoneRow:{flexDirection:"row",alignItems:"center",height:50,overflow:"hidden"},phonePrefix:{paddingHorizontal:12,height:"100%",justifyContent:"center",borderRightWidth:1},phonePrefixText:{fontSize:15},phoneInput:{flex:1,fontSize:15,padding:14},warningText:{fontSize:12,paddingHorizontal:4,marginTop:6},otpSentTo:{fontSize:14,textAlign:"center",marginBottom:24},otpInput:{fontSize:24,textAlign:"center",paddingVertical:14,borderWidth:1.5},errorTextCentered:{fontSize:12,textAlign:"center",marginTop:8},resendButton:{marginTop:12,alignItems:"center"},resendText:{fontSize:12},legalWrapper:{paddingHorizontal:4,marginBottom:24},legalText:{fontSize:11,lineHeight:16},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:16},primaryButtonText:{fontSize:16},amountSection:{alignItems:"center",paddingHorizontal:16},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountValue:{fontWeight:"400"},amountHint:{fontSize:14,marginTop:4},keypadArea:{paddingHorizontal:16,paddingBottom:12,gap:16},quickAmountsRow:{flexDirection:"row",gap:12},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderWidth:1},quickAmountText:{fontSize:14},keypad:{gap:10},keypadRow:{flexDirection:"row",gap:10},keypadKey:{flex:1,height:52,alignItems:"center",justifyContent:"center"},keypadKeyText:{fontSize:24},payButtonContainer:{paddingHorizontal:16,paddingBottom:16},applePayMarkRow:{flexDirection:"row",alignItems:"center",gap:4,marginBottom:8},applePayMarkText:{fontSize:19},applePayButtonStack:{height:Hy,position:"relative"},applePayBrandButton:{...Pu,alignItems:"center",justifyContent:"center"},applePayBrandText:{fontSize:16},applePayWebView:{...Pu,backgroundColor:"transparent"},applePayWebViewContainer:{...Pu,backgroundColor:"transparent"},preparingButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:16},preparingButtonText:{fontSize:16},centeredFull:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},centeredWithButton:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:16,gap:12},centerIcon:{fontSize:40},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},bottomButton:{gap:8},detailBottomButton:{paddingHorizontal:16,paddingBottom:16},textButton:{alignItems:"center",paddingVertical:14,marginTop:4},textButtonLabel:{fontSize:16},detailScrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},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%",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,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}});var jy=5e3,qy=2500,Qy=5e3,Ky=6e4;function ii(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:i,publishableKey:s,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:u,setDepositExecutions:h,setTrackedExecutions:k,setLatestExecution:d,setShowStatusSheet:p,onDepositSuccess:T,onExecutionsChange:m,onDepositError:w}=e,[R,v]=ta.useState(false),[x,F]=ta.useState(false);return ta.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;v(false),t==="auto_ui"&&F(false);let g=setTimeout(()=>{v(true),t==="auto_ui"&&F(true);},jy);return ()=>clearTimeout(g)},[r,t,o,n]),ta.useEffect(()=>{if(!r||!i||!a)return;let g=new Date(a.getTime()-Ky),b=setInterval(async()=>{try{let V=[...(await sn(i,s,"deposit")).data??[]].sort((B,W)=>{let j=B.created_at?new Date(B.created_at).getTime():0;return (W.created_at?new Date(W.created_at).getTime():0)-j}),P=null;for(let B of V){let W=B.created_at?new Date(B.created_at):null;if(!W||W<=g)continue;let j=u.get(B.id);if(!j){P=B;break}if(["pending","waiting","delayed"].includes(j)&&B.status==="succeeded"){P=B;break}}if(P){let B=P;h(W=>{let j=W.findIndex(Z=>Z.id===B.id);if(j>=0){let Z=[...W];return Z[j]=B,Z}return [...W,B]}),k(W=>{let j=new Map(W);return j.set(B.id,B.status),j}),d(B),p(!0),B.status==="succeeded"&&T?.({message:"Deposit completed successfully",executionId:B.id}),m?.([...c,B]);}}catch(C){w?.({message:"Failed to check deposit status",error:C});}},qy);return ()=>clearInterval(b)},[r,i,s,a,u,c,m,T,w]),ta.useEffect(()=>{if(!r||!R||!l)return;let g=async()=>{try{await Ad(l,s);}catch{}};g();let b=setInterval(g,Qy);return ()=>clearInterval(b)},[r,R,l,s]),{pollingEnabled:R,showWaitingUi:x,handleIveDeposited:()=>{v(true),F(true);}}}function Yy({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nd,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(im,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function nd({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=z(),n=ta.useRef(new reactNative.Animated.Value(0)).current;ta.useEffect(()=>{if(e&&!t){n.setValue(0);let s=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return s.start(),()=>s.stop()}},[e,t,n]);let i=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Vu.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:i}]},children:jsxRuntime.jsx(dc,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Vu.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function im({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:i,components:s}=z();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Vu.iveDepositedButton,{backgroundColor:n.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Vu.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})})}var Vu=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 Lu(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ge(t||r||e.icon_url)}function ix(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 Bu=18,Eu=12,sx=2;function ax({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),i=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(en,{uri:e,width:r,height:r,borderRadius:10}),i?jsxRuntime.jsxs(reactNative.View,{style:Yi.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.backBadge],children:jsxRuntime.jsx(rl,{size:Eu})}),jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.frontBadge],children:jsxRuntime.jsx(Xa,{size:Eu})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.singleBadge],children:jsxRuntime.jsx(Xa,{size:Eu})}):n?jsxRuntime.jsx(reactNative.View,{style:[Yi.badge,Yi.singleBadge],children:jsxRuntime.jsx(rl,{size:Eu})}):null]})}var Yi=reactNative.StyleSheet.create({badge:{width:Bu,height:Bu,borderRadius:Bu/2,borderWidth:sx,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 Wu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,onBack:s,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:u,onLatestExecution:h,onShowStatusSheet:k}){let{colors:d,fonts:p,components:T}=z(),m=ta.useRef(true);ta.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let w=ta.useRef(false),[R,v]=ta.useState("selectWallet"),[x,F]=ta.useState([]),[f,g]=ta.useState(true),[b,C]=ta.useState(null),[O,V]=ta.useState(null),[P,B]=ta.useState(null),[W,j]=ta.useState(null),[Z,Oe]=ta.useState(null),[G,ot]=ta.useState([]),[te,de]=ta.useState(false),[ae,re]=ta.useState(null),[xe,$]=ta.useState([]),[Re,dt]=ta.useState(new Map),[Xe]=ta.useState(()=>new Date),[Se,Ke]=ta.useState(null),[nt,Ge]=ta.useState(false),[pt,st]=ta.useState(null),[Ne,ye]=ta.useState(false);ta.useEffect(()=>{if(R==="depositProcessing"||R==="depositComplete")return;if(R!=="waitingForDeposit"){ye(false);return}reactNative.AppState.currentState==="active"&&ye(true);let L=reactNative.AppState.addEventListener("change",U=>{U==="active"&&ye(true);});return ()=>L.remove()},[R]);let be=R==="waitingForDeposit"&&Ne||R==="depositProcessing",He=W||P||O?.chain_types[0]||o||"ethereum",ft=nn(G,He),yt=ft?.address||"",xt=ft?.id??"",lr=`${He}:${n||""}`;ta.useEffect(()=>(m.current=true,()=>{m.current=false;}),[]),ta.useEffect(()=>{Je();},[t]),ta.useEffect(()=>{Se&&h?.(Se);},[Se]),ta.useEffect(()=>{u?.(xe);},[xe]);let[$e,fe]=ta.useState(false);ta.useEffect(()=>{!nt||!Se||(Ge(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"));},[nt,Se]),ta.useEffect(()=>{R!=="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:Ye}=ii({depositConfirmationMode:"auto_ui",enabled:be,depositAddress:yt,chain:lr,externalUserId:e,publishableKey:t,modalOpenedAt:pt??Xe,depositWalletId:xt,depositExecutions:xe,trackedExecutions:Re,setDepositExecutions:$,setTrackedExecutions:dt,setLatestExecution:Ke,setShowStatusSheet:Ge,onExecutionsChange:u,onDepositError:c});async function Je(){g(true),C(null);try{let L=await Jp(t);if(!m.current)return;let U=L.data.filter(ix),Ot=U.map(Lu).filter(Boolean);if(Ot.length>0&&await $c(Ot),!m.current)return;F(U);}catch(L){if(!m.current)return;C(L instanceof Error?L.message:"Failed to load wallets");}finally{m.current&&g(false);}}function Ee(L){V(L),j(null),re(null),L.chain_types.length>1?(B(null),v("selectNetwork")):je(L);}function me(L){B(L),O&&je(O,L);}async function je(L,U){if(w.current)return;w.current=true,de(true),v("connecting");let Ot=U||L.chain_types[0]||null;try{let We=await Zo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:i,recipient_address:r},t);if(!m.current)return;ot(We.data);let De=We.data.map(Ht=>({chain_type:Ht.chain_type,address:Ht.address})),wt=Ot?De.filter(Ht=>Ht.chain_type===Ot):De,lt=wt.length>0,ee=lt?wt:De,$r=lt?Ot:ee[0]?.chain_type??Ot;j($r??null);let mt=await Zp(L.id,ee,t);if(!m.current)return;if(Oe(mt),de(!1),!mt.supported||!mt.deeplink&&!mt.pay_url){re(`${L.name} doesn't support in-app browser on this device`),v("failed");return}let tr=mt.deeplink||mt.pay_url;try{await reactNative.Linking.openURL(tr);}catch{if(!m.current)return;re(`Could not open ${L.name}. Make sure it is installed.`),v("failed");return}if(!m.current)return;st(new Date),v("waitingForDeposit");}catch(We){if(!m.current)return;de(false),re(We instanceof Error?We.message:"Failed to connect wallet"),v("failed");}}function vt(){if(!Z)return;let L=Z.deeplink||Z.pay_url;reactNative.Linking.openURL(L).catch(()=>{});}function Bt(){w.current=false,V(null),B(null),j(null),Oe(null),ot([]),st(null),re(null),de(false),v("selectWallet");}function Nt(){return f?jsxRuntime.jsx(reactNative.View,{style:Vt.centeredContainer,children:jsxRuntime.jsx(Te,{size:48,strokeWidth:3})}):b?jsxRuntime.jsxs(reactNative.View,{style:Vt.centeredContainer,children:[jsxRuntime.jsx(gs,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.errorTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.errorSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:b}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Je,style:[Vt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Vt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.semibold}],children:"Retry"})})]}):x.length===0?jsxRuntime.jsxs(reactNative.View,{style:Vt.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.errorTitle,{color:d.foreground,fontFamily:p.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.errorSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:Vt.walletList,contentContainerStyle:Vt.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Select a wallet to deposit from"}),x.map(L=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Ee(L),activeOpacity:.7,disabled:te,style:[Vt.walletRow,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor,opacity:te?.5:1}],children:[jsxRuntime.jsx(ax,{uri:Lu(L),chainTypes:L.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:Vt.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.walletName,{color:d.foreground,fontFamily:p.medium}],children:L.name}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.walletChains,{color:d.foregroundMuted,fontFamily:p.regular}],children:L.chain_types.map(U=>U.charAt(0).toUpperCase()+U.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(co,{size:16,color:d.foregroundMuted,strokeWidth:2})]},L.id))]})}function ct(){if(!O)return null;let L=Lu(O),U=We=>We==="n1"?"N1":We==="xrpl"?"XRPL":We.charAt(0).toUpperCase()+We.slice(1),Ot=O.chain_types.map(We=>({id:We,name:U(We),Icon:We==="ethereum"?Xa:rl}));return jsxRuntime.jsxs(reactNative.View,{style:Vt.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Vt.networkPickerHeader,children:[jsxRuntime.jsx(en,{uri:L,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.statusTitle,{color:d.foreground,fontFamily:p.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:["Choose which network to deposit from with ",O.name]})]}),jsxRuntime.jsx(reactNative.View,{style:Vt.networkList,children:Ot.map(({id:We,name:De,Icon:wt})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>me(We),activeOpacity:.7,disabled:te,style:[Vt.networkRow,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor,opacity:te?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:Vt.networkIconContainer,children:jsxRuntime.jsx(wt,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.networkName,{color:d.foreground,fontFamily:p.medium}],children:De}),jsxRuntime.jsx(co,{size:16,color:d.foregroundMuted,strokeWidth:2})]},We))})]})}function er(){return jsxRuntime.jsxs(reactNative.View,{style:Vt.centeredContainer,children:[jsxRuntime.jsx(Te,{size:48,strokeWidth:3}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.statusTitle,{color:d.foreground,fontFamily:p.semibold}],children:["Opening ",O?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Preparing your deposit session"})]})}function tt(){let L=O?.name??"your wallet",U=O?Lu(O):null;return jsxRuntime.jsxs(reactNative.View,{style:Vt.centeredContainer,children:[U?jsxRuntime.jsx(Te,{size:80,children:jsxRuntime.jsx(en,{uri:U,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(Te,{size:48,strokeWidth:3}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.statusTitle,{color:d.foreground,fontFamily:p.semibold}],children:["Continue in ",L]}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.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:vt,activeOpacity:.8,style:[Vt.primaryButton,{backgroundColor:d.primary,borderRadius:T.button.borderRadius,borderWidth:T.button.borderWidth,borderColor:T.button.borderColor}],children:[jsxRuntime.jsx(Bn,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.semibold}],children:["Open ",L]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(nd,{showWaitingUi:Ye,latestExecution:Se})})]})}function Ct(L,U){let Ot=parseFloat(L)/Math.pow(10,U);return Ot===0?"0.00":Ot>=1?Ot.toFixed(2):parseFloat(Ot.toPrecision(6)).toString()}function bt(L,U){let Ot={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return L==="n1"?"N1":L==="cardano"?"Cardano":Ot[U]??`${L.charAt(0).toUpperCase()+L.slice(1)} (${U})`}function Ae(L){if(!L)return "";let U=L.indexOf(".");return U!==-1?L.slice(0,U).toUpperCase()+L.slice(U):L.toUpperCase()}function at(L){return L.length<=12?L:`${L.slice(0,6)}...${L.slice(-4)}`}function X(L){if(!L)return "";try{return new Date(L).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Fe(L){let U=L.destination_amount_base_unit;return U?Ct(U,L.destination_token_metadata?.decimals??6):"\u2014"}function _(L){let U=L.destination_token_metadata;return U?U.icon_urls?.length?di(U.icon_urls,"png")??U.icon_url??null:U.icon_url??null:null}function S(){if(!Se)return null;let L=_(Se);return jsxRuntime.jsx(reactNative.View,{style:gt.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:gt.centeredContent,children:[jsxRuntime.jsx(Te,{size:84,strokeWidth:4,iconSize:48,children:L?jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(L)},style:gt.loaderIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[gt.loaderIcon,{backgroundColor:d.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[gt.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Deposit Processing"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:"This usually takes less than a minute."})]})})}function M(){if(!Se)return S();let L=Se,U=["pending","waiting","delayed"].includes(L.status),Ot=_(L),We=X(L.created_at);return jsxRuntime.jsxs(reactNative.View,{style:gt.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:gt.flex,contentContainerStyle:gt.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:gt.tokenIconWrapper,children:[Ot?jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(Ot)},style:gt.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[gt.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[gt.statusBadge,{backgroundColor:U?d.warning:T.container.iconBackgroundColor}],children:U?jsxRuntime.jsx(reactNative.Text,{style:gt.statusBadgeText,children:"\u21BB"}):jsxRuntime.jsx(Pt,{size:14,color:T.container.iconColor,strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:gt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[gt.statusDot,{backgroundColor:U?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[gt.statusText,{color:d.foreground,fontFamily:p.semibold}],children:U?"In Progress":"Completed"})]}),We?jsxRuntime.jsx(reactNative.Text,{style:[gt.dateText,{color:d.foregroundMuted,fontFamily:p.regular}],children:We}):null,jsxRuntime.jsxs(reactNative.View,{style:[gt.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[L.source_amount_usd?jsxRuntime.jsxs(reactNative.View,{style:gt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.detailValue,{color:d.foreground,fontFamily:p.medium}],children:["$",parseFloat(L.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxRuntime.jsxs(reactNative.View,{style:gt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.detailValue,{color:d.foreground,fontFamily:p.medium}],children:[Fe(L)," ",Ae(L.destination_currency)]})]}),L.source_chain_id?jsxRuntime.jsxs(reactNative.View,{style:gt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.detailValue,{color:d.foreground,fontFamily:p.medium}],children:bt(L.source_chain_type??"",L.source_chain_id)})]}):null,L.destination_chain_id?jsxRuntime.jsxs(reactNative.View,{style:gt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.detailValue,{color:d.foreground,fontFamily:p.medium}],children:bt(L.destination_chain_type??"",L.destination_chain_id)})]}):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:gt.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),fe(De=>!De);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.seeMoreText,{color:d.foreground,fontFamily:p.medium}],children:$e?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.seeMoreChevron,{color:d.foregroundMuted}],children:$e?"\u25B2":"\u25BC"})]}),$e&&jsxRuntime.jsxs(reactNative.View,{style:gt.txHashSection,children:[L.explorer_url?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[gt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(L.explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.txLabel,{color:d.foreground,fontFamily:p.medium}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:gt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.txHash,{color:d.foregroundMuted}],children:at(L.transaction_hash)}),jsxRuntime.jsx(reactNative.Text,{style:[gt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!U&&L.destination_explorer_url&&L.destination_transaction_hashes?.[0]?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[gt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(L.destination_explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.txLabel,{color:d.foreground,fontFamily:p.medium}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:gt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.txHash,{color:d.foregroundMuted}],children:at(L.destination_transaction_hashes[0])}),jsxRuntime.jsx(reactNative.Text,{style:[gt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsxRuntime.jsx(reactNative.View,{style:gt.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Vt.primaryButton,{backgroundColor:d.primary,borderRadius:T.button.borderRadius,borderWidth:T.button.borderWidth,borderColor:T.button.borderColor}],onPress:a,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Vt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.medium}],children:"Done"})})})]})}function q(){return jsxRuntime.jsxs(reactNative.View,{style:Vt.centeredContainer,children:[jsxRuntime.jsx(gs,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.statusTitle,{color:d.foreground,fontFamily:p.semibold}],children:ae||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.statusSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Bt,activeOpacity:.8,style:[Vt.primaryButton,{backgroundColor:d.primary,borderRadius:T.button.borderRadius,borderWidth:T.button.borderWidth,borderColor:T.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Vt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:p.semibold}],children:"Try Again"})})]})}function J(){switch(R){case "selectWallet":return Nt();case "selectNetwork":return ct();case "connecting":return er();case "waitingForDeposit":return tt();case "depositProcessing":return S();case "depositComplete":return M();case "failed":return q()}}let K=R==="selectWallet"||R==="selectNetwork"||R==="failed",ve=R==="selectNetwork"?O?.name??"Select Network":R==="depositProcessing"?"Deposit Processing":R==="depositComplete"?"Deposit Summary":"Connect Wallet";function Ve(){R==="selectNetwork"?(w.current=false,V(null),B(null),j(null),v("selectWallet")):s();}return jsxRuntime.jsxs(reactNative.View,{style:Vt.container,children:[jsxRuntime.jsx(fo,{title:ve,showBack:K,onBack:Ve,onClose:a}),J()]})}var Vt=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}}),gt=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 Zi=7,Ji=4,El=4;function mx(e,t,r){return e<Zi&&t<Zi||e<Zi&&t>=r-Zi||e>=r-Zi&&t<Zi}function js({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:i,badgeSize:s=20}){let{isDark:a}=z(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",u=n||l,h=ta.useMemo(()=>{try{return fx__default.default(e||"placeholder","H")}catch{return null}},[e]),k=h?h.length:0,d=k?(t-Ji*2)/k:0,p=d*.38,T=o+12,m=T/2+4,w=t/2,R=t/2,v=k?[{x:Ji,y:Ji},{x:Ji+(k-Zi)*d,y:Ji},{x:Ji,y:Ji+(k-Zi)*d}]:[],x=Zi*d,F=5*d,f=d,g=3*d,b=2*d;return jsxRuntime.jsxs(reactNative.View,{style:[cm.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Ir__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Ir.Rect,{x:0,y:0,width:t,height:t,fill:l}),h?.map((C,O)=>C.map((V,P)=>{if(!V||mx(O,P,k))return null;let B=Ji+P*d+d/2,W=Ji+O*d+d/2;if(r){let j=B-w,Z=W-R;if(Math.sqrt(j*j+Z*Z)<m)return null}return jsxRuntime.jsx(Ir.Circle,{cx:B,cy:W,r:p,fill:c},`${O}-${P}`)})),v.map((C,O)=>jsxRuntime.jsxs(ta__namespace.default.Fragment,{children:[jsxRuntime.jsx(Ir.Rect,{x:C.x,y:C.y,width:x,height:x,rx:El,ry:El,fill:c}),jsxRuntime.jsx(Ir.Rect,{x:C.x+f,y:C.y+f,width:F,height:F,rx:El-1,ry:El-1,fill:l}),jsxRuntime.jsx(Ir.Rect,{x:C.x+b,y:C.y+b,width:g,height:g,rx:El-1.5,ry:El-1.5,fill:c})]},`finder-${O}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[cm.logoContainer,{width:T,height:T,top:R-T/2,left:w-T/2,backgroundColor:u,borderRadius:T/2}],children:[jsxRuntime.jsx(en,{uri:r,width:o,height:o,borderRadius:o/2}),i&&jsxRuntime.jsx(reactNative.View,{style:[cm.badgeContainer,{width:s+4,height:s+4,borderRadius:(s+4)/2,backgroundColor:u}],children:jsxRuntime.jsx(en,{uri:i,width:s,height:s,borderRadius:s/2})})]})]})}var cm=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 wx=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ml=(e,t)=>`${t}:${e}`,Cx=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Nu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:d,onLatestExecution:p,onShowStatusSheet:T,onSelectedTokenIconUrl:m,borderTopLeftRadius:w,borderTopRightRadius:R,sheetBorderRadius:v}){let{colors:x,fonts:F,components:f}=z(),g=a&&l?`${a}:${l}`:"solana:mainnet",[b,C]=ta.useState("USDC"),[O,V]=ta.useState(g),[P,B]=ta.useState([]),[W,j]=ta.useState(true),[Z,Oe]=ta.useState([]),[G,ot]=ta.useState(true),[te,de]=ta.useState(false),[ae,re]=ta.useState(false),[xe,$]=ta.useState(false),[Re,dt]=ta.useState(false),[Xe,Se]=ta.useState([]),[Ke,nt]=ta.useState(new Map),[Ge]=ta.useState(()=>new Date),[pt,st]=ta.useState(null),[Ne,ye]=ta.useState(false),[be,He]=ta.useState(null),[ft,yt]=ta.useState(false);ta.useEffect(()=>{be&&p?.(be);},[be]),ta.useEffect(()=>{Ne&&(T?.(true),ye(false));},[Ne]);let xt=new Map;Z.forEach(_=>{_.chains.forEach(S=>{let M=`${S.chain_type}:${S.chain_id}`;xt.has(M)||xt.set(M,S);});});let lr=Array.from(xt.values()),$e=Cx(O),Ye=lr.find(_=>_.chain_type===$e.chainType&&_.chain_id===$e.chainId)?.chain_type||"ethereum",Je=nn(P,Ye),Ee=Je?.address||"",me=ta.useRef(false);ta.useEffect(()=>{async function _(){try{ot(!0),st(null);let M=await Wi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(Oe(M.data),M.data.length>0&&!me.current){me.current=!0;let q,J;if(a&&l)if(c)for(let K of M.data){let ve=K.chains.find(Ve=>Ve.chain_type===a&&Ve.chain_id===l&&Ve.token_address.toLowerCase()===c.toLowerCase());if(ve){q=K,J=ve;break}}else {let K=Ve=>Ve.chain_type===a&&Ve.chain_id===l,ve=M.data.find(Ve=>Ve.symbol==="USDC"&&Ve.chains.some(K));if(ve)q=ve,J=ve.chains.find(K);else for(let Ve of M.data){let L=Ve.chains.find(K);if(L){q=Ve,J=L;break}}}if(!q&&i)for(let K of M.data){let ve=K.chains.find(Ve=>Ve.token_address.toLowerCase()===i.toLowerCase());if(ve){q=K,J=ve;break}}q||(q=M.data.find(K=>K.symbol==="USDC"),q&&q.chains.length>0&&(J=q.chains[0])),q||(q=M.data.find(K=>K.symbol==="USDT"),q&&q.chains.length>0&&(J=q.chains[0])),q||(q=M.data[0],q.chains.length>0&&(J=q.chains[0])),q&&C(q.symbol),J&&V(Ml(J.chain_id,J.chain_type));}}catch(S){console.error("Error fetching supported tokens:",S),st("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:S});}finally{ot(false);}}_();},[t,d,a,l,c,i,n,o]),ta.useEffect(()=>{async function _(){try{j(!0),st(null);let S=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);B(S.data);}catch(S){console.error("Error fetching wallets:",S),st("Failed to load wallets"),d?.({message:"Failed to load wallets",error:S});}finally{j(false);}}_();},[e,r,o,n,i,t,d]);let je=Je?.id??"",{showWaitingUi:vt,handleIveDeposited:Bt}=ii({depositConfirmationMode:u,depositAddress:Ee,chain:O,externalUserId:e,publishableKey:t,modalOpenedAt:Ge,depositWalletId:je,depositExecutions:Xe,trackedExecutions:Ke,setDepositExecutions:Se,setTrackedExecutions:nt,setLatestExecution:He,setShowStatusSheet:ye,onDepositSuccess:k,onExecutionsChange:h,onDepositError:d});ta.useEffect(()=>{if(!Z.length)return;let _=Z.find(M=>M.symbol===b);if(!_||_.chains.length===0){let M=Z.find(q=>q.symbol==="USDC")||Z[0];M&&(C(M.symbol),M.chains.length>0&&V(Ml(M.chains[0].chain_id,M.chains[0].chain_type)));return}if(!_.chains.some(M=>Ml(M.chain_id,M.chain_type)===O)){let M=_.chains[0];V(Ml(M.chain_id,M.chain_type));}},[b,Z,O]);let Nt=Z.find(_=>_.symbol===b),ct=it(Nt,"png")||void 0;ta.useEffect(()=>{m?.(ct);},[ct]);let er=Nt?.chains||[],tt=er.find(_=>Ml(_.chain_id,_.chain_type)===O),Ct=async()=>{if(Ee)try{reactNative.Clipboard.setString(Ee),de(!0),setTimeout(()=>de(!1),2e3);}catch(_){console.error("Failed to copy:",_);}},bt=tt?.estimated_price_impact_percent??0,Ae=tt?.max_slippage_percent??.25,at=tt?.minimum_deposit_amount_usd??3;if(G)return jsxRuntime.jsxs(reactNative.View,{style:ne.loadingContainer,children:[jsxRuntime.jsx(Te,{size:48,strokeWidth:3}),jsxRuntime.jsx(reactNative.Text,{style:[ne.loadingText,{color:x.foregroundMuted,fontFamily:F.regular}],children:"Loading..."})]});if(pt&&Z.length===0)return jsxRuntime.jsxs(reactNative.View,{style:ne.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.errorText,{color:x.error,fontFamily:F.regular}],children:pt}),jsxRuntime.jsx(reactNative.Text,{style:[ne.errorHint,{color:x.foregroundMuted,fontFamily:F.regular}],children:"Please check your network connection and try again."})]});let X=()=>jsxRuntime.jsxs(rr,{visible:xe,onClose:()=>$(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[ne.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ne.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetTitle,{color:f.header.titleColor,fontFamily:F.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>$(false),style:ne.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Yt,{style:ne.sheetList,contentContainerStyle:ne.sheetListContent,showsVerticalScrollIndicator:false,children:Z.map(_=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{C(_.symbol),$(false);},activeOpacity:.7,style:[ne.sheetItem,{backgroundColor:b===_.symbol?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(_,"png"))},style:ne.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:ne.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetItemTitle,{color:f.card.titleColor,fontFamily:F.medium}],children:_.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.sheetItemSubtitle,{color:f.card.subtitleColor,fontFamily:F.regular}],children:[_.chains.length," network",_.chains.length!==1?"s":""," available"]})]}),b===_.symbol&&jsxRuntime.jsx(Pt,{size:20,color:x.primary,strokeWidth:2})]},_.symbol))})]}),Fe=()=>jsxRuntime.jsxs(rr,{visible:Re,onClose:()=>dt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:v?.chainSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[ne.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ne.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetTitle,{color:f.header.titleColor,fontFamily:F.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>dt(false),style:ne.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Yt,{style:ne.sheetList,contentContainerStyle:ne.sheetListContent,showsVerticalScrollIndicator:false,children:er.map(_=>{let S=Ml(_.chain_id,_.chain_type),M=O===S;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(S),dt(false);},activeOpacity:.7,style:[ne.sheetItem,{backgroundColor:M?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(_,"png"))},style:ne.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:ne.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetItemTitle,{color:f.card.titleColor,fontFamily:F.medium}],children:_.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.sheetItemSubtitle,{fontFamily:F.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:f.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:x.warning},children:["$",_.minimum_deposit_amount_usd]})]})]}),M&&jsxRuntime.jsx(Pt,{size:20,color:x.primary,strokeWidth:2})]},S)})})]});return jsxRuntime.jsxs(reactNative.View,{style:ne.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ne.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.selectorLabel,{color:f.card.labelColor,fontFamily:F.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>$(true),style:[ne.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[Nt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(Nt,"png"))},style:ne.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ne.selectorText,{color:f.card.titleColor,fontFamily:F.medium}],children:b}),jsxRuntime.jsx(Vr,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ne.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ne.selectorLabel,{color:f.card.labelColor,fontFamily:F.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[ne.minDeposit,{color:x.warning,fontFamily:F.regular}],children:["($",at," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>dt(true),style:[ne.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[tt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(tt,"png"))},style:ne.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ne.selectorText,{color:f.card.titleColor,fontFamily:F.medium}],numberOfLines:1,children:tt?.chain_name||"Select network"}),jsxRuntime.jsx(Vr,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ne.intentAddressLabel,{color:x.foregroundMuted,fontFamily:F.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:ne.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ne.qrWrapper,{backgroundColor:x.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:W?jsxRuntime.jsxs(reactNative.View,{style:ne.qrLoading,children:[jsxRuntime.jsx(Te,{size:20,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ne.loadingText,{color:x.foregroundMuted,fontFamily:F.regular}],children:"Loading..."})]}):Ee?jsxRuntime.jsx(js,{value:Ee,size:160,logoUri:ge(it(tt,"png")||kr("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:ne.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ne.errorText,{color:x.error,fontFamily:F.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:Ct,disabled:W||!Ee,style:ne.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ne.addressTruncated,{color:x.foregroundMuted,fontFamily:F.regular}],numberOfLines:1,children:W?"Loading...":Ee?wx(Ee):"No address"}),te?jsxRuntime.jsx(Pt,{size:16,color:x.success,strokeWidth:2}):jsxRuntime.jsx(Kn,{size:16,color:x.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(nd,{showWaitingUi:vt,latestExecution:be}),jsxRuntime.jsxs(reactNative.View,{style:[ne.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>re(!ae),style:ne.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ne.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ne.detailsLabel,{color:f.card.titleColor,fontFamily:F.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ne.chevronContainer,children:ae?jsxRuntime.jsx(ci,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Vr,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),ae&&jsxRuntime.jsxs(reactNative.View,{style:ne.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ne.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.detailsLabel,{color:f.card.titleColor,fontFamily:F.regular}],children:["Price impact: ",bt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Yn,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ne.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.detailsLabel,{color:f.card.titleColor,fontFamily:F.regular}],children:["Slippage: Auto \u2022 ",Ae.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Yn,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ne.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.detailsLabel,{color:f.card.titleColor,fontFamily:F.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:ne.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ne.detailsLabel,{color:x.primary,fontFamily:F.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(im,{depositConfirmationMode:u,depositAddress:Ee,showWaitingUi:vt,onIveDeposited:Bt}),X(),Fe(),jsxRuntime.jsxs(rr,{visible:ft,onClose:()=>yt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[ne.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ne.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ne.sheetTitle,{color:f.header.titleColor,fontFamily:F.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(false),style:ne.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ne.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ne.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ne.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ne.infoCardTitle,{color:f.card.titleColor,fontFamily:F.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.infoCardValue,{color:f.card.titleColor,fontFamily:F.medium}],children:[bt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ne.infoCardDescription,{color:f.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:[ne.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ne.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ne.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ne.infoCardTitle,{color:f.card.titleColor,fontFamily:F.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ne.infoCardValue,{color:f.card.titleColor,fontFamily:F.medium}],children:[Ae.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ne.infoCardDescription,{color:f.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 ne=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 Hu({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=z();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ia.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ia.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ia.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(e,"png"))},style:Ia.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ia.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ia.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ia.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Pt,{size:16,color:o.primary,strokeWidth:2})]})}var Ia=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 sd({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=z();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:ab.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[ab.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(Hu,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var ab=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function ju({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:c,components:u}=z(),[h,k]=ta.useState(""),d=o.map(x=>r.find(F=>F.currency_code.toLowerCase()===x.toLowerCase())).filter(x=>x!==void 0),p=r.filter(x=>!o.includes(x.currency_code.toLowerCase())),T=x=>{if(!h)return x;let F=h.toLowerCase();return x.filter(f=>f.name.toLowerCase().includes(F)||f.currency_code.toLowerCase().includes(F))},m=T(d),w=T(p),R=x=>{i(x),t(false),k("");},v=()=>{t(false),k("");};return jsxRuntime.jsxs(rr,{visible:e,onClose:v,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(fo,{title:"Currency",showBack:false,onClose:v}),jsxRuntime.jsx(reactNative.View,{style:Pa.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pa.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:c.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],value:h,onChangeText:k,placeholder:"Search",placeholderTextColor:u.search.placeholderColor})}),jsxRuntime.jsx(Yt,{style:Pa.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Pa.listContent,children:[jsxRuntime.jsx(sd,{title:"Popular currencies",currencies:m,selectedCurrency:n,onSelect:R}),m.length>0&&w.length>0&&jsxRuntime.jsx(reactNative.View,{style:Pa.sectionSpacer}),jsxRuntime.jsx(sd,{title:"All currencies",currencies:w,selectedCurrency:n,onSelect:R}),m.length===0&&w.length===0&&jsxRuntime.jsx(reactNative.View,{style:Pa.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Pa.noResultsText,{color:u.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Pa=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 mm(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 Ku({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:u,onExecutionsChange:h,onLatestExecution:k,onShowStatusSheet:d,onSelectedTokenIconUrl:p,borderTopLeftRadius:T,borderTopRightRadius:m,sheetBorderRadius:w}){let{colors:R,fonts:v,components:x}=z(),[F,f]=ta.useState(""),[g,b]=ta.useState("usd"),[C,O]=ta.useState(false),[V,P]=ta.useState(false),[B,W]=ta.useState([]),[j,Z]=ta.useState(false),[Oe,G]=ta.useState(null),[ot,te]=ta.useState(null),[de,ae]=ta.useState("amount"),[re,xe]=ta.useState(null),[$,Re]=ta.useState(true),[dt,Xe]=ta.useState(null),[Se,Ke]=ta.useState(false),nt=ta.useRef(null),Ge=ta.useRef(false);ta.useEffect(()=>{nt.current=re;},[re]),ta.useEffect(()=>{Ge.current=Se;},[Se]);let[pt,st]=ta.useState([]),[Ne,ye]=ta.useState(true),[be,He]=ta.useState(60),[ft,yt]=ta.useState([]),[xt,lr]=ta.useState([]),[$e,fe]=ta.useState(null),[Ye,Je]=ta.useState(null),[Ee,me]=ta.useState(true),[je,vt]=ta.useState(null),[Bt,Nt]=ta.useState(false),[ct,er]=ta.useState(null),[tt,Ct]=ta.useState(false),[bt,Ae]=ta.useState(false),[at,X]=ta.useState(false),[Fe,_]=ta.useState(null),S=r??de,M=ta.useRef(null),q=ft.find(oe=>oe.currency_code.toLowerCase()===g.toLowerCase()),J=ta.useCallback(oe=>{ae(oe),oe==="quotes"?o?.(oe,B.length):o?.(oe);},[B.length,o]);ta.useEffect(()=>{async function oe(){try{let we=await aa();Je(we);}catch(we){console.error("Error fetching user IP:",we);}finally{me(false);}}oe();},[]),ta.useEffect(()=>{async function oe(){try{let we=await Zo({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);st(we.data);}catch(we){console.error("Error fetching wallets:",we),G("Failed to load wallet addresses");}finally{ye(false);}}oe();},[e,i,s,a,l,t]);let K=n||$e?.symbol.toUpperCase()||"USDC",ve=di($e?.icon_urls,"png")||$e?.icon_url,Ve=di($e?.chain_icon_urls,"png")||$e?.chain_icon_url,[L,U]=ta.useState([]),[Ot,We]=ta.useState(new Map),[De]=ta.useState(()=>new Date),[wt,lt]=ta.useState(null),[ee,$r]=ta.useState(false),[mt,tr]=ta.useState(null);ta.useEffect(()=>{S==="onramp"&&!mt&&tr(new Date);},[S,mt]);let Ht=je?.destination_token_metadata?.chain_type||s||"ethereum",jr=je?.destination_token_metadata?.chain_id||a||"",Rr=`${Ht}:${jr}`,ai=nn(pt,Ht),on=ai?.address||"",yo=ai?.id??"";ta.useEffect(()=>{wt&&k?.(wt);},[wt]),ta.useEffect(()=>{ee&&(d?.(true),$r(false));},[ee]),ta.useEffect(()=>{p?.(ve||void 0);},[ve]),ta.useEffect(()=>{h?.(L);},[L]),ii({depositConfirmationMode:"auto_silent",enabled:S==="onramp",depositAddress:on,chain:Rr,externalUserId:e,publishableKey:t,modalOpenedAt:mt??De,depositWalletId:yo,depositExecutions:L,trackedExecutions:Ot,setDepositExecutions:U,setTrackedExecutions:We,setLatestExecution:lt,setShowStatusSheet:$r,onDepositSuccess:c,onExecutionsChange:h,onDepositError:u}),ta.useEffect(()=>{async function oe(){try{let we=await wc(t);yt(we.data),lr(we.preferred||[]);}catch(we){console.error("Error fetching fiat currencies:",we);}}oe();},[t]),ta.useEffect(()=>{if(C||ft.length===0||!Ye?.alpha2)return;let oe=Ye.alpha2.toUpperCase(),we=ft.find(ht=>ht.country_codes.includes(oe));if(we)b(we.currency_code.toLowerCase()),!F&&!V&&f(String(we.default_amount??100));else if(!F&&!V){let ht=ft.find(Cr=>Cr.currency_code.toLowerCase()==="usd");ht&&f(String(ht.default_amount??100));}},[ft,Ye,C,F,V]),ta.useEffect(()=>{if(ft.length!==0){if(M.current!==null&&M.current!==g){let oe=ft.find(we=>we.currency_code.toLowerCase()===g.toLowerCase());oe&&f(String(oe.default_amount??100));}M.current=g;}},[g,ft]),ta.useEffect(()=>{async function oe(){try{let we=await Hp({chain_type:s||"",chain_id:a||"",token_address:l||""},t);fe(we);}catch(we){console.error("Error fetching supported tokens:",we);}}oe();},[s,a,l,t]),ta.useEffect(()=>{async function oe(){if(!(!l||!a||!s)&&!Ee){Nt(true);try{let we=await bc({country_code:Ye?.alpha2?.toUpperCase()||"US",subdivision_code:Ye?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);vt(we);}catch(we){console.error("Error fetching default onramp token:",we);}finally{Nt(false);}}}oe();},[l,a,s,Ye,Ee,t]),ta.useEffect(()=>{let oe=parseFloat(F);if(isNaN(oe)||oe<=0){W([]),te(null);return}if(!je||Bt){W([]),xe(null);return}let we=ft.find(Cr=>Cr.currency_code.toLowerCase()===g.toLowerCase());if(we){if(oe<we.minimum_amount){W([]),xe(null),te(`Minimum amount is ${mm(g)}${we.minimum_amount.toLocaleString()}`);return}if(oe>we.maximum_amount){W([]),xe(null),te(`Maximum amount is ${mm(g)}${we.maximum_amount.toLocaleString()}`);return}}te(null);let ht=setTimeout(()=>{Io(oe);},500);return ()=>clearTimeout(ht)},[F,g,t,je,Bt,ft]);let Io=async oe=>{if(!je){G("Loading token information...");return}Z(true),G(null);try{let we={country_code:Ye?.alpha2?.toUpperCase()||"US",source_amount:oe.toString(),source_currency:g.toLowerCase(),destination_currency:je.destination_currency,destination_network:je.destination_network,subdivision_code:Ye?.state||void 0},ht=await $p(we,t);W(ht.data);let Cr=Ge.current,Or=nt.current;if(Cr&&Or){let $o=ht.data.find(D=>D.service_provider===Or.service_provider);if($o){if(xe($o),ht.data.length>0){let D=ht.data[0];dt||Xe(D.service_provider),Re($o.service_provider===dt);}}else if(ht.data.length>0){let D=ht.data[0];xe(D),Xe(D.service_provider),Re(!0),Ke(!1);}}else if(ht.data.length>0){let $o=ht.data[0];xe($o),Xe($o.service_provider),Re(!0);}He(60);}catch(we){console.error("Failed to fetch quotes:",we),G("Failed to fetch quotes. Please try again."),W([]);}finally{Z(false);}};ta.useEffect(()=>{if(B.length===0)return;let oe=setInterval(()=>{He(we=>{if(we<=1){let ht=parseFloat(F);return !isNaN(ht)&&ht>0&&Io(ht),60}return we-1});},1e3);return ()=>clearInterval(oe)},[B.length,F]);let Vn=oe=>{(/^\d*\.?\d{0,2}$/.test(oe)||oe==="")&&(f(oe),P(true));},bo=oe=>{f(oe.toString()),P(true);},na=async()=>{if(re&&je)try{let oe=je.destination_token_metadata.chain_type,we=nn(pt,oe);if(!we?.address){G("Wallet address not available");return}let ht={service_provider:re.service_provider,country_code:re.country_code?.toUpperCase()||Ye?.alpha2?.toUpperCase()||"US",source_currency:re.source_currency,source_amount:F,destination_currency:re.destination_currency,destination_network:re.destination_network,wallet_address:we.address,subdivision_code:Ye?.state||void 0},Cr=await jp(ht,t);er({provider:re,sourceCurrency:g,sourceAmount:F,sessionUrl:Cr.url}),_(Cr.url),X(!0);}catch(oe){console.error("Failed to create session:",oe),G("Failed to start payment flow"),u?.({message:"Failed to start payment flow",error:oe});}},wo=mm(g),Li=()=>{X(false),J("onramp"),c?.({message:"Payment flow completed"});},_t=()=>jsxRuntime.jsx(Ax,{visible:at,onClose:Li,url:Fe,providerName:re?.service_provider_display_name||"Complete Payment",colors:R,fonts:v,borderTopLeftRadius:w?.webView?.borderTopLeftRadius??T,borderTopRightRadius:w?.webView?.borderTopRightRadius??m});return S==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:_e.amountViewContainer,children:[jsxRuntime.jsxs(Yt,{style:_e.scrollContainer,contentContainerStyle:_e.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:_e.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ct(true),style:[_e.currencyButton,{backgroundColor:x.card.backgroundColor,borderRadius:x.input.borderRadius,borderWidth:x.input.borderWidth,borderColor:x.input.borderColor}],children:[q&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(q,"png"))},style:_e.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[_e.currencyText,{color:x.card.titleColor,fontFamily:v.medium}],children:g.toUpperCase()}),jsxRuntime.jsx(Vr,{size:16,color:x.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(ju,{open:tt,onOpenChange:Ct,currencies:ft,preferredCurrencyCodes:xt,selectedCurrency:g,onSelectCurrency:oe=>{b(oe.toLowerCase()),O(true);},borderTopLeftRadius:w?.currencyModal?.borderTopLeftRadius??T,borderTopRightRadius:w?.currencyModal?.borderTopRightRadius??m}),jsxRuntime.jsx(reactNative.View,{style:_e.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:_e.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[_e.currencySymbol,{color:x.container.titleColor,fontFamily:v.medium}],children:wo}),jsxRuntime.jsx(reactNative.TextInput,{style:[_e.amountInput,{color:x.container.titleColor,fontFamily:v.medium}],value:F,onChangeText:Vn,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:R.foregroundMuted})]})}),q?.suggested_amounts&&q.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:_e.quickAmounts,children:q.suggested_amounts.map(oe=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>bo(oe),style:[_e.quickAmountButton,{backgroundColor:x.card.backgroundColor,borderRadius:x.button.borderRadius,borderWidth:parseFloat(F)===oe?2:x.button.borderWidth,borderColor:parseFloat(F)===oe?R.primary:x.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[_e.quickAmountText,{color:x.card.titleColor,fontFamily:v.medium}],children:[wo,oe.toLocaleString()]})},oe))}),ot&&jsxRuntime.jsx(reactNative.Text,{style:[_e.validationError,{color:R.error,fontFamily:v.regular}],children:ot}),jsxRuntime.jsxs(reactNative.View,{style:_e.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:_e.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[_e.providerLabel,{color:x.card.labelColor,fontFamily:v.medium}],children:"Provider"}),B.length>0&&!j&&jsxRuntime.jsxs(reactNative.Text,{style:[_e.refreshText,{color:x.card.labelRightColor,fontFamily:v.regular}],children:["Refreshing in ",be,"s"]})]}),jsxRuntime.jsx(Qr,{cardTokens:x.depositCard.quoteProvider.card,onPress:j||B.length===0?void 0:()=>Ae(true),contentStyle:reactNative.StyleSheet.flatten([_e.providerButton,(j||B.length===0)&&_e.disabled]),children:j?jsxRuntime.jsxs(reactNative.View,{style:_e.providerLoading,children:[jsxRuntime.jsx(Te,{size:20,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[_e.loadingText,{color:x.container.subtitleColor,fontFamily:v.regular}],children:"Finding best rates..."})]}):re?jsxRuntime.jsxs(reactNative.View,{style:_e.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:_e.providerInfo,children:[$&&jsxRuntime.jsx(reactNative.Text,{style:[_e.autoPickedText,{color:x.container.subtitleColor,fontFamily:v.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:_e.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(Ld(re.icon_urls,"png",re.icon_url))},style:_e.providerIconImage},`provider-${re.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[_e.providerName,{color:x.card.titleColor,fontFamily:v.medium}],children:re.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[_e.bestPriceText,{color:x.container.subtitleColor,fontFamily:v.regular}],children:[re.destination_amount.toFixed(2)," ",K]})]})]})]}),jsxRuntime.jsx(co,{size:20,color:x.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[_e.noProviderText,{color:x.container.subtitleColor,fontFamily:v.regular}],children:parseFloat(F)>0?"No providers available":"Enter an amount to see providers"})}),Oe&&jsxRuntime.jsx(reactNative.Text,{style:[_e.errorText,{color:R.error,fontFamily:v.regular}],children:Oe})]}),jsxRuntime.jsxs(rr,{visible:bt,onClose:()=>Ae(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:w?.providerModal?.borderTopLeftRadius??T,borderTopRightRadius:w?.providerModal?.borderTopRightRadius??m,children:[jsxRuntime.jsx(fo,{title:"Select Provider",showBack:false,onClose:()=>Ae(false)}),jsxRuntime.jsx(Yt,{style:_e.providerModalList,contentContainerStyle:_e.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:_e.quotesList,children:B.map(oe=>{let we=re?.service_provider===oe.service_provider;return jsxRuntime.jsxs(Qr,{cardTokens:x.depositCard.quoteProvider.card,onPress:()=>{xe(oe),Ke(true),Re(oe.service_provider===dt),Ae(false);},contentStyle:reactNative.StyleSheet.flatten([_e.quoteItem,we&&{borderWidth:2,borderColor:R.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:_e.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(Ld(oe.icon_urls,"png",oe.icon_url))},style:_e.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[_e.quoteName,{color:x.card.titleColor,fontFamily:v.medium}],children:oe.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:_e.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[_e.quoteAmount,{color:x.card.textRightColor,fontFamily:v.medium}],children:[oe.destination_amount.toFixed(2)," ",K]}),jsxRuntime.jsxs(reactNative.Text,{style:[_e.quoteSource,{color:x.card.subtextRightColor,fontFamily:v.regular}],children:["Fee: ",wo,oe.total_fee.toFixed(2)]})]})]},oe.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[_e.continueButtonContainer,{backgroundColor:R.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:j||Ne||!re||parseFloat(F)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:na,disabled:j||Ne||!re||parseFloat(F)<=0,style:[_e.continueButton,{backgroundColor:x.container.buttonColor,borderRadius:x.button.borderRadius,borderWidth:x.button.borderWidth,borderColor:x.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[_e.continueButtonText,{color:x.container.buttonTitleColor,fontFamily:v.medium}],children:Ne?"Loading...":"Continue"})})})})]}),_t()]}):S==="onramp"&&ct?jsxRuntime.jsxs(reactNative.View,{style:_e.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(Ld(ct.provider.icon_urls,"png",ct.provider.icon_url))},style:_e.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[_e.onrampTitle,{color:x.container.titleColor,fontFamily:v.medium}],children:["Complete transaction with ",ct.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[_e.onrampSubtitle,{color:x.container.subtitleColor,fontFamily:v.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[_e.flowDiagram,{backgroundColor:x.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:_e.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:kr(`/icons/currencies/png/${ct.sourceCurrency.toLowerCase()}.png`)},style:_e.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[_e.flowLabel,{color:x.card.subtitleColor,fontFamily:v.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[_e.flowValue,{color:x.card.titleColor,fontFamily:v.medium}],children:ct.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(co,{size:16,color:x.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:_e.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:_e.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:di(je?.destination_token_metadata?.icon_urls,"png")||je?.destination_token_metadata?.icon_url||kr("/icons/tokens/png/usdc.png")},style:_e.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:di(je?.destination_token_metadata?.chain?.icon_urls,"png")||je?.destination_token_metadata?.chain?.icon_url||kr("/icons/networks/png/polygon.png")},style:[_e.flowNetworkBadge,{borderColor:R.background,borderRadius:x.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[_e.flowLabel,{color:x.card.subtitleColor,fontFamily:v.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[_e.flowValue,{color:x.card.titleColor,fontFamily:v.medium}],children:"USDC"})]}),jsxRuntime.jsx(co,{size:16,color:x.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:_e.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:_e.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ve||kr("/icons/tokens/png/usdc.png")},style:_e.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Ve||kr("/icons/networks/png/polygon.png")},style:[_e.flowNetworkBadge,{borderColor:R.background,borderRadius:x.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[_e.flowLabel,{color:x.card.subtitleColor,fontFamily:v.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[_e.flowValue,{color:x.card.titleColor,fontFamily:v.medium}],children:K})]})]}),jsxRuntime.jsx(reactNative.View,{style:[_e.onrampInfoBox,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[_e.onrampInfoText,{color:x.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 Ax({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(rr,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Fa.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Fa.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Pt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Fa.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Fa.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Fa.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Fa.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Fa.loading,children:jsxRuntime.jsx(Te,{size:48,strokeWidth:3})})})})]})}var Fa=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"}}),_e=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 Wx(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 Mx(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Ju({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=z(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ge(it(e.destination_token_metadata,"png")||kr("/icons/tokens/png/usdc.png")),c=s?"Deposit Processing":"Deposit Completed",u=Wx(e.created_at||new Date().toISOString()),h=Mx(e.source_amount_usd);return jsxRuntime.jsxs(Qr,{cardTokens:i,onPress:t,contentStyle:ts.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ts.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:ts.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ts.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ts.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ts.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[ts.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:u})]}),jsxRuntime.jsxs(reactNative.View,{style:ts.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ts.amount,{color:i.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(co,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var ts=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 db(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function ub(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 Ux(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var pb=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function fb(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Nx(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 Hx({count:e=4}){let{colors:t,components:r}=z(),o=ta.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,i=t.cardHover;return ta.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Da.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Da.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.icon,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Da.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.titleBar,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.subtitleBar,{backgroundColor:i,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.amountBar,{backgroundColor:i,opacity:o}]})]},a))})}var Da=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 ym({active:e,onClose:t,onBack:r,executions:o,externalUserId:n,publishableKey:i}){let{colors:s,fonts:a,components:l}=z(),[c,u]=ta.useState(o),[h,k]=ta.useState(false),[d,p]=ta.useState(null),[T,m]=ta.useState(false),w=ta.useRef(null);ta.useEffect(()=>{if(!e||!n)return;let b=async()=>{k(true);try{let V=[...(await sn(n,i,"deposit")).data].sort((P,B)=>{let W=P.created_at?new Date(P.created_at).getTime():0;return (B.created_at?new Date(B.created_at).getTime():0)-W});u(V);}catch(O){console.error("Failed to fetch executions:",O),u(o);}finally{k(false);}};b();let C=setInterval(b,1e4);return ()=>clearInterval(C)},[e,n,i,o]),ta.useEffect(()=>{o.length>0&&u(b=>{let C=new Set(b.map(V=>V.id)),O=o.filter(V=>!C.has(V.id));return O.length>0?[...O,...b]:b});},[o]),ta.useEffect(()=>{e||p(null);},[e]);let R=b=>{p(b);},v=()=>{p(null),m(false);},x=()=>{p(null),t();},F=()=>{if(!d)return null;let b=d,C=b.status==="pending"||b.status==="waiting"||b.status==="delayed",O=b.status==="succeeded",V=ge(it(b.destination_token_metadata,"png")||kr("/icons/tokens/png/usdc.png")),P=b.provider_metadata?.details,B=P?.currencyIn,W=P?.currencyOut;B?.currency?.symbol||"USDC";W?.currency?.symbol||"USDC";let Oe=ub(b.source_amount_base_unit,b.source_token_metadata?.decimals),G=ub(b.destination_amount_base_unit,b.destination_token_metadata?.decimals),ot=Ux(b.source_amount_usd),te=db(b.source_chain_type,b.source_chain_id),de=db(b.destination_chain_type,b.destination_chain_id),ae=()=>{b.explorer_url&&reactNative.Linking.openURL(b.explorer_url);},re=()=>{b.destination_explorer_url&&reactNative.Linking.openURL(b.destination_explorer_url);};return jsxRuntime.jsxs(Yt,{ref:w,style:ut.scrollContainer,contentContainerStyle:ut.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ut.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ut.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:V},style:ut.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ut.statusBadge,{backgroundColor:C?s.warning:s.success,borderColor:s.background}],children:C?jsxRuntime.jsx(Vr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Pt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ut.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ut.statusDot,{backgroundColor:C?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ut.statusText,{color:l.container.titleColor,fontFamily:a.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[ut.dateText,{color:l.container.subtitleColor,fontFamily:a.regular}],children:Nx(b.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[ut.card,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:[Oe," ",fb(b.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ut.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:[G," ",fb(b.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ut.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:ot})]}),jsxRuntime.jsx(reactNative.View,{style:[ut.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:te})]}),jsxRuntime.jsx(reactNative.View,{style:[ut.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:de})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let xe=!T;m(xe),xe?setTimeout(()=>{w.current?.scrollToEnd({animated:true});},100):w.current?.scrollTo({y:0,animated:true});},style:ut.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.toggleText,{color:l.container.actionTitle,fontFamily:a.regular}],children:T?"See less":"See more details"}),T?jsxRuntime.jsx(ci,{size:14,color:l.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Vr,{size:14,color:l.container.actionColor,strokeWidth:2})]}),T&&jsxRuntime.jsxs(reactNative.View,{style:[ut.card,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[b.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ae,style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ut.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:pb(b.transaction_hash)}),jsxRuntime.jsx(Bn,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ut.cardDivider,{backgroundColor:s.border}]})]}),b.destination_explorer_url&&O&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:re,style:ut.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardLabel,{color:l.card.rowLeftLabel,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ut.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.cardValue,{color:l.card.rowRightLabel,fontFamily:a.medium}],children:pb(b.destination_transaction_hashes[0])}),jsxRuntime.jsx(Bn,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]})]})]})},f=h&&c.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:d?"Deposit Details":"Deposit Tracker",onClose:x,showBack:!!d||!!r,onBack:d?v:r}),d?F():f?jsxRuntime.jsx(Hx,{}):jsxRuntime.jsx(Yt,{style:ut.scrollContainer,contentContainerStyle:ut.scrollContent,showsVerticalScrollIndicator:false,children:c.length===0?jsxRuntime.jsxs(reactNative.View,{style:ut.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ut.emptyText,{color:l.container.titleColor,fontFamily:a.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.emptySubtext,{color:l.container.subtitleColor,fontFamily:a.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:ut.executionsList,children:c.map(b=>jsxRuntime.jsx(Ju,{execution:b,onPress:()=>R(b)},b.id))})})]})}var ut=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 ad(e,t=true){let[r,o]=ta.useState(null),[n,i]=ta.useState(null),[s,a]=ta.useState(false),[l,c]=ta.useState(false),[u,h]=ta.useState(null),[k,d]=ta.useState(null);ta.useEffect(()=>{!t||r||(a(true),aa().then(w=>{o(w),h(null);}).catch(w=>{h(w instanceof Error?w:new Error(String(w)));}).finally(()=>{a(false);}));},[t,r]),ta.useEffect(()=>{!t||!e||n||(c(true),Cc(e).then(w=>{i(w),d(null);}).catch(w=>{d(w instanceof Error?w:new Error(String(w)));}).finally(()=>{c(false);}));},[t,e,n]);let p=s||l,T=u||k||null,m=null;if(r&&n){let w=n.blocked_country_codes||[],R=r.alpha2.toUpperCase();m=!w.some(v=>v.toUpperCase()===R);}return {isAllowed:m,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:p,error:T}}var Cm="unifold_recent_tokens",Kx=5,wb=[{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 rp(){try{let e=await Tf__default.default.getItem(Cm);return e?JSON.parse(e):[]}catch{return []}}async function Gx(e){try{let r=(await rp()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Kx);await Tf__default.default.setItem(Cm,JSON.stringify(o));}catch{}}async function Yx(e){try{let r=(await rp()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Tf__default.default.setItem(Cm,JSON.stringify(r)),r}catch{return []}}function Sm({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:u=.9,showHandle:h=true}){let{colors:k,fonts:d,components:p}=z(),[T,m]=ta.useState(""),[w,R]=ta.useState([]);ta.useEffect(()=>{e&&rp().then(R);},[e]),ta.useEffect(()=>{e||m("");},[e]);let v=ta.useMemo(()=>{let C=[];return r.forEach(O=>{O.chains.forEach(V=>{C.push({token:O,chain:V});});}),C},[r]),x=ta.useMemo(()=>{let C=[],O=new Set,V=(P,B,W,j)=>{let Z=`${P}-${B}:${W}`;if(O.has(Z))return;let Oe=r.find(ot=>ot.symbol===P);if(!Oe)return;let G=Oe.chains.find(ot=>ot.chain_type===B&&ot.chain_id===W);G&&(O.add(Z),C.push({token:Oe,chain:G,isRecent:j}));};return w.forEach(P=>{V(P.symbol,P.chainType,P.chainId,true);}),wb.forEach(P=>{V(P.symbol,P.chainType,P.chainId,false);}),C},[r,w]),F=ta.useMemo(()=>{if(!T.trim())return v;let C=T.toLowerCase();return v.filter(({token:O,chain:V})=>O.symbol.toLowerCase().includes(C)||O.name.toLowerCase().includes(C)||V.chain_name.toLowerCase().includes(C))},[v,T]),f=(C,O,V)=>wb.some(P=>P.symbol===C&&P.chainType===O&&P.chainId===V),g=async(C,O)=>{let V=`${O.chain_type}:${O.chain_id}`;if(!f(C.symbol,O.chain_type,O.chain_id)){await Gx({symbol:C.symbol,chainType:O.chain_type,chainId:O.chain_id});let P=await rp();R(P);}m(""),i(C.symbol,V),t();},b=async(C,O)=>{let V=await Yx({symbol:C.symbol,chainType:O.chain_type,chainId:O.chain_id});R(V);};return jsxRuntime.jsxs(rr,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:h,heightPercent:u,borderTopLeftRadius:s,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[br.header,!h&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:br.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[br.headerTitle,{color:p.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:br.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx($t,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:br.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[br.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:T,onChangeText:m,autoCapitalize:"none",autoCorrect:false})}),!l&&x.length>0&&!T&&jsxRuntime.jsxs(reactNative.View,{style:br.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:br.quickSelectScroll,children:x.map(({token:C,chain:O,isRecent:V})=>{let P=`${O.chain_type}:${O.chain_id}`;C.symbol===o&&P===n;return jsxRuntime.jsxs(reactNative.View,{children:[V&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>b(C,O),style:br.removeButton,children:jsxRuntime.jsx($t,{size:12,color:k.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>g(C,O),activeOpacity:.7,style:[br.quickSelectItem,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:br.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(C,"png"))},style:br.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(O,"png"))},style:[br.quickSelectChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:br.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.quickSelectSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[br.quickSelectChain,{color:p.card.subtitleColor,fontFamily:d.regular}],children:O.chain_name})]})]})]},`quick-${C.symbol}-${P}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[br.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Yt,{style:br.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:br.tokenListContent,children:F.length===0?jsxRuntime.jsx(reactNative.View,{style:br.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[br.emptyText,{color:k.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):F.map(({token:C,chain:O})=>{let V=`${O.chain_type}:${O.chain_id}`,P=C.symbol===o&&V===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>g(C,O),activeOpacity:.7,style:[br.tokenItem,{backgroundColor:P?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:br.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(C,"png"))},style:br.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(O,"png"))},style:[br.tokenChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:br.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.tokenSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[br.tokenChainName,{color:p.card.subtitleColor,fontFamily:d.regular}],children:O.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[br.minDeposit,{color:p.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:p.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",O.minimum_deposit_amount_usd]})]})]},`${C.symbol}-${V}`)})})]})}var br=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 ld=(e,t)=>`${t}:${e}`,t1=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Tm({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:d,onLatestExecution:p,onShowStatusSheet:T,onSelectedTokenIconUrl:m,wallets:w,borderTopLeftRadius:R,borderTopRightRadius:v,sheetBorderRadius:x}){let{colors:F,fonts:f,components:g}=z(),b=a&&l?`${a}:${l}`:"solana:mainnet",[C,O]=ta.useState("USDC"),[V,P]=ta.useState(b),[B,W]=ta.useState([]),[j,Z]=ta.useState(!w?.length),Oe=w?.length?w:B,[G,ot]=ta.useState([]),[te,de]=ta.useState(true),[ae,re]=ta.useState(false),[xe,$]=ta.useState(false),[Re,dt]=ta.useState(false),[Xe,Se]=ta.useState([]),[Ke,nt]=ta.useState(new Map),[Ge]=ta.useState(()=>new Date),[pt,st]=ta.useState(null),[Ne,ye]=ta.useState(false),[be,He]=ta.useState(null),[ft,yt]=ta.useState(false);ta.useEffect(()=>{be&&p?.(be);},[be]),ta.useEffect(()=>{Ne&&(T?.(true),ye(false));},[Ne]);let xt=new Map;G.forEach(X=>{X.chains.forEach(Fe=>{let _=`${Fe.chain_type}:${Fe.chain_id}`;xt.has(_)||xt.set(_,Fe);});});let lr=Array.from(xt.values()),$e=t1(V),fe=lr.find(X=>X.chain_type===$e.chainType&&X.chain_id===$e.chainId),Ye=fe?.chain_type||"ethereum",Je=nn(Oe,Ye),Ee=Je?.address||"",me=ta.useRef(false);ta.useEffect(()=>{async function X(){try{de(!0),st(null);let _=await Wi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(ot(_.data),_.data.length>0&&!me.current){me.current=!0;let S,M;if(a&&l)if(c)for(let q of _.data){let J=q.chains.find(K=>K.chain_type===a&&K.chain_id===l&&K.token_address.toLowerCase()===c.toLowerCase());if(J){S=q,M=J;break}}else {let q=K=>K.chain_type===a&&K.chain_id===l,J=_.data.find(K=>K.symbol==="USDC"&&K.chains.some(q));if(J)S=J,M=J.chains.find(q);else for(let K of _.data){let ve=K.chains.find(q);if(ve){S=K,M=ve;break}}}if(!S&&i)for(let q of _.data){let J=q.chains.find(K=>K.token_address.toLowerCase()===i.toLowerCase());if(J){S=q,M=J;break}}S||(S=_.data.find(q=>q.symbol==="USDC"),S&&S.chains.length>0&&(M=S.chains[0])),S||(S=_.data.find(q=>q.symbol==="USDT"),S&&S.chains.length>0&&(M=S.chains[0])),S||(S=_.data[0],S.chains.length>0&&(M=S.chains[0])),S&&O(S.symbol),M&&P(ld(M.chain_id,M.chain_type));}}catch(Fe){console.error("Error fetching supported tokens:",Fe),st("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Fe});}finally{de(false);}}X();},[t,i,n,o,a,l,c,d]),ta.useEffect(()=>{h&&h(Xe);},[Xe,h]),ta.useEffect(()=>{if(w?.length){Z(false);return}if(B.length>0){Z(false);return}let X=null,Fe=false,_=async()=>{if(!Fe){Z(true);try{let S=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);Fe||(W(S.data),st(null),Z(!1));}catch(S){console.error("Error fetching wallets, retrying in 5s:",S),Fe||(st(S instanceof Error?S.message:"Failed to load wallets"),Z(false),X=setTimeout(_,5e3));}}};return _(),()=>{Fe=true,X&&clearTimeout(X);}},[e,r,o,n,i,t,w,B.length]);let je=Je?.id??"",{showWaitingUi:vt,handleIveDeposited:Bt}=ii({depositConfirmationMode:u,depositAddress:Ee,chain:V,externalUserId:e,publishableKey:t,modalOpenedAt:Ge,depositWalletId:je,depositExecutions:Xe,trackedExecutions:Ke,setDepositExecutions:Se,setTrackedExecutions:nt,setLatestExecution:He,setShowStatusSheet:ye,onDepositSuccess:k,onExecutionsChange:h,onDepositError:d});ta.useEffect(()=>{if(!G.length)return;let X=G.find(_=>_.symbol===C);if(!X||X.chains.length===0){let _=G.find(S=>S.symbol==="USDC")||G[0];_&&(O(_.symbol),_.chains.length>0&&P(ld(_.chains[0].chain_id,_.chains[0].chain_type)));return}if(!X.chains.some(_=>ld(_.chain_id,_.chain_type)===V)){let _=X.chains[0];P(ld(_.chain_id,_.chain_type));}},[C,G,V]);let Nt=G.find(X=>X.symbol===C),ct=it(Nt,"png")||void 0;ta.useEffect(()=>{m?.(ct);},[ct]);let tt=(Nt?.chains||[]).find(X=>ld(X.chain_id,X.chain_type)===V),Ct=async()=>{if(Ee)try{reactNative.Clipboard.setString(Ee),re(!0),setTimeout(()=>re(!1),2e3);}catch(X){console.error("Failed to copy:",X);}},bt=tt?.estimated_price_impact_percent??0,Ae=tt?.max_slippage_percent??.25,at=tt?.minimum_deposit_amount_usd??3;return te?jsxRuntime.jsxs(reactNative.View,{style:Ce.loadingContainer,children:[jsxRuntime.jsx(Te,{size:48,strokeWidth:3}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.loadingText,{color:F.foregroundMuted,fontFamily:f.regular}],children:"Loading..."})]}):pt&&G.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ce.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorText,{color:F.error,fontFamily:f.regular}],children:pt}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorHint,{color:F.foregroundMuted,fontFamily:f.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Ce.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.selectorLabel,{color:g.card.labelColor,fontFamily:f.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>dt(true),disabled:te||G.length===0,style:[Ce.tokenSelectorButton,{backgroundColor:g.card.backgroundColor,borderRadius:g.card.borderRadius,borderWidth:g.card.borderWidth,borderColor:g.card.borderColor}],activeOpacity:.7,children:te?jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingIcon,{backgroundColor:F.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingLine,{backgroundColor:F.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingLine,{backgroundColor:F.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenIconWrapper,children:[Nt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(Nt,"png"))},style:Ce.tokenMainIcon}),(tt||fe)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(tt||fe,"png"))},style:[Ce.tokenChainBadge,{borderColor:g.card.backgroundColor,borderRadius:g.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.tokenSelectorSymbol,{color:g.card.titleColor,fontFamily:f.semibold}],children:Nt?.symbol||C}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.tokenSelectorNetwork,{color:g.card.subtitleColor,fontFamily:f.regular}],numberOfLines:1,children:tt?.chain_name||fe?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ce.minDepositText,{color:F.warning,fontFamily:f.medium}],children:["$",at," minimum"]}),jsxRuntime.jsx(co,{size:16,color:g.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Sm,{visible:Re,onClose:()=>dt(false),tokens:G,selectedToken:C,selectedChainKey:V,onSelect:(X,Fe)=>{O(X),P(Fe);},borderTopLeftRadius:x?.tokenSelector?.borderTopLeftRadius??R,borderTopRightRadius:x?.tokenSelector?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:Ce.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Ce.qrWrapper,{backgroundColor:F.background,borderRadius:g.card.borderRadius,borderWidth:g.card.borderWidth>0?g.card.borderWidth:1,borderColor:g.card.borderColor}],children:j?jsxRuntime.jsxs(reactNative.View,{style:Ce.qrLoading,children:[jsxRuntime.jsx(Te,{size:20,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.loadingText,{color:F.foregroundMuted,fontFamily:f.regular}],children:"Loading..."})]}):Ee?jsxRuntime.jsx(js,{value:Ee,size:180,logoUri:ge(it(tt,"png")||kr("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:Ce.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorText,{color:F.error,fontFamily:f.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:Ce.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.addressLabel,{color:g.card.labelColor,fontFamily:f.medium}],children:"Deposit Address"}),ae&&jsxRuntime.jsxs(reactNative.View,{style:Ce.copiedIndicator,children:[jsxRuntime.jsx(Pt,{size:14,color:F.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.copiedText,{color:F.success,fontFamily:f.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Qr,{cardTokens:g.transferCrypto.depositAddress.card,onPress:!j&&Ee?Ct:void 0,contentStyle:Ce.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.addressText,{color:g.card.titleColor,fontFamily:f.regular}],numberOfLines:2,children:j?"Loading...":Ee||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:Ce.addressCopyIcon,children:jsxRuntime.jsx(Kn,{size:16,color:g.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ce.detailsCard,{backgroundColor:g.card.backgroundColor,borderRadius:g.card.borderRadius,borderWidth:g.card.borderWidth,borderColor:g.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>$(!xe),style:Ce.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.detailsLabel,{color:g.card.titleColor,fontFamily:f.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:Ce.chevronContainer,children:xe?jsxRuntime.jsx(ci,{size:16,color:g.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Vr,{size:16,color:g.card.actionColor,strokeWidth:2})})]}),xe&&jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gn,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:g.card.titleColor,fontFamily:f.regular}],children:["Price impact: ",bt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Yn,{size:14,color:g.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:g.card.titleColor,fontFamily:f.regular}],children:["Slippage: Auto \u2022 ",Ae.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Yn,{size:14,color:g.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:g.card.titleColor,fontFamily:f.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Yy,{depositConfirmationMode:u,depositAddress:Ee,showWaitingUi:vt,latestExecution:be,onIveDeposited:Bt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:Ce.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.termsText,{color:F.primary,fontFamily:f.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(rr,{visible:ft,onClose:()=>yt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:x?.infoSheet?.borderTopLeftRadius??R,borderTopRightRadius:x?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ce.sheetHeader,{borderBottomColor:F.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.sheetTitle,{color:g.header.titleColor,fontFamily:f.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yt(false),style:Ce.sheetCloseButton,children:jsxRuntime.jsx($t,{size:20,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ce.infoCard,{backgroundColor:g.card.backgroundColor,borderRadius:g.card.borderRadius,borderWidth:g.card.borderWidth,borderColor:g.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.infoCardIcon,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gn,{size:16,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardTitle,{color:g.card.titleColor,fontFamily:f.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.infoCardValue,{color:g.card.titleColor,fontFamily:f.medium}],children:[bt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardDescription,{color:g.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:[Ce.infoCard,{backgroundColor:g.card.backgroundColor,borderRadius:g.card.borderRadius,borderWidth:g.card.borderWidth,borderColor:g.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.infoCardIcon,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardTitle,{color:g.card.titleColor,fontFamily:f.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.infoCardValue,{color:g.card.titleColor,fontFamily:f.medium}],children:[Ae.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardDescription,{color:g.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 Ce=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 Nl=(e,t)=>`${t}:${e}`,s1=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},a1=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function ip({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:d,onLatestExecution:p,onShowStatusSheet:T,onSelectedTokenIconUrl:m,onShowInfoSheet:w,onInfoSheetData:R,wallets:v,borderTopLeftRadius:x,borderTopRightRadius:F,sheetBorderRadius:f}){let{colors:g,fonts:b,components:C}=z(),O=a&&l?`${a}:${l}`:"solana:mainnet",[V,P]=ta.useState("USDC"),[B,W]=ta.useState(O),[j,Z]=ta.useState([]),[Oe,G]=ta.useState(!v?.length),ot=v?.length?v:j,[te,de]=ta.useState([]),[ae,re]=ta.useState(true),[xe,$]=ta.useState(false),[Re,dt]=ta.useState(false),[Xe,Se]=ta.useState(false),[Ke,nt]=ta.useState([]),[Ge,pt]=ta.useState(new Map),[st]=ta.useState(()=>new Date),[Ne,ye]=ta.useState(null),[be,He]=ta.useState(false),[ft,yt]=ta.useState(null),[xt,lr]=ta.useState(false),[$e,fe]=ta.useState(false),[Ye,Je]=ta.useState(""),[Ee,me]=ta.useState(""),je=ta.useRef(new reactNative.Animated.Value(0)).current;ta.useEffect(()=>{let De=reactNative.Animated.loop(reactNative.Animated.timing(je,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return De.start(),()=>De.stop()},[je]);let vt=je.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});ta.useEffect(()=>{ft&&p?.(ft);},[ft]),ta.useEffect(()=>{be&&(T?.(true),He(false));},[be]);let Bt=new Map;te.forEach(De=>{De.chains.forEach(wt=>{let lt=`${wt.chain_type}:${wt.chain_id}`;Bt.has(lt)||Bt.set(lt,wt);});});let Nt=Array.from(Bt.values()),ct=s1(B),er=Nt.find(De=>De.chain_type===ct.chainType&&De.chain_id===ct.chainId),tt=er?.chain_type||"ethereum",Ct=nn(ot,tt),bt=Ct?.address||"",Ae=ta.useRef(false);ta.useEffect(()=>{async function De(){try{re(!0),ye(null);let lt=await Wi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(de(lt.data),lt.data.length>0&&!Ae.current){Ae.current=!0;let ee,$r;if(a&&l)if(c)for(let mt of lt.data){let tr=mt.chains.find(Ht=>Ht.chain_type===a&&Ht.chain_id===l&&Ht.token_address.toLowerCase()===c.toLowerCase());if(tr){ee=mt,$r=tr;break}}else {let mt=Ht=>Ht.chain_type===a&&Ht.chain_id===l,tr=lt.data.find(Ht=>Ht.symbol==="USDC"&&Ht.chains.some(mt));if(tr)ee=tr,$r=tr.chains.find(mt);else for(let Ht of lt.data){let jr=Ht.chains.find(mt);if(jr){ee=Ht,$r=jr;break}}}if(!ee&&i)for(let mt of lt.data){let tr=mt.chains.find(Ht=>Ht.token_address.toLowerCase()===i.toLowerCase());if(tr){ee=mt,$r=tr;break}}ee||(ee=lt.data.find(mt=>mt.symbol==="USDC"),ee&&ee.chains.length>0&&($r=ee.chains[0])),ee||(ee=lt.data.find(mt=>mt.symbol==="USDT"),ee&&ee.chains.length>0&&($r=ee.chains[0])),ee||(ee=lt.data[0],ee.chains.length>0&&($r=ee.chains[0])),ee&&P(ee.symbol),$r&&W(Nl($r.chain_id,$r.chain_type));}}catch(wt){console.error("Error fetching supported tokens:",wt),ye("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:wt});}finally{re(false);}}De();},[t,i,n,o,a,l,c,d]),ta.useEffect(()=>{h&&h(Ke);},[Ke,h]),ta.useEffect(()=>{if(v?.length){G(false);return}if(j.length>0){G(false);return}let De=null,wt=false,lt=async()=>{if(!wt){G(true);try{let ee=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);wt||(Z(ee.data),ye(null),G(!1));}catch(ee){console.error("Error fetching wallets, retrying in 5s:",ee),wt||(ye(ee instanceof Error?ee.message:"Failed to load wallets"),G(false),De=setTimeout(lt,5e3));}}};return lt(),()=>{wt=true,De&&clearTimeout(De);}},[e,r,o,n,i,t,v,j.length]);let at=Ct?.id??"",{showWaitingUi:X,handleIveDeposited:Fe}=ii({depositConfirmationMode:u,depositAddress:bt,chain:B,externalUserId:e,publishableKey:t,modalOpenedAt:st,depositWalletId:at,depositExecutions:Ke,trackedExecutions:Ge,setDepositExecutions:nt,setTrackedExecutions:pt,setLatestExecution:yt,setShowStatusSheet:He,onDepositSuccess:k,onExecutionsChange:h,onDepositError:d}),_=u==="manual"&&bt&&!X;ta.useEffect(()=>{if(!te.length)return;let De=te.find(lt=>lt.symbol===V);if(!De||De.chains.length===0){let lt=te.find(ee=>ee.symbol==="USDC")||te[0];lt&&(P(lt.symbol),lt.chains.length>0&&W(Nl(lt.chains[0].chain_id,lt.chains[0].chain_type)));return}if(!De.chains.some(lt=>Nl(lt.chain_id,lt.chain_type)===B)){let lt=De.chains[0];W(Nl(lt.chain_id,lt.chain_type));}},[V,te,B]);let S=te.find(De=>De.symbol===V),M=it(S,"png")||void 0;ta.useEffect(()=>{m?.(M);},[M]);let q=S?.chains||[],J=q.find(De=>Nl(De.chain_id,De.chain_type)===B),K=async()=>{if(bt)try{reactNative.Clipboard.setString(bt),$(!0),setTimeout(()=>$(!1),2e3);}catch(De){console.error("Failed to copy:",De);}},ve=J?.estimated_price_impact_percent??0,Ve=J?.max_slippage_percent??.25,L=J?.minimum_deposit_amount_usd??3,U=J?.chain_name||er?.chain_name||"Network",Ot=ta.useMemo(()=>{if(!Ye.trim())return q;let De=Ye.toLowerCase();return q.filter(wt=>wt.chain_name.toLowerCase().includes(De))},[q,Ye]),We=ta.useMemo(()=>{if(!Ee.trim())return te;let De=Ee.toLowerCase();return te.filter(wt=>wt.symbol.toLowerCase().includes(De)||wt.name?.toLowerCase().includes(De)||wt.chains.some(lt=>lt.chain_name.toLowerCase().includes(De)))},[te,Ee]);return ae?jsxRuntime.jsxs(reactNative.View,{style:Pe.loadingContainer,children:[jsxRuntime.jsx(Te,{size:48,strokeWidth:3}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.loadingText,{color:g.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):Ne&&te.length===0?jsxRuntime.jsxs(reactNative.View,{style:Pe.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pe.errorText,{color:g.error,fontFamily:b.regular}],children:Ne}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.errorHint,{color:g.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Pe.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Pe.content,children:[jsxRuntime.jsxs(reactNative.View,{style:Pe.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pe.intentAddressLabel,{color:g.foregroundMuted,fontFamily:b.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[Pe.qrCard,{backgroundColor:g.background,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth>0?C.card.borderWidth:1,borderColor:C.card.borderColor}],children:Oe?jsxRuntime.jsxs(reactNative.View,{style:Pe.qrLoading,children:[jsxRuntime.jsx(Te,{size:20,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.loadingText,{color:g.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):bt?jsxRuntime.jsx(reactNative.View,{style:Pe.qrWrapper,children:jsxRuntime.jsx(js,{value:bt,size:200,logoUri:ge(it(S,"png")||kr("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ge(it(J,"png")||kr("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:Pe.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.errorText,{color:g.error,fontFamily:b.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:Pe.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Je(""),fe(true);},style:[Pe.selectorPill,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor}],activeOpacity:.7,children:[(J||er)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(J||er,"png"))},style:Pe.selectorPillIcon}),jsxRuntime.jsx(Vr,{size:14,color:C.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{me(""),Se(true);},disabled:ae||te.length===0,style:[Pe.selectorPill,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor}],activeOpacity:.7,children:[S&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(S,"png"))},style:Pe.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.selectorPillText,{color:C.card.titleColor,fontFamily:b.semibold}],children:S?.symbol||V}),jsxRuntime.jsx(Vr,{size:14,color:C.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:Pe.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:K,style:[Pe.addressPill,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pe.addressPillText,{color:C.card.titleColor,fontFamily:b.regular}],numberOfLines:1,children:Oe?"Loading...":bt?a1(bt):"No address"}),xe?jsxRuntime.jsx(Pt,{size:14,color:g.success,strokeWidth:2}):jsxRuntime.jsx(Kn,{size:14,color:C.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:X&&!ft?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:vt}]},children:jsxRuntime.jsx(dc,{size:16,color:g.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:g.foregroundMuted,fontFamily:b.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{R?.({priceImpact:ve,maxSlippage:Ve,minDepositUsd:L,chainName:U}),w?.(true);},style:Pe.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(Yn,{size:14,color:C.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[Pe.infoFooterText,{color:C.card.subtitleColor,fontFamily:b.regular}],numberOfLines:1,children:["$",L," ",U," Minimum and ","<","1 min Processing"]})]}),_?jsxRuntime.jsxs(reactNative.View,{style:Pe.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:Pe.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Fe,activeOpacity:.8,style:[Pe.ctaButton,{backgroundColor:g.primary,borderRadius:C.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.ctaText,{color:g.primaryForeground??"#FFF",fontFamily:b.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:Pe.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:K,activeOpacity:.8,style:[Pe.ctaButton,{backgroundColor:C.card.backgroundColor,borderRadius:C.button.borderRadius,borderWidth:1,borderColor:g.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.ctaText,{color:g.foreground,fontFamily:b.semibold}],children:xe?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:K,activeOpacity:.8,style:[Pe.ctaButton,{backgroundColor:g.primary,borderRadius:C.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.ctaText,{color:"#FFFFFF",fontFamily:b.semibold}],children:xe?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(rr,{visible:Xe,onClose:()=>{Se(false),me("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:f?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:f?.tokenSelector?.borderTopRightRadius??F,children:[jsxRuntime.jsxs(reactNative.View,{style:[Pe.sheetHeader,{borderBottomColor:g.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Pe.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.sheetTitle,{color:C.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Se(false),me("");},style:Pe.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx($t,{size:20,color:C.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Pe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pe.searchInput,{backgroundColor:C.search.backgroundColor,color:C.search.inputColor,fontFamily:b.regular,borderRadius:C.input.borderRadius,borderWidth:C.input.borderWidth,borderColor:C.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:C.search.placeholderColor,value:Ee,onChangeText:me,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Yt,{style:Pe.sheetList,contentContainerStyle:Pe.sheetListContent,showsVerticalScrollIndicator:false,children:We.length===0?jsxRuntime.jsx(reactNative.View,{style:Pe.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.emptyText,{color:g.foregroundMuted,fontFamily:b.regular}],children:"No tokens found"})}):We.map(De=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{P(De.symbol),Se(false),me("");},activeOpacity:.7,style:[Pe.sheetItem,{backgroundColor:V===De.symbol?C.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(De,"png"))},style:Pe.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.sheetItemTitle,{color:C.card.titleColor,fontFamily:b.medium}],children:De.symbol}),jsxRuntime.jsx(reactNative.View,{style:Pe.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[Pe.sheetItemBadge,{borderWidth:1,borderColor:g.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Pe.sheetItemBadgeText,{color:C.card.subtitleColor,fontFamily:b.medium}],children:[De.chains.length," chain",De.chains.length!==1?"s":""]})})]},De.symbol))})]}),jsxRuntime.jsxs(rr,{visible:$e,onClose:()=>{fe(false),Je("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:f?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:f?.chainSelector?.borderTopRightRadius??F,children:[jsxRuntime.jsxs(reactNative.View,{style:[Pe.sheetHeader,{borderBottomColor:g.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Pe.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.sheetTitle,{color:C.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{fe(false),Je("");},style:Pe.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx($t,{size:20,color:C.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Pe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pe.searchInput,{backgroundColor:C.search.backgroundColor,color:C.search.inputColor,fontFamily:b.regular,borderRadius:C.input.borderRadius,borderWidth:C.input.borderWidth,borderColor:C.input.borderColor}],placeholder:"Search networks",placeholderTextColor:C.search.placeholderColor,value:Ye,onChangeText:Je,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Yt,{style:Pe.sheetList,contentContainerStyle:Pe.sheetListContent,showsVerticalScrollIndicator:false,children:Ot.length===0?jsxRuntime.jsx(reactNative.View,{style:Pe.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.emptyText,{color:g.foregroundMuted,fontFamily:b.regular}],children:"No networks found"})}):Ot.map(De=>{let wt=Nl(De.chain_id,De.chain_type),lt=B===wt;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{W(wt),fe(false),Je("");},activeOpacity:.7,style:[Pe.chainItem,{backgroundColor:lt?C.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(De,"png"))},style:Pe.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:Pe.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[Pe.chainItemName,{color:C.card.titleColor,fontFamily:b.medium}],children:De.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[Pe.chainMinBadge,{backgroundColor:`${g.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Pe.chainMinBadgeText,{color:g.warning,fontFamily:b.medium}],children:["$",De.minimum_deposit_amount_usd," Minimum"]})})]},wt)})})]})]})}var Pe=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 Rb(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function d1(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=s<10?`0${s}`:s;return `${r} ${o}, ${n} at ${i}:${l}${a}`}function ap({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:u,heightProcessing:h,heightCompleted:k,heightCompletedExpanded:d}){let{components:p}=z(),[T,m]=ta.useState(false),w=t==="succeeded";return jsxRuntime.jsx(rr,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:w?T?d??k??.55:k??.55:h??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:u,children:jsxRuntime.jsxs(reactNative.View,{style:Er.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Er.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:p.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Er.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:Er.scrollContent,children:jsxRuntime.jsx(u1,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,showDetails:T,onToggleDetails:()=>m(!T)})})]})})}function u1({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:i,showDetails:s,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:u,components:h}=z(),[k,d]=ta.useState(false),p=s??k,T=a??(()=>d(F=>!F)),m=e==="pending"||e==="waiting"||e==="delayed",w=e==="succeeded",R=!!r||!!o,v=()=>{r&&reactNative.Linking.openURL(r);},x=()=>{o&&reactNative.Linking.openURL(o);};return jsxRuntime.jsxs(reactNative.View,{style:[Er.container,l],children:[jsxRuntime.jsx(reactNative.View,{style:Er.iconContainer,children:m?jsxRuntime.jsx(Te,{size:80,strokeWidth:4,iconSize:56,children:t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(t)},style:Er.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Er.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(t)},style:Er.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Er.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Er.statusBadge,{backgroundColor:h.container.iconBackgroundColor}],children:jsxRuntime.jsx(Pt,{size:16,color:h.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Er.title,{color:h.container.titleColor,fontFamily:u.semibold}],children:m?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Er.amount,{color:h.container.titleColor,fontFamily:u.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[Er.date,{color:h.container.subtitleColor,fontFamily:u.regular}],children:d1(n)}),jsxRuntime.jsx(reactNative.Text,{style:[Er.subtitle,{color:h.container.subtitleColor,fontFamily:u.regular}],children:m?"This usually takes less than a minute.":"Your account has been credited successfully!"}),w&&R&&jsxRuntime.jsxs(reactNative.View,{style:Er.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Er.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Er.detailsToggle,onPress:T,children:[jsxRuntime.jsx(reactNative.Text,{style:[Er.detailsToggleText,{color:h.container.actionTitle,fontFamily:u.medium}],children:p?"See less":"See more details"}),p?jsxRuntime.jsx(ci,{size:18,color:h.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Vr,{size:18,color:h.container.actionColor,strokeWidth:2})]}),p&&jsxRuntime.jsxs(reactNative.View,{style:Er.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Er.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:v,children:[jsxRuntime.jsx(reactNative.Text,{style:[Er.txLabel,{color:h.card.titleColor,fontFamily:u.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Er.txHash,{color:h.card.subtitleColor,fontFamily:u.regular}],children:Rb(r)}),jsxRuntime.jsx(Bn,{size:16,color:h.card.actionColor,strokeWidth:2})]}),o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Er.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:x,children:[jsxRuntime.jsx(reactNative.Text,{style:[Er.txLabel,{color:h.card.titleColor,fontFamily:u.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Er.txHash,{color:h.card.subtitleColor,fontFamily:u.regular}],children:Rb(o)}),jsxRuntime.jsx(Bn,{size:16,color:h.card.actionColor,strokeWidth:2})]})]})]})]})}var Er=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function km({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:i,borderTopLeftRadius:s,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:u,components:h}=z(),k=[{icon:jsxRuntime.jsx(jo,{size:14,color:h.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(Gn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${i}`},{icon:jsxRuntime.jsx(Gn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(Jo,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(rr,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:s,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:qn.header,children:[jsxRuntime.jsxs(reactNative.View,{style:qn.titleRow,children:[jsxRuntime.jsx(Yn,{size:16,color:h.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[qn.title,{color:h.header.titleColor,fontFamily:u.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:qn.closeButton,children:jsxRuntime.jsx($t,{size:18,color:h.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:qn.rows,children:[k.map((d,p)=>jsxRuntime.jsxs(reactNative.View,{style:qn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[qn.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:d.icon}),jsxRuntime.jsx(reactNative.Text,{style:[qn.label,{color:h.card.titleColor,fontFamily:u.regular}],children:d.label})]},p)),jsxRuntime.jsxs(reactNative.View,{style:qn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[qn.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:14,color:h.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[qn.label,{color:h.card.titleColor,fontFamily:u.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var qn=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 In={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 Link",subtitle:"Buy with card or bank"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},coinbaseApplePay:{title:"Pay with Apple Pay",subtitle:"Instant"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function y1(){let{colors:e,components:t}=z(),r=ta.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ta.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]);let i=({rightIcons:s=2})=>jsxRuntime.jsxs(reactNative.View,{style:[Gs.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:Gs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:Gs.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[Gs.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:Gs.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var Gs=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 b1({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=z(),i=({tab:s,label:a,glyph:l})=>{let c=e===s,u=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:cd.item,activeOpacity:.8,onPress:()=>t(s),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[cd.badge,{backgroundColor:u}],children:jsxRuntime.jsx(reactNative.Text,{style:[cd.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[cd.label,{color:u,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[cd.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(i,{tab:"crypto",label:In.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(i,{tab:"cash",label:In.tabs.cash,glyph:"$"})]})}var cd=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 w1({visible:e,onClose:t,closeOnBackdropPress:r=false,externalUserId:o,publishableKey:n,modalTitle:i="Deposit",transferCryptoTitle:s,user:a,destinationTokenSymbol:l,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,defaultChainType:d,defaultChainId:p,defaultTokenAddress:T,showBalance:m=false,hideDepositTracker:w,enableTransferCrypto:R,enableCashApp:v,enableConnectWallet:x,enableCoinbaseApplePay:F,enableFiatOnramp:f,enableStripeLink:g,StripeOnrampComponent:b,stripePaymentSelectorPosition:C,stripeSkipSuccessConfirmation:O,stripeTheme:V,depositConfirmationMode:P="auto_ui",transferInputVariant:B="double_input",depositMenuDisplay:W="stacked",initialScreen:j="main",onDepositSuccess:Z,onDepositError:Oe,sheetBorderRadius:G}){let ot=G?.globalBorderTopLeftRadius,te=G?.globalBorderTopRightRadius,{colors:de,fonts:ae}=z(),[re,xe]=ta.useState([]),[$,Re]=ta.useState(null),[dt,Xe]=ta.useState(false),[Se,Ke]=ta.useState(false),nt=ta.useRef(null),[Ge,pt]=ta.useState("amount"),[st,Ne]=ta.useState(false),[ye,be]=ta.useState(null),[He,ft]=ta.useState(void 0),[yt,xt]=ta.useState(false),[lr,$e]=ta.useState(null),fe=R??$?.transfer_crypto?.enabled??true,Ye=x??$?.connect_wallet?.enabled??false,Je=v??$?.cash_app?.enabled??false,Ee=F??$?.apple_pay?.enabled??false,me=reactNative.Platform.OS==="ios"&&Ee&&dt,je=!$?.fiat_onramp?.is_hidden&&(f??$?.fiat_onramp?.enabled??true),vt=!$?.stripe_link?.is_hidden&&(g??$?.stripe_link?.enabled??false)&&!!b,Bt=w?false:$?.deposit_tracker?.enabled??true,Nt=R??$?.transfer_crypto?.enabled??false,ct=x??$?.connect_wallet?.enabled??false,er=v??$?.cash_app?.enabled??false,tt=me,Ct=!!$&&vt,bt=!!$&&!$?.fiat_onramp?.is_hidden&&(f??$?.fiat_onramp?.enabled??false),Ae=w?false:$?.deposit_tracker?.enabled??false,at=j==="tracker"&&Ae?"tracker":j==="transfer"&&Nt?"transfer":j==="card"&&bt?"card":j==="cashapp"&&er?"cashapp":j==="apple_pay"&&tt?"coinbaseApplePay":j==="stripe_link"&&Ct?"stripe":j==="wallet"&&ct?"wallet":"main",[X,Fe]=ta.useState(at==="main"),[_,S]=ta.useState(at),[M,q]=ta.useState("crypto"),{isAllowed:J,isLoading:K}=ad(n,e);ta.useEffect(()=>{if(!e||$)return;let _t=false;return Cc(n).then(async oe=>{if(_t)return;let we=[];for(let ht of oe?.transfer_crypto?.networks??[]){let Cr=ht.icon_urls.find(Or=>Or.format==="png")?.url||ht.icon_urls.find(Or=>Or.format==="svg")?.url;Cr&&we.push(ge(Cr));}for(let ht of oe?.payment_networks?.networks??[]){let Cr=ht.icon_urls.find(Or=>Or.format==="png")?.url||ht.icon_urls.find(Or=>Or.format==="svg")?.url;Cr&&we.push(ge(Cr));}we.length>0&&await $c(we),_t||Re(oe);}).catch(console.error),()=>{_t=true;}},[e,$,n]),ta.useEffect(()=>{if(nt.current!==n&&(Xe(false),Ke(false)),!e||reactNative.Platform.OS!=="ios"||!Ee||nt.current===n)return;let _t=false;return (async()=>{for(let we=1;we<=4;we++)try{let ht=await xh(n);if(_t)return;nt.current=n;let Cr=(ht.data??[]).some(Or=>Or.enabled??!0);Xe(Cr),Ke(!0);return}catch{if(_t)return;if(we===4){Ke(true);return}await new Promise(ht=>setTimeout(()=>ht(),500*2**(we-1)));}})(),()=>{_t=true;}},[e,Ee,n]);let ve=reactNative.Platform.OS!=="ios"||!Ee||Se,Ve=()=>{t();},L=ta.useRef(false);ta.useEffect(()=>{e&&!L.current&&(S(at),Fe(at==="main"),pt("amount"),xt(false),$e(null),q("crypto")),L.current=e;},[e,at]),ta.useEffect(()=>{if(!e||_!=="main")return;if(j==="apple_pay"){if(me){S("coinbaseApplePay"),Fe(false);return}ve&&Fe(true);return}if(!$)return;let _t=j==="wallet"&&Ye?"wallet":j==="transfer"&&fe?"transfer":j==="card"&&je?"card":j==="cashapp"&&Je?"cashapp":j==="stripe_link"&&vt?"stripe":j==="tracker"&&Bt?"tracker":null;_t&&(S(_t),Fe(false));},[e,$,j,_,Ye,fe,je,Je,me,vt,Bt,ve]),ta.useEffect(()=>{if(!$)return;(_==="transfer"&&!fe||_==="card"&&!je||_==="cashapp"&&!Je||_==="coinbaseApplePay"&&!me||_==="stripe"&&!vt||_==="wallet"&&!Ye||_==="tracker"&&!Bt)&&(S("main"),Fe(true));},[$,_,fe,je,Je,me,vt,Ye,Bt]);let U=ta.useCallback(_t=>{_t.length!==0&&xe(oe=>{let we=new Map(oe.map(ht=>[ht.id,ht]));for(let ht of _t)we.set(ht.id,ht);return Array.from(we.values())});},[]),Ot=ta.useCallback(()=>{xt(false),$e(null),X?(S("main"),pt("amount")):Ve();},[X,Ve]),We=ta.useRef(reactNative.AppState.currentState==="active"),De=ta.useRef(0);ta.useEffect(()=>{if(reactNative.Platform.OS!=="android")return;let _t=reactNative.AppState.addEventListener("change",oe=>{oe==="active"&&!We.current&&(De.current=Date.now()),We.current=oe==="active";});return ()=>_t.remove()},[]);let wt=ta.useCallback(()=>{if(reactNative.Platform.OS==="android"){let _t=!We.current,oe=Date.now()-De.current<800;if(_t||oe)return}Ot();},[Ot]),lt=ta.useCallback(()=>{if(reactNative.Platform.OS==="android"){let _t=!We.current,oe=Date.now()-De.current<800;if(_t||oe)return}Ve();},[Ve]),ee=re.filter(_t=>_t.status==="pending"||_t.status==="waiting").length,mt=!!(c&&u&&h&&k&&n)&&m!==false&&!!$,tr=yc.includes(u)?u:void 0,Ht=K||e&&!$,jr=J===false,Rr=null;if(_==="stripe"&&b){let _t=jsxRuntime.jsx(b,{publishableKey:n,email:a?.email,phone:a?.phone,externalUserId:o,recipientAddress:c??"",destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,paymentSelectorPosition:C,skipSuccessConfirmation:O,appName:$?.project_name??"",onClose:Ot});Rr=V?jsxRuntime.jsx(Ja,{...V,children:_t}):_t;}let ai=(fe?1:0)+(Ye?1:0)+(je?1:0)+(Je?1:0)+(me?1:0)+(vt?1:0)+(Bt?1:0),on=W!=="tabs"&&ai>5,yo=_==="stripe"||_==="transfer"||_==="card"||_==="cashapp"||_==="coinbaseApplePay"||_==="wallet"||_==="tracker"?.9:_==="main"?on?.9:Je||Ye||me?.6:.5:void 0,Io=_==="main"?.9:void 0,bo={main:G?.main,transfer:G?.transferCrypto,card:G?.buyWithCard,stripe:G?.stripeLink,cashapp:G?.cashApp,coinbaseApplePay:G?.coinbaseApplePay,wallet:G?.connectWallet,tracker:G?.depositsTracker}[_],na=bo?.borderTopLeftRadius??ot,wo=bo?.borderTopRightRadius??te,Li=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ye&&jsxRuntime.jsx(ap,{visible:st,useModal:false,status:ye.status,tokenIconUrl:ye.destination_token_metadata?.icon_urls?.find(_t=>_t.format==="png")?.url||ye.destination_token_metadata?.icon_url||He,explorerUrl:ye.explorer_url,completionExplorerUrl:ye.destination_explorer_url,date:ye.created_at?new Date(ye.created_at):void 0,amountUsd:ye.source_amount_usd?parseFloat(ye.source_amount_usd):void 0,onClose:()=>Ne(false),heightProcessing:_==="card"||_==="wallet"?.35:void 0,heightCompleted:_==="card"||_==="wallet"?.41:void 0,heightCompletedExpanded:_==="card"||_==="wallet"?.53:void 0,borderTopLeftRadius:G?.depositStatus?.borderTopLeftRadius??ot,borderTopRightRadius:G?.depositStatus?.borderTopRightRadius??te}),lr&&jsxRuntime.jsx(km,{visible:yt,useModal:false,onClose:()=>xt(false),priceImpact:lr.priceImpact,maxSlippage:lr.maxSlippage,minDepositUsd:lr.minDepositUsd,chainName:lr.chainName,borderTopLeftRadius:G?.infoSheet?.borderTopLeftRadius??ot,borderTopRightRadius:G?.infoSheet?.borderTopRightRadius??te})]});return jsxRuntime.jsxs(rr,{visible:e,onClose:_==="main"?Ve:_==="transfer"||_==="card"||_==="cashapp"||_==="wallet"||_==="stripe"||_==="coinbaseApplePay"||_==="tracker"?lt:wt,onRequestClose:_==="main"?Ve:wt,closeOnBackdropPress:r,onBackdropPress:Ve,enablePanDownToClose:true,showHandle:true,heightPercent:yo,maxHeightPercent:Io,borderTopLeftRadius:na,borderTopRightRadius:wo,overlay:Li,children:[_==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:i,showBack:false,onClose:Ve,showBalance:mt,balanceAddress:c,balanceChainType:tr,balanceChainId:h,balanceTokenAddress:k,publishableKey:n,projectName:$?.project_name}),Ht&&jsxRuntime.jsx(y1,{}),!Ht&&jr&&jsxRuntime.jsxs(reactNative.View,{style:ko.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ko.iconContainer,{backgroundColor:de.cardHover}],children:jsxRuntime.jsx(uc,{size:32,color:de.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ko.blockedTitle,{color:de.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[ko.blockedDescription,{color:de.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!Ht&&!jr&&(()=>{let _t=fe?jsxRuntime.jsx(jc,{onPress:()=>S("transfer"),title:s??In.transferCrypto.title,subtitle:In.transferCrypto.subtitle,featuredTokens:$?.transfer_crypto?.networks},"transfer"):null,oe=je?jsxRuntime.jsx(Qc,{onPress:()=>S("card"),title:In.depositWithCard.title,subtitle:In.depositWithCard.subtitle,paymentNetworks:$?.payment_networks?.networks},"card"):null,we=Ye?jsxRuntime.jsx(Zc,{onPress:()=>S("wallet"),featuredWallets:$?.connect_wallet?.wallets},"wallet"):null,ht=Je?jsxRuntime.jsx(Jc,{onPress:()=>S("cashapp")},"cashapp"):null,Cr=me?jsxRuntime.jsx(Xc,{onPress:()=>S("coinbaseApplePay"),title:In.coinbaseApplePay.title,subtitle:In.coinbaseApplePay.subtitle},"coinbaseApplePay"):null,Or=vt?jsxRuntime.jsx(Yc,{onPress:()=>S("stripe"),title:In.stripeLinkPay.title,subtitle:In.stripeLinkPay.subtitle},"stripe"):null,$o=Bt?jsxRuntime.jsx(Kc,{onPress:()=>S("tracker"),title:In.depositTracker.title,subtitle:In.depositTracker.subtitle,badge:ee>0?ee:void 0},"tracker"):null;return jsxRuntime.jsxs(reactNative.View,{style:ko.optionsContainer,children:[W==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(b1,{selected:M,onSelect:q}),M==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_t,we]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Or,oe,ht,Cr]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_t,we,Or,oe,ht,Cr]}),$o]})})()]}),_==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:s??In.transferCrypto.title,showBack:X,onBack:Ot,onClose:Ve,showBalance:mt,balanceAddress:c,balanceChainType:tr,balanceChainId:h,balanceTokenAddress:k,publishableKey:n,projectName:$?.project_name}),K&&jsxRuntime.jsx(reactNative.View,{style:[ko.centeredContainer,ko.centeredFlex],children:jsxRuntime.jsx(Te,{size:48,strokeWidth:3})}),!K&&jr&&jsxRuntime.jsxs(reactNative.View,{style:[ko.centeredContainer,ko.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[ko.iconContainer,{backgroundColor:de.cardHover}],children:jsxRuntime.jsx(uc,{size:32,color:de.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ko.blockedTitle,{color:de.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[ko.blockedDescription,{color:de.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!K&&!jr&&jsxRuntime.jsx(Yt,{style:ko.transferScrollContainer,contentContainerStyle:B==="compact"?ko.scrollContentCompact:ko.scrollContent,showsVerticalScrollIndicator:false,children:B==="compact"?jsxRuntime.jsx(ip,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:p,defaultTokenAddress:T,depositConfirmationMode:P,onExecutionsChange:U,onDepositSuccess:Z,onDepositError:Oe,onLatestExecution:be,onShowStatusSheet:Ne,onSelectedTokenIconUrl:ft,onShowInfoSheet:xt,onInfoSheetData:$e,borderTopLeftRadius:ot,borderTopRightRadius:te,sheetBorderRadius:{tokenSelector:G?.tokenSelector,chainSelector:G?.chainSelector,infoSheet:G?.infoSheet,depositStatus:G?.depositStatus}}):B==="single_input"?jsxRuntime.jsx(Tm,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:p,defaultTokenAddress:T,depositConfirmationMode:P,onExecutionsChange:U,onDepositSuccess:Z,onDepositError:Oe,onLatestExecution:be,onShowStatusSheet:Ne,onSelectedTokenIconUrl:ft,borderTopLeftRadius:ot,borderTopRightRadius:te,sheetBorderRadius:{tokenSelector:G?.tokenSelector,infoSheet:G?.infoSheet,depositStatus:G?.depositStatus}}):jsxRuntime.jsx(Nu,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:p,defaultTokenAddress:T,depositConfirmationMode:P,onExecutionsChange:U,onDepositSuccess:Z,onDepositError:Oe,onLatestExecution:be,onShowStatusSheet:Ne,onSelectedTokenIconUrl:ft,borderTopLeftRadius:ot,borderTopRightRadius:te,sheetBorderRadius:{tokenSelector:G?.tokenSelector,chainSelector:G?.chainSelector,infoSheet:G?.infoSheet,depositStatus:G?.depositStatus}})})]}),_==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:`Deposit ${l||"USDC"}`,showBack:Ge==="onramp"||X,onBack:()=>{Ge==="onramp"?pt("amount"):Ot();},onClose:Ve,showBalance:mt,balanceAddress:c,balanceChainType:tr,balanceChainId:h,balanceTokenAddress:k,publishableKey:n,projectName:$?.project_name}),jsxRuntime.jsx(reactNative.View,{style:ko.buyWithCardContainer,children:jsxRuntime.jsx(Ku,{externalUserId:o,publishableKey:n,destinationTokenSymbol:l,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,onDepositSuccess:Z,onDepositError:Oe,onExecutionsChange:U,onLatestExecution:be,onShowStatusSheet:Ne,onSelectedTokenIconUrl:ft,view:Ge,onViewChange:_t=>pt(_t),borderTopLeftRadius:ot,borderTopRightRadius:te,sheetBorderRadius:{providerModal:G?.providerModal,webView:G?.webView,currencyModal:G?.currencyModal}})})]}),_==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:ko.cashAppContainer,children:jsxRuntime.jsx(Ru,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,onBack:Ot,onClose:Ve,onDepositSuccess:Z})}),_==="coinbaseApplePay"&&jsxRuntime.jsx(reactNative.View,{style:ko.coinbaseApplePayContainer,children:jsxRuntime.jsx(Du,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,destinationTokenSymbol:l,user:a,enabled:me,onBack:Ot,onClose:Ve,onDepositSuccess:Z,onDepositError:Oe,onExecutionsChange:U})}),_==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:ko.connectWalletContainer,children:jsxRuntime.jsx(Wu,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:u,destinationChainId:h,destinationTokenAddress:k,onBack:Ot,onClose:Ve,onDepositSuccess:Z,onDepositError:Oe,onExecutionsChange:U,onLatestExecution:be,onShowStatusSheet:Ne})}),_==="stripe"&&Rr&&jsxRuntime.jsx(reactNative.View,{style:ko.stripeLinkPayContainer,children:Rr}),_==="tracker"&&jsxRuntime.jsx(ym,{active:_==="tracker",onClose:Ve,onBack:Ot,executions:re,externalUserId:o,publishableKey:n})]})}function up({theme:e="auto",...t}){return jsxRuntime.jsx(w1,{...t})}var ko=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},coinbaseApplePayContainer:{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 jl=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 La,Js,ql,Pb,S1=(Pb=class extends jl{constructor(){super();ue(this,La);ue(this,Js);ue(this,ql);Y(this,ql,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Js)||this.setEventListener(y(this,ql));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Js))==null||t.call(this),Y(this,Js,void 0));}setEventListener(t){var r;Y(this,ql,t),(r=y(this,Js))==null||r.call(this),Y(this,Js,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,La)!==t&&(Y(this,La,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,La)=="boolean"?y(this,La):globalThis.document?.visibilityState!=="hidden"}},La=new WeakMap,Js=new WeakMap,ql=new WeakMap,Pb),Fb=new S1;var T1={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Oi,Ba,Db,k1=(Db=class{constructor(){ue(this,Oi,T1);ue(this,Ba,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,Ba)&&e!==y(this,Oi)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,Oi),provider:e}),Y(this,Oi,e),process.env.NODE_ENV!=="production"&&Y(this,Ba,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Ba,true),y(this,Oi).setTimeout(e,t)}clearTimeout(e){y(this,Oi).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Ba,true),y(this,Oi).setInterval(e,t)}clearInterval(e){y(this,Oi).clearInterval(e);}},Oi=new WeakMap,Ba=new WeakMap,Db),ud=new k1;function Ob(e){setTimeout(e,0);}var xm=typeof window>"u"||"Deno"in globalThis;function Ql(){}function _m(e){return typeof e=="number"&&e>=0&&e!==1/0}function Bb(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Kl(e,t){return typeof e=="function"?e(t):e}function Pn(e,t){return typeof e=="function"?e(t):e}var x1=Object.prototype.hasOwnProperty;function pp(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Vb(e)&&Vb(t);if(!o&&!(Ab(e)&&Ab(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},c=0;for(let u=0;u<a;u++){let h=o?u:s[u],k=e[h],d=t[h];if(k===d){l[h]=k,(o?u<i:x1.call(e,h))&&c++;continue}if(k===null||d===null||typeof k!="object"||typeof d!="object"){l[h]=d;continue}let p=pp(k,d,r+1);l[h]=p,p===k&&c++;}return i===a&&c===i?e:l}function fp(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 Vb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ab(e){if(!Lb(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Lb(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Lb(e){return Object.prototype.toString.call(e)==="[object Object]"}function Rm(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 pp(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 pp(e,t)}return t}function mp(e,t){return typeof e=="function"?e(...t):!!e}var Gl=(()=>{let e=()=>xm;return {isServer(){return e()},setIsServer(t){e=t;}}})();function vm(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Eb=Ob;function _1(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Eb,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var pd=_1();var Yl,Zs,Jl,Wb,R1=(Wb=class extends jl{constructor(){super();ue(this,Yl,true);ue(this,Zs);ue(this,Jl);Y(this,Jl,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,Zs)||this.setEventListener(y(this,Jl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Zs))==null||t.call(this),Y(this,Zs,void 0));}setEventListener(t){var r;Y(this,Jl,t),(r=y(this,Zs))==null||r.call(this),Y(this,Zs,t(this.setOnline.bind(this)));}setOnline(t){y(this,Yl)!==t&&(Y(this,Yl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,Yl)}},Yl=new WeakMap,Zs=new WeakMap,Jl=new WeakMap,Wb),Mb=new R1;function zb(e){return (e??"online")==="online"?Mb.isOnline():true}function Ub(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zb(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var hn,Zt,md,tn,Ea,Zl,as,Xs,hd,Xl,ec,Wa,Ma,ea,tc,wr,fd,Im,Pm,Fm,Dm,Om,Vm,Am,jb,$b,Bm=($b=class extends jl{constructor(t,r){super();ue(this,wr);ue(this,hn);ue(this,Zt);ue(this,md);ue(this,tn);ue(this,Ea);ue(this,Zl);ue(this,as);ue(this,Xs);ue(this,hd);ue(this,Xl);ue(this,ec);ue(this,Wa);ue(this,Ma);ue(this,ea);ue(this,tc,new Set);this.options=r,Y(this,hn,t),Y(this,Xs,null),Y(this,as,vm()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(y(this,Zt).addObserver(this),Nb(y(this,Zt),this.options)?Mt(this,wr,fd).call(this):this.updateResult(),Mt(this,wr,Dm).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Lm(y(this,Zt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Lm(y(this,Zt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Mt(this,wr,Om).call(this),Mt(this,wr,Vm).call(this),y(this,Zt).removeObserver(this);}setOptions(t){let r=this.options,o=y(this,Zt);if(this.options=y(this,hn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pn(this.options.enabled,y(this,Zt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Mt(this,wr,Am).call(this),y(this,Zt).setOptions(this.options),r._defaulted&&!fp(this.options,r)&&y(this,hn).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,Zt),observer:this});let n=this.hasListeners();n&&Hb(y(this,Zt),o,this.options,r)&&Mt(this,wr,fd).call(this),this.updateResult(),n&&(y(this,Zt)!==o||Pn(this.options.enabled,y(this,Zt))!==Pn(r.enabled,y(this,Zt))||Kl(this.options.staleTime,y(this,Zt))!==Kl(r.staleTime,y(this,Zt)))&&Mt(this,wr,Im).call(this);let i=Mt(this,wr,Pm).call(this);n&&(y(this,Zt)!==o||Pn(this.options.enabled,y(this,Zt))!==Pn(r.enabled,y(this,Zt))||i!==y(this,ea))&&Mt(this,wr,Fm).call(this,i);}getOptimisticResult(t){let r=y(this,hn).getQueryCache().build(y(this,hn),t),o=this.createResult(r,t);return I1(this,o)&&(Y(this,tn,o),Y(this,Zl,this.options),Y(this,Ea,y(this,Zt).state)),o}getCurrentResult(){return y(this,tn)}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,as).status==="pending"&&y(this,as).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){y(this,tc).add(t);}getCurrentQuery(){return y(this,Zt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=y(this,hn).defaultQueryOptions(t),o=y(this,hn).getQueryCache().build(y(this,hn),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Mt(this,wr,fd).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),y(this,tn)))}createResult(t,r){let o=y(this,Zt),n=this.options,i=y(this,tn),s=y(this,Ea),a=y(this,Zl),c=t!==o?t.state:y(this,md),{state:u}=t,h={...u},k=false,d;if(r._optimisticResults){let C=this.hasListeners(),O=!C&&Nb(t,r),V=C&&Hb(t,o,r,n);(O||V)&&(h={...h,...Ub(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:p,errorUpdatedAt:T,status:m}=h;d=h.data;let w=false;if(r.placeholderData!==void 0&&d===void 0&&m==="pending"){let C;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(C=i.data,w=true):C=typeof r.placeholderData=="function"?r.placeholderData(y(this,ec)?.state.data,y(this,ec)):r.placeholderData,C!==void 0&&(m="success",d=Rm(i?.data,C,r),k=true);}if(r.select&&d!==void 0&&!w)if(i&&d===s?.data&&r.select===y(this,hd))d=y(this,Xl);else try{Y(this,hd,r.select),d=r.select(d),d=Rm(i?.data,d,r),Y(this,Xl,d),Y(this,Xs,null);}catch(C){Y(this,Xs,C);}y(this,Xs)&&(p=y(this,Xs),d=y(this,Xl),T=Date.now(),m="error");let R=h.fetchStatus==="fetching",v=m==="pending",x=m==="error",F=v&&R,f=d!==void 0,b={status:m,fetchStatus:h.fetchStatus,isPending:v,isSuccess:m==="success",isError:x,isInitialLoading:F,isLoading:F,data:d,dataUpdatedAt:h.dataUpdatedAt,error:p,errorUpdatedAt:T,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:R,isRefetching:R&&!v,isLoadingError:x&&!f,isPaused:h.fetchStatus==="paused",isPlaceholderData:k,isRefetchError:x&&f,isStale:Em(t,r),refetch:this.refetch,promise:y(this,as),isEnabled:Pn(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let C=b.data!==void 0,O=b.status==="error"&&!C,V=W=>{O?W.reject(b.error):C&&W.resolve(b.data);},P=()=>{let W=Y(this,as,b.promise=vm());V(W);},B=y(this,as);switch(B.status){case "pending":t.queryHash===o.queryHash&&V(B);break;case "fulfilled":(O||b.data!==B.value)&&P();break;case "rejected":(!O||b.error!==B.reason)&&P();break}}return b}updateResult(){let t=y(this,tn),r=this.createResult(y(this,Zt),this.options);if(Y(this,Ea,y(this,Zt).state),Y(this,Zl,this.options),y(this,Ea).data!==void 0&&Y(this,ec,y(this,Zt)),fp(r,t))return;Y(this,tn,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!y(this,tc).size)return true;let s=new Set(i??y(this,tc));return this.options.throwOnError&&s.add("error"),Object.keys(y(this,tn)).some(a=>{let l=a;return y(this,tn)[l]!==t[l]&&s.has(l)})};Mt(this,wr,jb).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Mt(this,wr,Dm).call(this);}},hn=new WeakMap,Zt=new WeakMap,md=new WeakMap,tn=new WeakMap,Ea=new WeakMap,Zl=new WeakMap,as=new WeakMap,Xs=new WeakMap,hd=new WeakMap,Xl=new WeakMap,ec=new WeakMap,Wa=new WeakMap,Ma=new WeakMap,ea=new WeakMap,tc=new WeakMap,wr=new WeakSet,fd=function(t){Mt(this,wr,Am).call(this);let r=y(this,Zt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Ql)),r},Im=function(){Mt(this,wr,Om).call(this);let t=Kl(this.options.staleTime,y(this,Zt));if(Gl.isServer()||y(this,tn).isStale||!_m(t))return;let o=Bb(y(this,tn).dataUpdatedAt,t)+1;Y(this,Wa,ud.setTimeout(()=>{y(this,tn).isStale||this.updateResult();},o));},Pm=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,Zt)):this.options.refetchInterval)??false},Fm=function(t){Mt(this,wr,Vm).call(this),Y(this,ea,t),!(Gl.isServer()||Pn(this.options.enabled,y(this,Zt))===false||!_m(y(this,ea))||y(this,ea)===0)&&Y(this,Ma,ud.setInterval(()=>{(this.options.refetchIntervalInBackground||Fb.isFocused())&&Mt(this,wr,fd).call(this);},y(this,ea)));},Dm=function(){Mt(this,wr,Im).call(this),Mt(this,wr,Fm).call(this,Mt(this,wr,Pm).call(this));},Om=function(){y(this,Wa)!==void 0&&(ud.clearTimeout(y(this,Wa)),Y(this,Wa,void 0));},Vm=function(){y(this,Ma)!==void 0&&(ud.clearInterval(y(this,Ma)),Y(this,Ma,void 0));},Am=function(){let t=y(this,hn).getQueryCache().build(y(this,hn),this.options);if(t===y(this,Zt))return;let r=y(this,Zt);Y(this,Zt,t),Y(this,md,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},jb=function(t){pd.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(y(this,tn));}),y(this,hn).getQueryCache().notify({query:y(this,Zt),type:"observerResultsUpdated"});});},$b);function v1(e,t){return Pn(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Pn(t.retryOnMount,e)===false)}function Nb(e,t){return v1(e,t)||e.state.data!==void 0&&Lm(e,t,t.refetchOnMount)}function Lm(e,t,r){if(Pn(t.enabled,e)!==false&&Kl(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Em(e,t)}return false}function Hb(e,t,r,o){return (e!==t||Pn(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Em(e,r)}function Em(e,t){return Pn(t.enabled,e)!==false&&e.isStaleByTime(Kl(t.staleTime,e))}function I1(e,t){return !fp(e.getCurrentResult(),t)}var P1=ta__namespace.createContext(void 0),qb=e=>{let t=ta__namespace.useContext(P1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var Qb=ta__namespace.createContext(false),Kb=()=>ta__namespace.useContext(Qb);Qb.Provider;function F1(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var D1=ta__namespace.createContext(F1()),Gb=()=>ta__namespace.useContext(D1);var Jb=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?mp(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Zb=e=>{ta__namespace.useEffect(()=>{e.clearReset();},[e]);},Xb=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||mp(r,[e.error,o]));var ew=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));}},tw=(e,t)=>e.isLoading&&e.isFetching&&!t,rw=(e,t)=>e?.suspense&&t.isPending,Wm=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function ow(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=Kb(),n=Gb(),i=qb(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;s._optimisticResults=o?"isRestoring":l?"optimistic":void 0,ew(s),Jb(s,n,a),Zb(n);let c=!i.getQueryCache().get(s.queryHash),[u]=ta__namespace.useState(()=>new t(i,s)),h=u.getOptimisticResult(s),k=!o&&l;if(ta__namespace.useSyncExternalStore(ta__namespace.useCallback(d=>{let p=k?u.subscribe(pd.batchCalls(d)):Ql;return u.updateResult(),p},[u,k]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),ta__namespace.useEffect(()=>{u.setOptions(s);},[s,u]),rw(s,h))throw Wm(s,u,n);if(Xb({result:h,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw h.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,h),s.experimental_prefetchInRender&&!Gl.isServer()&&tw(h,o)&&(c?Wm(s,u,n):a?.promise)?.catch(Ql).finally(()=>{u.updateResult();}),s.notifyOnChangeProps?h:u.trackResult(h)}function ls(e,t){return ow(e,Bm)}function gp(e,t=true){return ls({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ed(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Mm(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return ls({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await Wi(i),c=null,u=null,h=null,k=null,d,p,T,m=l.data.some(w=>w.chains.some(R=>{let v=R.chain_type===t&&R.chain_id===r&&R.token_address.toLowerCase()===o.toLowerCase();return v&&(c=R.minimum_deposit_amount_usd,u=R.estimated_processing_time,h=R.max_slippage_percent,k=R.estimated_price_impact_percent,T=R.chain_name,p=w),v}));if(p){let w=it(p,"png");w&&(d=ge(w));}return {isSupported:m,minimumAmountUsd:c,estimatedProcessingTime:u,maxSlippagePercent:h,priceImpactPercent:k,errorMessage:m?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:T}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function zm(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return ls({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await Wd(t,r,o,n,i);if(l.balance){let c=l.balance.token?.decimals??6,u=l.balance.token?.symbol??"",h=l.balance.amount,k=BigInt(h),d=BigInt(10**c),p=k/d,m=(k%d).toString().padStart(c,"0").replace(/0+$/,""),w=m?`${p}.${m}`:p.toString();return {balanceBaseUnit:h,balanceHuman:w,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:u}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var O1=2500,V1=3e3,A1=6e4;function Um({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=ta.useState([]),[l,c]=ta.useState(false),u=ta.useRef(new Date),h=ta.useRef(new Map),k=ta.useRef(false),d=ta.useRef(n),p=ta.useRef(i);return ta.useEffect(()=>{d.current=n;},[n]),ta.useEffect(()=>{p.current=i;},[i]),ta.useEffect(()=>{o&&!k.current&&(u.current=new Date,h.current.clear()),o||h.current.clear(),k.current=o;},[o]),ta.useEffect(()=>{if(!e||!o)return;let T=u.current,m=async()=>{try{let R=await sn(e,t,"withdraw"),v=new Date(T.getTime()-A1),x=[...R.data].sort((b,C)=>{let O=b.created_at?new Date(b.created_at).getTime():0;return (C.created_at?new Date(C.created_at).getTime():0)-O}),F=["pending","waiting","delayed"],f=["succeeded","failed"],g=null;for(let b of x){let C=b.created_at?new Date(b.created_at):null;if(!C||C<v)continue;let O=h.current.get(b.id);if(!O){g=b;break}if(F.includes(O)&&f.includes(b.status)){g=b;break}}if(g){let b=g,C=b.created_at?new Date(b.created_at):null;if(!C||C<u.current)return;let O=h.current.get(b.id);h.current.set(b.id,b.status),a(V=>{let P=V.findIndex(B=>B.id===b.id);if(P>=0){let B=[...V];return B[P]=b,B}return [...V,b]}),b.status==="succeeded"&&(!O||F.includes(O))?d.current?.({message:"Withdrawal completed successfully",transaction:b}):b.status==="failed"&&O!=="failed"&&p.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:b});}}catch(R){console.error("Failed to fetch withdraw executions:",R),p.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:R});}};m();let w=setInterval(m,O1);return c(true),()=>{clearInterval(w),c(false);}},[e,t,o]),ta.useEffect(()=>{if(!o||!r)return;let T=async()=>{try{await Sc({deposit_wallet_id:r},t);}catch{}};T();let m=setInterval(T,V1);return ()=>clearInterval(m)},[o,r,t]),{executions:s,isPolling:l}}var Nm=(e,t)=>`${t}:${e}`;function Cd({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:u,chainPickerBorderTopRightRadius:h}){let{colors:k,fonts:d,components:p}=z(),[T,m]=ta.useState(false),[w,R]=ta.useState(false),v=p.card,x=t?e.find(b=>b.symbol===t):void 0,F=x?.chains||[],f=r?F.find(b=>Nm(b.chain_id,b.chain_type)===r):void 0,g={backgroundColor:v.backgroundColor,borderRadius:v.borderRadius,borderWidth:v.borderWidth||1,borderColor:v.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:ir.row,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.label,{color:v.labelColor,fontFamily:d.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.selectButton,g],onPress:()=>!i&&e.length>0&&m(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[ir.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):x?jsxRuntime.jsxs(reactNative.View,{style:ir.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(x,"png"))},style:ir.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.selectedText,{color:v.titleColor,fontFamily:d.medium}],numberOfLines:1,children:x.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[ir.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsxRuntime.jsx(Vr,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ir.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.label,{color:v.labelColor,fontFamily:d.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.selectButton,g,(!x||F.length===0)&&ir.disabled],onPress:()=>!i&&x&&F.length>0&&R(true),activeOpacity:.7,disabled:i||!x||F.length===0,children:[f?jsxRuntime.jsxs(reactNative.View,{style:ir.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(f,"png"))},style:ir.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.selectedText,{color:v.titleColor,fontFamily:d.medium}],numberOfLines:1,children:f.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[ir.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsxRuntime.jsx(Vr,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(rr,{visible:T,onClose:()=>m(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:ir.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerTitle,{color:k.foreground,fontFamily:d.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ir.pickerHeaderClose,onPress:()=>m(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Za,{data:e,keyExtractor:b=>b.symbol,contentContainerStyle:ir.listContent,showsVerticalScrollIndicator:false,renderItem:({item:b})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.pickerItem,{backgroundColor:b.symbol===t?k.cardHover:"transparent"}],onPress:()=>{o(b.symbol),m(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(b,"png"))},style:ir.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerItemText,{color:k.foreground,fontFamily:d.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerItemSub,{color:k.foregroundMuted,fontFamily:d.regular}],children:b.name}),b.symbol===t&&jsxRuntime.jsx(Pt,{size:18,color:k.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(rr,{visible:w,onClose:()=>R(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:u,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:ir.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerTitle,{color:k.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ir.pickerHeaderClose,onPress:()=>R(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Za,{data:F,keyExtractor:b=>Nm(b.chain_id,b.chain_type),contentContainerStyle:ir.listContent,showsVerticalScrollIndicator:false,renderItem:({item:b})=>{let C=Nm(b.chain_id,b.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ir.pickerItem,{backgroundColor:C===r?k.cardHover:"transparent"}],onPress:()=>{n(C),R(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(it(b,"png"))},style:ir.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ir.pickerItemText,{color:k.foreground,fontFamily:d.medium}],children:b.chain_name}),C===r&&jsxRuntime.jsx(Pt,{size:18,color:k.primary,strokeWidth:2.5})]})}})]})]})}var ir=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 Hm(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:i,enabled:s=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return ls({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>Qp({chain_type:t,chain_id:r,token_address:o,recipient_address:a},i),enabled:s&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function W1(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function M1(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),i=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(i)).toString()}function z1(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function bp({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:u,isLoadingBalance:h,minimumWithdrawAmountUsd:k,estimatedProcessingTime:d,maxSlippagePercent:p,priceImpactPercent:T,canWithdraw:m,onDepositWalletCreation:w,onWithdraw:R,onWithdrawError:v,onWithdrawSubmitted:x,onViewTracker:F}){let f="https://unifold.io/terms",g="https://unifold.io/support",{colors:b,fonts:C,components:O}=z(),[V,P]=ta.useState(a||""),[B,W]=ta.useState(""),[j,Z]=ta.useState(false),[Oe,G]=ta.useState(null),[ot,te]=ta.useState(false),[de,ae]=ta.useState(""),re=ta.useRef(null);ta.useEffect(()=>{P(a||""),W(""),G(null);},[a]);let xe=V.trim();ta.useEffect(()=>{let me=setTimeout(()=>ae(xe),500);return ()=>clearTimeout(me)},[xe]);let{data:$,isLoading:Re,error:dt}=Hm({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:de,publishableKey:e,enabled:de.length>5&&!!c}),Xe=xe!==de,Se=ta.useMemo(()=>!xe||xe.length<=5||Xe||Re?null:dt?"Invalid address":$&&!$.valid?$.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:$.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[xe,Xe,Re,dt,$,c,l]),Ke=!Xe&&!!$?.valid&&!Se,nt=ta.useMemo(()=>u?.exchangeRate?parseFloat(u.exchangeRate):0,[u]),Ge=ta.useMemo(()=>u?.balanceHuman?parseFloat(u.balanceHuman):0,[u]),pt=n||u?.symbol||"TOKEN",st=u?.decimals??6,Ne=ta.useMemo(()=>{let me=parseFloat(B);return !me||me<=0?0:me},[B]),ye=ta.useMemo(()=>{let me=parseFloat(B);return !me||me<=0?0:me*nt},[B,nt]),be=ta.useCallback(async()=>{try{let je=await Qw("expo-clipboard").getStringAsync();je&&(P(je.trim()),G(null));}catch{}},[]),He=ta.useCallback(()=>{Ge<=0||W(u?.balanceHuman??"0");},[Ge,u]),ft=k!==null&&ye>0&&ye<k,yt=Ne>0&&Ge>0&&Ne>Ge,xt=xe.length>0&&B.trim().length>0&&Ne>0&&Ke&&!ft&&!yt&&!!u,lr=ta.useCallback(async()=>{if(!(!l||!c||!xt||!m)){Z(true),G(null);try{let me=await w({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:xe}),je=M1(Ne,st),vt=z1(Ne,st),Bt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:pt,sourceTokenIconUrl:s,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ge(it(l,"png")):void 0,amount:vt,amountBaseUnit:je,submittedAt:new Date,withdrawIntentAddress:me.address,recipientAddress:xe};await R(Bt),x(Bt);}catch(me){let je=me instanceof Error?me.message:"Withdrawal failed. Please try again.",vt=je.length>120?"Withdrawal failed. Please try again.":je;G(vt),v?.({message:je,error:me,code:"WITHDRAW_FAILED"});}finally{Z(false);}}},[l,c,xt,m,xe,t,r,o,pt,s,B,Ge,u,Ne,st,ye,w,R,v,x]),$e=O.input,fe=O.card,Ye=O.button,Je=Se?b.error:$e.borderColor,Ee=ta.useMemo(()=>j?"Processing...":yt?"Insufficient balance":ft?`Minimum $${k?.toFixed(2)}`:Oe?"Withdrawal failed \u2014 try again":"Withdraw",[j,yt,ft,k,Oe]);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:fe.labelColor,fontFamily:C.medium}],children:"Recipient address"}),(Xe||Re)&&xe.length>5?jsxRuntime.jsx(Te,{size:20,strokeWidth:2}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:be,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(ph,{size:16,color:b.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Xt.inputRow,{backgroundColor:$e.backgroundColor,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:Je}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Xt.textInput,{color:$e.textColor,fontFamily:C.regular}],placeholder:"Enter wallet address",placeholderTextColor:$e.placeholderColor,value:V,onChangeText:me=>{P(me),G(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>re.current?.focus()})}),Se?jsxRuntime.jsx(reactNative.Text,{style:[Xt.errorText,{color:b.error,fontFamily:C.regular}],children:Se}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Xt.label,{color:fe.labelColor,fontFamily:C.medium,paddingBottom:8}],children:["Amount",k!=null&&k>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:b.warning,fontFamily:C.regular},children:` ($${k.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xt.amountRow,{backgroundColor:$e.backgroundColor,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:$e.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:re,style:[Xt.amountInput,{color:$e.textColor,fontFamily:C.regular}],placeholder:"0.00",placeholderTextColor:$e.placeholderColor,value:B,onChangeText:me=>{(me===""||/^\d*\.?\d*$/.test(me))&&(W(me),G(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.unitLabel,{color:b.foregroundMuted,fontFamily:C.medium}],children:pt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xt.maxButton,{backgroundColor:`${b.primary}20`}],onPress:He,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xt.maxText,{color:b.primary,fontFamily:C.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xt.detailsCard,{marginTop:24,backgroundColor:fe.backgroundColor,borderRadius:fe.borderRadius,borderWidth:fe.borderWidth||1,borderColor:fe.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Xt.detailsToggle,onPress:()=>te(!ot),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xt.detailIcon,{backgroundColor:fe.iconBackgroundColor,borderRadius:fe.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:12,color:fe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xt.detailsLabel,{color:fe.titleColor,fontFamily:C.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:C.medium},children:W1(d)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ot?"180deg":"0deg"}]},children:jsxRuntime.jsx(Vr,{size:16,color:fe.actionColor,strokeWidth:2})})]})}),ot&&jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xt.detailIcon,{backgroundColor:fe.iconBackgroundColor,borderRadius:fe.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:fe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xt.detailsLabel,{color:fe.titleColor,fontFamily:C.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:C.medium},children:["Auto \u2022 ",(p??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Xt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xt.detailIcon,{backgroundColor:fe.iconBackgroundColor,borderRadius:fe.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gn,{size:12,color:fe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xt.detailsLabel,{color:fe.titleColor,fontFamily:C.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:C.medium},children:[(T??0).toFixed(2),"%"]})]})]})]})]}),Oe&&jsxRuntime.jsx(reactNative.Text,{style:[Xt.errorText,{color:b.error,fontFamily:C.regular,textAlign:"center"}],children:Oe}),jsxRuntime.jsxs(reactNative.View,{style:Xt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xt.withdrawButton,{backgroundColor:Ye.primaryBackground,borderRadius:Ye.borderRadius,borderWidth:Ye.borderWidth,borderColor:Ye.borderColor,opacity:!xt||!m||j?.5:1}],onPress:lr,disabled:!xt||!m||j,activeOpacity:.8,children:[j&&jsxRuntime.jsx(Te,{size:18,strokeWidth:2,gradientFrom:Ye.primaryText,gradientTo:Ye.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.withdrawButtonText,{color:Ye.primaryText,fontFamily:C.medium}],children:Ee})]}),jsxRuntime.jsxs(reactNative.View,{style:Xt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xt.historyLink,onPress:F,activeOpacity:.7,children:[jsxRuntime.jsx(jo,{size:14,color:b.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.historyText,{color:b.foregroundMuted,fontFamily:C.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Xt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(f),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xt.legalText,{color:b.foregroundMuted,fontFamily:C.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Xt.legalSeparator,{color:b.foregroundMuted,fontFamily:C.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(g),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xt.legalText,{color:b.foregroundMuted,fontFamily:C.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 H1(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 $1(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Sp({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=z(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,c=ge(it(e.destination_token_metadata,"png")||kr("/icons/tokens/png/usdc.png")),u=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",h=H1(e.created_at||new Date().toISOString()),k=$1(e.source_amount_usd);return jsxRuntime.jsxs(Qr,{cardTokens:i,onPress:t,contentStyle:ds.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ds.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:ds.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ds.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(gs,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ds.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ds.title,{color:i.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[ds.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:ds.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ds.amount,{color:i.textRightColor,fontFamily:o.medium}],children:k}),jsxRuntime.jsx(co,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var ds=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 qm(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),i=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),l=s>=12?"PM":"AM";s=s%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${c} ${l}`}catch{return e}}function fw(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 q1(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 mw(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function hw(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Sd({label:e,value:t,isLast:r}){let{fonts:o,components:n}=z(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Ut.divider,{backgroundColor:i.borderColor}]})]})}function Km({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=z(),[c,u]=ta.useState([]),[h,k]=ta.useState(!!n),d=l.card,p=l.button,T=l.header,m=l.container;ta.useEffect(()=>{qp().then(Z=>u(Z.data)).catch(()=>{});},[]),ta.useEffect(()=>{k(!!n);},[e?.id]);let w=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,R=e?e.status==="failed"||e.status==="refunded":false,v=R?s.error:w?s.warning:s.success,x=R?"Failed":w?"Processing":"Completed",F=e?.destination_token_metadata?ge(it(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ge(t.destinationTokenIconUrl):ge(kr("/icons/tokens/png/usdc.png")),f=e?.created_at?qm(e.created_at):t.submittedAt?qm(t.submittedAt.toISOString()):qm(new Date().toISOString()),g=e?`${fw(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${mw(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,b=e?`${fw(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${mw(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,C=e?q1(e.source_amount_usd,e.source_amount_base_unit):"$0.00",O=e?Bd(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,V=e?Bd(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,P=e?.transaction_hash,B=e?.explorer_url,W=e?.destination_transaction_hashes?.[0],j=e?.destination_explorer_url;return jsxRuntime.jsxs(Yt,{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(Ka,{size:22,color:T.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ut.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.headerTitle,{color:T.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Ut.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($t,{size:20,color:T.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:F},style:Ut.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ut.statusBadge,{backgroundColor:v}],children:R?jsxRuntime.jsx(gs,{size:10,color:"#FFFFFF",strokeWidth:3}):w?jsxRuntime.jsx(reactNative.View,{style:Ut.spinnerDot}):jsxRuntime.jsx(Pt,{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:x})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.dateText,{color:m.subtitleColor,fontFamily:a.regular}],children:f}),jsxRuntime.jsxs(reactNative.View,{style:[Ut.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsxRuntime.jsx(Sd,{label:"Amount Sent",value:g}),jsxRuntime.jsx(Sd,{label:"Amount Received",value:b}),jsxRuntime.jsx(Sd,{label:"USD Value",value:C}),jsxRuntime.jsx(Sd,{label:"Source Network",value:O}),jsxRuntime.jsx(Sd,{label:"Destination Network",value:V,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ut.moreDetailsRow,onPress:()=>k(Z=>!Z),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.moreDetailsText,{color:m.actionTitle,fontFamily:a.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(ci,{size:16,color:m.actionColor,strokeWidth:2}):jsxRuntime.jsx(Vr,{size:16,color:m.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[Ut.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:P&&B?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ut.txRow,onPress:()=>reactNative.Linking.openURL(B),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.txHash,{color:d.titleColor,fontFamily:a.regular}],children:hw(P)}),jsxRuntime.jsx(Bn,{size:14,color:d.actionColor,strokeWidth:2})]}),!w&&W&&j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Ut.divider,{backgroundColor:d.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ut.txRow,onPress:()=>reactNative.Linking.openURL(j),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ut.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ut.txHash,{color:d.titleColor,fontFamily:a.regular}],children:hw(W)}),jsxRuntime.jsx(Bn,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Ut.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Ut.detailLabel,{color:d.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:p.secondaryBackground,borderRadius:p.borderRadius,borderWidth:p.borderWidth,borderColor:p.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ut.buttonText,{color:p.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ut.button,Ut.halfButton,{backgroundColor:p.primaryBackground,borderRadius:p.borderRadius,borderWidth:p.borderWidth,borderColor:p.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ut.buttonText,{color:p.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 gw(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Tp({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=z(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",u={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Mr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mr.closeButton,onPress:r,children:jsxRuntime.jsx($t,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Mr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(Pt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mr.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",gw(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Mr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Mr.button,Mr.halfButton,u,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Mr.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Mr.button,Mr.halfButton,u,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Mr.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:Mr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mr.closeButton,onPress:r,children:jsxRuntime.jsx($t,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Mr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx($t,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Mr.button,Mr.fullButton,u,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Mr.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Mr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mr.closeButton,onPress:r,children:jsxRuntime.jsx($t,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(Te,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ge(e.sourceTokenIconUrl)},style:Mr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Mr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mr.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.sourceTokenSymbol," to"," ",gw(e.recipientAddress)]})]})}var Mr=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 Z1(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:ge(it(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:ge(it(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 yw=(e,t)=>`${t}:${e}`;function X1(){let{colors:e}=z(),t=ta.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ta.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 _p({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,defaultDestinationChainType:s,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:u,onWithdrawSuccess:h,onWithdrawError:k,heightPercent:d=.94,sheetBorderRadius:p,sourceChainType:T,sourceChainId:m,sourceTokenAddress:w,sourceTokenSymbol:R,sourceChainName:v,sourceTokenIconUrl:x}){let{colors:F,fonts:f}=z(),[g,b]=ta.useState("form"),[C,O]=ta.useState(T),[V,P]=ta.useState(m),[B,W]=ta.useState(w),[j,Z]=ta.useState(R),[Oe,G]=ta.useState(v),[ot,te]=ta.useState(x),[de,ae]=ta.useState(null),[re,xe]=ta.useState(null),[$,Re]=ta.useState(null),[dt,Xe]=ta.useState(),[Se,Ke]=ta.useState([]),[nt,Ge]=ta.useState(null),[pt,st]=ta.useState("form"),Ne=ta.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,ye=ta.useRef(null),be=!!C&&!!V&&!!B,{data:He,isLoading:ft}=gp(r,e&&g==="form"),yt=He?.data??[],{data:xt,isLoading:lr}=Mm({sourceChainType:C,sourceChainId:V,sourceTokenAddress:B,sourceTokenSymbol:j,publishableKey:r,enabled:e&&be&&g==="form"}),$e=yc.includes(C)?C:void 0,{data:fe,isLoading:Ye}=zm({address:n,chainType:$e,chainId:V,tokenAddress:B,publishableKey:r,enabled:e&&be}),{executions:Je}=Um({userId:o,publishableKey:r,depositWalletId:dt,enabled:!!dt&&e,onWithdrawSuccess:h,onWithdrawError:k});ta.useEffect(()=>{if(!e||g!=="tracker")return;let J=false;return sn(o,r,"withdraw").then(K=>{J||Ke(K.data);}).catch(console.error),()=>{J=true;}},[e,g,o,r]),ta.useEffect(()=>{e&&(ye.current&&(clearTimeout(ye.current),ye.current=null),b("form"),O(T),P(m),W(w),Z(R),G(v),te(x),ae(null),xe(null),Re(null),Xe(void 0),Ke([]),Ge(null),st("form"),Ne.setValue(reactNative.Dimensions.get("window").width));},[e]),ta.useEffect(()=>()=>{ye.current&&clearTimeout(ye.current);},[]),ta.useEffect(()=>{ot||xt?.iconUrl&&te(xt.iconUrl);},[xt?.iconUrl,ot]),ta.useEffect(()=>{Oe||xt?.chainName&&G(xt.chainName);},[xt?.chainName,Oe]),ta.useEffect(()=>{if(!yt.length||de)return;let J,K;if(s&&a)if(l)for(let ve of yt){let Ve=ve.chains.find(L=>L.chain_type===s&&L.chain_id===a&&L.token_address.toLowerCase()===l.toLowerCase());if(Ve){J=ve,K=Ve;break}}else for(let ve of yt){let Ve=ve.chains.find(L=>L.chain_type===s&&L.chain_id===a);if(Ve){J=ve,K=Ve;break}}J||(J=yt[0]),J&&(ae(J),xe(K??J.chains[0]??null));},[yt,de,s,a,l]),ta.useEffect(()=>{g==="confirming"&&Je.length>0&&b("details");},[g,Je]);let Ee=ta.useCallback(()=>{t(),ye.current=setTimeout(()=>{b("form"),O(T),P(m),W(w),Z(R),G(v),te(x),ae(null),xe(null),Re(null),Xe(void 0),Ke([]),Ge(null),st("form"),ye.current=null;},300);},[t,T,m,w,R,v,x]),me=ta.useCallback(J=>{let K=yt.find(ve=>ve.symbol===J);K&&(ae(K),K.chains.length>0&&xe(K.chains[0]));},[yt]),je=ta.useCallback(J=>{if(!de)return;let K=de.chains.find(ve=>yw(ve.chain_id,ve.chain_type)===J);K&&xe(K);},[de]),vt=ta.useCallback(async J=>{let K=await Zo({external_user_id:o,destination_chain_type:J.destinationChainType,destination_chain_id:J.destinationChainId,destination_token_address:J.destinationTokenAddress,recipient_address:J.recipientAddress,action_type:"withdraw"},r);if(!C)throw new Error("sourceChainType is required for withdrawal");let ve=nn(K.data,C);if(!ve)throw new Error(`No deposit wallet found for chain type: ${C}`);return Xe(ve.id),{id:ve.id,address:ve.address}},[o,r,C]),Bt=ta.useCallback(J=>{Re(J),b("confirming");},[]),Nt=ta.useCallback(J=>{Ge(J),Ne.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ne,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ne]),ct=ta.useCallback(()=>{reactNative.Animated.timing(Ne,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ge(null));},[Ne]),er=ft||lr,tt=xt?.isSupported??null,Ct=g==="confirming"?"Withdrawal Status":c,bt=p?.globalBorderTopLeftRadius,Ae=p?.globalBorderTopRightRadius,at=p?.main?.borderTopLeftRadius??bt,X=p?.main?.borderTopRightRadius??Ae,Fe=p?.tokenSelector?.borderTopLeftRadius??bt,_=p?.tokenSelector?.borderTopRightRadius??Ae,S=p?.chainSelector?.borderTopLeftRadius??bt,M=p?.chainSelector?.borderTopRightRadius??Ae,q=(()=>{if(g!=="form"||!be||Ye||!fe)return;let J=j||fe.symbol,K=fe.balanceUsd;if(K!=null){let L=`$${parseFloat(K).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return J?`Balance: ${L} ${J}`:`Balance: ${L}`}let ve=fe.balanceHuman;if(!(!ve||ve==="0"))return J?`Balance: ${ve} ${J}`:`Balance: ${ve}`})();return jsxRuntime.jsx(rr,{visible:e,onClose:Ee,closeOnBackdropPress:false,enablePanDownToClose:g==="tracker"||g==="form",showHandle:g==="tracker"||g==="form",heightPercent:g==="confirming"?.3:g==="details"?.7:g==="tracker"?.9:d,borderTopLeftRadius:at,borderTopRightRadius:X,children:g==="confirming"&&$?jsxRuntime.jsx(Tp,{txInfo:$,executions:Je,onClose:Ee,onViewTracker:()=>{st("confirming"),b("tracker");}}):g==="details"&&$?jsxRuntime.jsx(Km,{execution:Je.length>0?Je[Je.length-1]:null,txInfo:$,onClose:Ee,onViewHistory:()=>{st("details"),b("tracker");},onHeaderClose:()=>b("form")}):g==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Vi.trackerContainer,children:[jsxRuntime.jsx(fo,{title:"Withdrawal History",onClose:()=>b(pt)}),Se.length===0?jsxRuntime.jsx(reactNative.View,{style:Vi.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Vi.emptyText,{color:F.foregroundMuted,fontFamily:f.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Za,{data:Se,keyExtractor:J=>J.id,contentContainerStyle:Vi.listContent,showsVerticalScrollIndicator:false,renderItem:({item:J})=>jsxRuntime.jsx(Sp,{execution:J,onPress:()=>Nt(J)})}),nt&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Vi.historyDetailOverlay,{backgroundColor:F.background,transform:[{translateX:Ne}]}],children:jsxRuntime.jsx(Km,{execution:nt,txInfo:Z1(nt),onClose:Ee,onBack:ct,onViewHistory:ct})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{title:Ct,subtitle:q,onClose:Ee}),er?jsxRuntime.jsx(X1,{}):tt===false?jsxRuntime.jsxs(reactNative.View,{style:Vi.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vi.unsupportedTitle,{color:F.foreground,fontFamily:f.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Vi.unsupportedMessage,{color:F.foregroundMuted,fontFamily:f.regular}],children:xt?.errorMessage})]}):jsxRuntime.jsx(e0,{publishableKey:r,sourceChainType:C??"",sourceChainId:V??"",sourceTokenAddress:B??"",sourceTokenSymbol:j,sourceChainName:Oe,sourceTokenIconUrl:ot,recipientAddressProp:i,destinationTokens:yt,selectedToken:de,selectedChain:re,selectedChainKey:re?yw(re.chain_id,re.chain_type):null,onTokenChange:me,onChainChange:je,tokensLoading:ft,balanceData:fe??null,isLoadingBalance:Ye,sourceValidation:xt??null,onDepositWalletCreation:vt,onWithdraw:u,onWithdrawError:k,onWithdrawSubmitted:Bt,onViewTracker:()=>{st("form"),b("tracker");},tokenSelectorLeft:Fe,tokenSelectorRight:_,chainSelectorLeft:S,chainSelectorRight:M})]})})}function e0({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:u,selectedChainKey:h,onTokenChange:k,onChainChange:d,tokensLoading:p,balanceData:T,isLoadingBalance:m,sourceValidation:w,onDepositWalletCreation:R,onWithdraw:v,onWithdrawError:x,onWithdrawSubmitted:F,onViewTracker:f,tokenSelectorLeft:g,tokenSelectorRight:b,chainSelectorLeft:C,chainSelectorRight:O}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Yt,{style:{flex:1,paddingTop:16},contentContainerStyle:Vi.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Vi.doubleInputWrapper,children:jsxRuntime.jsx(Cd,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:h,onTokenChange:k,onChainChange:d,isLoading:p,tokenPickerBorderTopLeftRadius:g,tokenPickerBorderTopRightRadius:b,chainPickerBorderTopLeftRadius:C,chainPickerBorderTopRightRadius:O})}),jsxRuntime.jsx(bp,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:c,selectedChain:u,balanceData:T,isLoadingBalance:m,minimumWithdrawAmountUsd:w?.minimumAmountUsd??null,estimatedProcessingTime:w?.estimatedProcessingTime??null,maxSlippagePercent:w?.maxSlippagePercent??null,priceImpactPercent:w?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:R,onWithdraw:v,onWithdrawError:x,onWithdrawSubmitted:F,onViewTracker:f})]})})}var Vi=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 Cw=ta.createContext(null);function u0({children:e,publishableKey:t,config:r}){let[o]=ta.useState(()=>new Bf({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=ta.useState(false),[s,a]=ta.useState(null),[l,c]=ta.useState(false),[u,h]=ta.useState(null),k=reactNative.useColorScheme(),d=ta.useRef(false);d.current||(Od({publishableKey:t}),d.current=true);let p=ta.useMemo(()=>{let W=r?.appearance||"dark";return W==="auto"?k==="dark"?"dark":"light":W},[r?.appearance,k]);ta.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.'),Od({publishableKey:t});},[t]),ta.useEffect(()=>()=>{m.current&&clearTimeout(m.current),g.current&&clearTimeout(g.current);},[]);let T=ta.useRef(null),m=ta.useRef(null),w=ta.useRef(void 0),R=ta.useCallback(W=>{m.current&&(clearTimeout(m.current),m.current=null),T.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),T.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),T.current=null);let j=new Promise((Z,Oe)=>{T.current={resolve:Z,reject:Oe};});return w.current=W.onDismiss,a(W),i(true),j},[]),v=ta.useCallback(()=>{let W=T.current!==null;T.current&&(T.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),T.current=null);let j=w.current;w.current=void 0,i(false),m.current=setTimeout(()=>{a(null),m.current=null;},200),W&&j?.();},[]),x=ta.useCallback(W=>{s?.onSuccess&&s.onSuccess(W),T.current&&(T.current.resolve(W),T.current=null);},[s]),F=ta.useCallback(W=>{console.error("[UnifoldProvider] Deposit error:",W),s?.onError&&s.onError(W),T.current&&(T.current.reject(W),T.current=null);},[s]),f=ta.useRef(null),g=ta.useRef(null),b=ta.useRef(void 0),C=ta.useCallback(W=>{g.current&&(clearTimeout(g.current),g.current=null),f.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),f.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),f.current=null);let j=new Promise((Z,Oe)=>{f.current={resolve:Z,reject:Oe};});return b.current=W.onClose,h(W),c(true),j},[]),O=ta.useCallback(()=>{f.current&&(f.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),f.current=null),b.current?.(),b.current=void 0,c(false),g.current=setTimeout(()=>{h(null),g.current=null;},200);},[]),V=ta.useCallback(W=>{u?.onSuccess&&u.onSuccess(W),f.current&&(f.current.resolve(W),f.current=null);},[u]),P=ta.useCallback(W=>{console.error("[UnifoldProvider] Withdraw error:",W),u?.onError&&u.onError(W),f.current&&(f.current.reject(W),f.current=null);},[u]),B=ta.useMemo(()=>({publishableKey:t,beginDeposit:R,closeDeposit:v,beginWithdraw:C,closeWithdraw:O}),[t,R,v,C,O]);return jsxRuntime.jsx(Ef,{client:o,children:jsxRuntime.jsx(Cw.Provider,{value:B,children:jsxRuntime.jsxs(Ja,{mode:p,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(up,{visible:n,onClose:v,closeOnBackdropPress:s.closeOnBackdropPress??false,publishableKey:t,modalTitle:r?.modalTitle,transferCryptoTitle:r?.transferCryptoTitle,externalUserId:s.externalUserId,user:s.user,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeTheme:{mode:p,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",initialScreen:s.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLink:r?.enableStripeLink,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableCoinbaseApplePay:r?.enableCoinbaseApplePay,enableFiatOnramp:r?.enableFiatOnramp,stripePaymentSelectorPosition:r?.stripeLink?.paymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeLink?.skipSuccessConfirmation,StripeOnrampComponent:Dg(),onDepositSuccess:x,onDepositError:F,theme:p,sheetBorderRadius:r?.sheetBorderRadius}),u&&jsxRuntime.jsx(_p,{visible:l,onClose:O,publishableKey:t,externalUserId:u.externalUserId,senderAddress:u.senderAddress,recipientAddress:u.recipientAddress,sourceChainType:u.sourceChainType,sourceChainId:u.sourceChainId,sourceTokenAddress:u.sourceTokenAddress,sourceTokenSymbol:u.sourceTokenSymbol,defaultDestinationChainType:u.defaultDestinationChainType,defaultDestinationChainId:u.defaultDestinationChainId,defaultDestinationTokenAddress:u.defaultDestinationTokenAddress,onWithdraw:u.withdraw,onWithdrawSuccess:V,onWithdrawError:P,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function p0(){let e=ta.useContext(Cw);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
125
|
+
exports.AmountScreen=Xd;exports.BottomSheet=rr;exports.KYCWizardScreen=eu;exports.OnrampScreen=du;exports.StripeOnramp=uu;exports.StripeOnrampPreconfigure=Pg;exports.UnifoldProvider=u0;exports.getPreferredIcon=it;exports.getStripeConfig=Rc;exports.getStripePublishableKey=Nh;exports.getSupportedDestinationTokens=Ed;exports.normalizeIconUrl=ge;exports.registerStripeOnramp=pu;exports.setDevApiUrl=kh;exports.setStripeOnrampApiUrl=Kd;exports.setStripeOnrampPublishableKey=Qd;exports.useAllowedCountry=ad;exports.useStripeOnramp=tu;exports.useTheme=z;exports.useUnifold=p0;
|