@unifold/connect-react-native 0.1.43 → 0.1.44-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
'use strict';var Un=require('react'),reactNative=require('react-native'),Et=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),gu=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),qc=require('@react-native-async-storage/async-storage'),dg=require('expo-constants'),$g=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Un__namespace=/*#__PURE__*/_interopNamespace(Un);var Et__default=/*#__PURE__*/_interopDefault(Et);var gu__default=/*#__PURE__*/_interopDefault(gu);var qc__default=/*#__PURE__*/_interopDefault(qc);var dg__default=/*#__PURE__*/_interopDefault(dg);var $g__default=/*#__PURE__*/_interopDefault($g);var du=e=>{throw TypeError(e)};var ff=(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 ic=(e,t,r)=>t.has(e)||du("Cannot "+r);var p=(e,t,r)=>(ic(e,t,"read from private field"),r?r.call(e):t.get(e)),X=(e,t,r)=>t.has(e)?du("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),A=(e,t,r,o)=>(ic(e,t,"write to private field"),t.set(e,r),r),Be=(e,t,r)=>(ic(e,t,"access private method"),r);var Ps=(e,t,r,o)=>({set _(n){A(e,t,n);},get _(){return p(e,t,o)}});var sc={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)"}},ac=sc;function Ia(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Fs(e,t,r){let o=r?t?.[r]:void 0,n=(u,y,S)=>{let g=o?.[u]?.[y];if(g!==void 0)return g;let b=t?.[u]?.[y];return b!==void 0?b:S},a={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,m=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Ia(a,i)},transferCrypto:{depositAddress:{card:Ia(a,s)}},depositCard:{quoteProvider:{card:Ia(a,l)}},depositTracker:{executionRow:{card:Ia(a,m)}}}}function lc(e,t,r){let n={...sc[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var cc=Un.createContext(null);function F(){let e=Un.useContext(cc);if(!e){let t=ac.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Fs(t,void 0,"dark"),isDark:true}}return e}function Ct({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=F(),l=a??s.warning,m=i??"#FBBF24",u=Un.useRef(new reactNative.Animated.Value(0)).current,y=Un.useId(),S=Un.useMemo(()=>`circularProgressGrad_${y.replace(/[^a-zA-Z0-9_-]/g,"")}`,[y]),g=(e-t)/2,b=2*Math.PI*g,w=e/2,h=o??Math.max(0,Math.round(e-t*2-8)),k=(e-h)/2;Un.useEffect(()=>{let d=reactNative.Animated.loop(reactNative.Animated.timing(u,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return d.start(),()=>d.stop()},[u]);let c=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:c}]},children:jsxRuntime.jsxs(Et__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Et.Defs,{children:jsxRuntime.jsxs(Et.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Et.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Et.Stop,{offset:"100%",stopColor:m})]})}),jsxRuntime.jsx(Et.Circle,{cx:w,cy:w,r:g,stroke:`url(#${S})`,strokeWidth:t,fill:"none",strokeDasharray:`${b*.75} ${b*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:k+1.5,left:k,width:h,height:h},children:r}):null]})}function pc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Et.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Dr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Os({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ze({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function xr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Et.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Li({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Et.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Dt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Et.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Qo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.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 ze({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Et.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ds({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function xo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.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(Et.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.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 Pa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.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(Et.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _o({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Et.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Fa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.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 Bi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Sn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.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(Et.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.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(Et.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(Et.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(Et.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Et.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(Et.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(Et.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Et.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ai({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=reactNative.useColorScheme(),l=Un.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),m=Un.useMemo(()=>{let g=o?.[l];return lc(l,g,r)},[l,o,r]),u=Un.useMemo(()=>Fs(m,i,l),[m,i,l]),y=Un.useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),S=Un.useMemo(()=>({mode:l,colors:m,fonts:y,components:u,isDark:l==="dark"}),[l,m,y,u]);return jsxRuntime.jsx(cc.Provider,{value:S,children:e})}var Ws={damping:28,stiffness:300,mass:.8},jf=80,$f=500;function pt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:m=false,borderTopLeftRadius:u=24,borderTopRightRadius:y=24}){let{colors:S}=F(),{height:g}=reactNative.useWindowDimensions(),[b,w]=Un.useState(false),h=Un.useRef(e);h.current=e;let k=Un.useRef(0),c=i!=null&&i>=1,d=c||m?0:reactNative.Platform.OS==="ios"?34:24,f=s!=null&&i!=null&&s>i,R=i!=null?(f?s:i)*g:void 0,_=f?(s-i)*g:0,T=l?0:_,C=gu.useSharedValue(g),x=Un.useRef(null),W=Un.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null),h.current||w(false);},[]);Un.useEffect(()=>{e?(x.current&&(clearTimeout(x.current),x.current=null),w(true),C.value=gu.withSpring(T,Ws)):b&&(C.value=gu.withTiming(g,{duration:250},N=>{N&&gu.runOnJS(W)();}),x.current=setTimeout(()=>{x.current=null,W();},350));},[e]),Un.useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]),Un.useEffect(()=>{b&&e&&(C.value=gu.withSpring(T,Ws));},[T]);let V=Un.useCallback(()=>{o&&t();},[o,t]),O=Un.useMemo(()=>{if(!(!n&&!f))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{k.current=C.value;},onPanResponderMove:(N,ue)=>{if(Math.abs(ue.dy)<4)return;let Le=k.current+ue.dy;C.value=Math.max(0,Le);},onPanResponderRelease:(N,ue)=>{if(!(Math.abs(ue.dy)<4)){if(n&&(ue.dy>jf||ue.vy>$f)){t();return}if(f){let Le=_/2,ve=C.value<Le?0:_;C.value=gu.withSpring(ve,Ws);}else C.value=gu.withSpring(T,Ws);}},onPanResponderTerminate:()=>{C.value=gu.withSpring(T,Ws);}}).panHandlers},[n,f,_,T,C,t]),P=gu.useAnimatedStyle(()=>({transform:[{translateY:C.value}]})),q=gu.useAnimatedStyle(()=>({opacity:gu.interpolate(C.value,[0,g*.5,g],[.5,.25,0],gu.Extrapolation.CLAMP)}));return b?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Xn.root,pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(gu__default.default.View,{style:[Xn.backdrop,q],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:V})}),jsxRuntime.jsxs(gu__default.default.View,{style:[Xn.sheet,P,{height:R,backgroundColor:S.background,borderTopLeftRadius:c?0:u,borderTopRightRadius:c?0:y}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Xn.gestureRoot,children:[a&&jsxRuntime.jsx(reactNative.View,{style:Xn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Xn.handle,{backgroundColor:S.foreground+"33"}]})}),r,d>0&&jsxRuntime.jsx(reactNative.View,{style:{height:d}})]}),O&&jsxRuntime.jsx(reactNative.View,{...O,style:Xn.dragOverlay})]})]})}):null}var Xn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),it=Un__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));it.displayName="BottomSheetScrollView";function Wi(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var qf="https://api.unifold.io",bc="__UnifoldDevApiBaseUrl__",_r="pk_test_123",Da={};function Qf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[bc];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function Xt(){return Qf()??qf}function Va(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.'),_r=e.publishableKey;}e.defaultConfig&&(Da=e.defaultConfig);}function bu(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[bc]=t:delete globalThis[bc];}function Es(){return Xt()}function La(){return _r}function Hr(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 Kt(e){let t=e.startsWith("/")?e:`/${e}`;return `${Xt()}/api/public${t}`}function te(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Xt()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Xt()}${e}`:`${Xt()}/api/public${e}`:""}async function Go(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Da.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||Da.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Da.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||_r;Hr(n);let a=await fetch(`${Xt()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function Yo(e,t){return e.find(r=>r.chain_type===t)}async function Jo(e,t,r){let o=t||_r;Hr(o);let n=await fetch(`${Xt()}/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 Ba(e,t){let r=t||_r;Hr(r);let o=await fetch(`${Xt()}/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 ke(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function ei(e,t){let r=e||_r;Hr(r);let o=`${Xt()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${a.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Cc(e,t){let r=t||_r;Hr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${Xt()}/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 Aa(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function wc(e,t){let r=t||_r;Hr(r);let o=await fetch(`${Xt()}/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 Sc(e,t){let r=t||_r;Hr(r);let o=await fetch(`${Xt()}/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 kc(e,t){let r=t||_r;Hr(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(`${Xt()}/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 Tc(e){let t=e||_r;Hr(t);let r=await fetch(`${Xt()}/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 Ei(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 Ms(e){let t=e||_r;Hr(t);let r=await fetch(`${Xt()}/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 xc(){let e=await fetch(`${Xt()}/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 Wa(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function zs(){let e=await fetch(`${Xt()}/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 Ea(e){let t=e||_r;Hr(t);let r=await fetch(`${Xt()}/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 _c(e,t){let r=t||_r;Hr(r);let o=await fetch(`${Xt()}/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 Rc(e,t){return Ba(e.deposit_wallet_id,t)}async function Ma(e,t,r,o,n){let a=n||_r;Hr(a);let i=await fetch(`${Xt()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}function wu({size:e=28}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Et.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Et.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Et.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 ku({size:e=28}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Et.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Et.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(Et.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Et.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Et.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Et.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Et.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Et.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Et.Defs,{children:jsxRuntime.jsx(Et.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Et.Rect,{width:28,height:28,fill:"white"})})})]})}function _u({size:e=28}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Et.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Et.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(Et.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(Et.Defs,{children:jsxRuntime.jsx(Et.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Et.Rect,{width:28,height:28,fill:"white"})})})]})}function Ru({size:e=28}){return jsxRuntime.jsxs(Et__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Et.Defs,{children:[jsxRuntime.jsxs(Et.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Et.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Et.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Et.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Et.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Et.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Et.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Et.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Et.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Et.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Et.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Et.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(Et.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(Et.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 Iu({size:e=28}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Et.G,{children:[jsxRuntime.jsx(Et.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Et.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 za=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:wu},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:ku},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:_u},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Ru},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Iu}];function Ua(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Ha(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 Ui(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=za.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=za.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Mt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:a}=F(),i=r==="back",s=i?jsxRuntime.jsx(Li,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(Ze,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:s});return t?jsxRuntime.jsxs(reactNative.View,{style:kn.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:kn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[kn.headerTitleText,{color:n.header.titleColor},...a.bold?[{fontFamily:a.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:kn.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?kn.headerWithTitle:kn.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:kn.headerSpacer}),!i&&l]})}var Na={paddingTop:8,paddingBottom:8},kn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Na},headerWithTitle:{flexDirection:"row",alignItems:"center",...Na},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Rr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=F();return e?jsxRuntime.jsx(reactNative.Text,{style:[vu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[vu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var vu=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function ho({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(Un.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 Dc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=Un.useState(false),{colors:s,components:l}=F(),m=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},u=Ua(r);return jsxRuntime.jsxs(Un.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:m,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsxRuntime.jsx(ze,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(Qo,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var ja={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function Hi({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=F(),a=e.toLowerCase(),i=ja[a]??n.primary,s=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function $a({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=F(),m=Kt(`/icons/currencies/png/${e.toLowerCase()}.png`),u=Ui(r);return jsxRuntime.jsxs(reactNative.View,{style:[to.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxRuntime.jsxs(reactNative.View,{style:to.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:m},style:to.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[to.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[to.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(xr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:to.step,children:[jsxRuntime.jsxs(reactNative.View,{style:to.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:to.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[to.tokenIcon,{backgroundColor:ja[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[to.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[to.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[to.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",u]})]})]})}var to=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 Ni(){let{colors:e,fonts:t,components:r}=F(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return Un.useMemo(()=>{let l=i.borderRadius,m={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},u={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},y={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},S=Math.max(16,Math.min(l,22)),g={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:S,borderTopRightRadius:S,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:S,borderBottomRightRadius:S,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},b={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:s.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:m,quote:y,pm:g,wallet:b,flow:w,amount:u}},[e,t,o,n,a,i,s])}var Ou="",Du;function qa(e){Ou=e;}function Qa(e){Du=e;}function Vr(){let e=Ou||La();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Lr(){return Du??Es()}async function Ka(){let e=`${Lr()}/v1/public/onramps/headless/stripe/config`,t=Vr(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function Vc(e){let t=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Vr(),"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 Vu(e,t){let r=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Vr(),"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 Lc(e,t){let r=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Vr(),"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 Lu(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(`${Lr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Vr(),"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 Bu(e,t){let r=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Vr(),"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 Ga(e,t){let r=`${Lr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Vr(),"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 Au(e){let t=`${Lr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":Vr(),"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 Wu(e,t){let r=`${Lr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Vr(),"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 Bc(e,t){let r=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Vr(),"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 Eu(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(`${Lr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Vr(),"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 Ac(e,t){let r=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Vr(),"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 Mu(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(`${Lr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Vr(),"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 Tn(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 zu(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Lr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Vr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function wh({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Et__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Et.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Et.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Et.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(Et.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(Et.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 Sh({size:e=24}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Et.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Et.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Et.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function kh({size:e=24}){return jsxRuntime.jsx(Et__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Et.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Et.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Et.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Et.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(Et.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Et.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(Et.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Et.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(Et.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Et.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(Et.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Et.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(Et.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Et.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 Ec({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Vi,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(wh,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Sh,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(kh,{size:t}):jsxRuntime.jsx(Vi,{size:t*.75,color:r,strokeWidth:1.75})}function Ya(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 zc={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Uc(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 $u({status:e,colors:t,fontFamily:r}){let o=Uc(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:zc[e]??e})})}function qu({count:e=4}){let{colors:t,components:r}=F(),o=Un.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,a=Math.min(r.card.borderRadius??12,14);return Un.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ji.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[ji.row,{backgroundColor:t.card,borderRadius:a,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ji.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.badgeBar,{backgroundColor:n,opacity:o}]})]},s))})}var ji=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 Qu({active:e,interval:t=15e3,color:r}){let o=Un.useRef(new reactNative.Animated.Value(0)).current;return Un.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:a})=>{a&&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 Ku({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=F(),[a,i]=Un.useState(false),s=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,m=e.status!=="fulfillment_complete"&&e.status!=="rejected",u=Uc(e.status,r),y=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",S=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",g=(l?.destination_currency??"").toUpperCase(),b=e.destination_token_metadata,w=Tn(b?.icon_urls,b?.icon_url),h=Ui(l?.destination_network??""),k=l?.wallet_address?Ua(l.wallet_address):null,c=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,d=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,f=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,_=>_.toUpperCase()):null,R=[{label:"Amount",value:y},{label:"Received",value:`${S} ${g}`},...f?[{label:"Payment",value:f}]:[],{label:"Network",value:h},...k?[{label:"Wallet",value:k}]:[],...c?[{label:"Network Fee",value:c}]:[],...d?[{label:"Transaction Fee",value:d}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Mt,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(it,{style:ir.scroll,contentContainerStyle:ir.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ir.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(Hi,{currency:g||"USD",tokenIconUrl:w,size:64}),jsxRuntime.jsx(reactNative.View,{style:[ir.statusBadge,{backgroundColor:u,borderColor:o.card.backgroundColor??r.background}],children:m?jsxRuntime.jsx(Dr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(Ze,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(ze,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:ir.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ir.statusDot,{backgroundColor:u}]}),jsxRuntime.jsx(reactNative.Text,{style:[ir.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:zc[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[ir.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Ya(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[ir.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ir.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:s,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.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}),a?jsxRuntime.jsx(ze,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Qo,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),R.map(_=>jsxRuntime.jsx(Un__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:ir.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:_.label}),jsxRuntime.jsx(reactNative.Text,{style:[ir.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:_.value})]})},_.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[ir.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:ir.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ir.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[ir.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var ir=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"}});var Oh=[50,100,500],Dh=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Ju(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Vh(e){return e.card?`${Ju(e.card.brand)} ${Ju(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Za({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:m,paymentTokens:u=[],onAddPaymentMethod:y,onConfirm:S,onCancel:g,sheetBorderTopLeftRadius:b,sheetBorderTopRightRadius:w,accessToken:h,showHistoryProgressBar:k=true}){let c=Ni(),{colors:d,components:f,fonts:R}=F(),_=b??f.card.borderRadius,T=w??f.card.borderRadius,[C,x]=Un.useState(e),[W,V]=Un.useState(r?"apple_pay":u.length>0?u[0].id:null),O=Un.useRef(false),P=E=>{O.current=true,V(E);};Un.useEffect(()=>{O.current||r||u.length>0&&V(u[0].id);},[u,r]);let[q,N]=Un.useState(false),[ue,Le]=Un.useState("select"),[ve,ee]=Un.useState(null),Oe=Un.useRef(false);Un.useEffect(()=>{s&&l&&/saving/i.test(l)&&Le("card");},[s,l]);let fe=W==="apple_pay",Re=1e3,We=fe?Re:n,be=We!=null&&We>0,oe=Un.useMemo(()=>{if(o)return [];let E=Oh.map(B=>({label:`$${B}`,amount:String(B),disabled:false}));return fe?E.push({label:`$${Re}`,amount:String(Re),disabled:false}):E.push({label:"MAX",amount:be?String(We):"0",disabled:!be}),E},[o,be,We,fe]),De=E=>{if(E==="\u232B"){x(B=>B.slice(0,-1));return}if(E==="."){if(C.includes("."))return;x(B=>B===""?"0.":B+".");return}x(B=>{let Se=B.indexOf(".");return Se!==-1&&B.length-Se>2?B:B==="0"&&E!=="."?E:B+E});},dt=C===""?"0":C,Ue=parseFloat(C),Qe=C!==""&&!isNaN(Ue)&&Ue>0,Ke=r||u.length>0,Ee=a==="header",Je=Un.useMemo(()=>{let E=[];r&&E.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let B of u)E.push({id:B.id,label:Vh(B),hint:B.card?`Expires ${B.card.exp_month}/${B.card.exp_year}`:B.type,brand:B.card?.brand,isApplePay:false});return E},[r,u]),Ce=Je.find(E=>E.id===W),ae=W!=null&&W!=="apple_pay",tt=Ce?Ce.label:ae&&ve?ve:ae?"Card":"Pay With",rt=Ce?!Ce.isApplePay:ae,Me=Ce?.brand??ve??void 0,[he,ne]=Un.useState(false),[le,qt]=Un.useState([]),[pe,se]=Un.useState(false),[we,yt]=Un.useState(null),[ot,ce]=Un.useState(null),Ye=Un.useRef(null);Ye.current=ot;let nr=Un.useRef(false);nr.current=he;let ut=Un.useCallback(async(E=false)=>{if(h){E||(se(true),yt(null));try{let B=await Au(h);if(!nr.current)return;let Se=Array.isArray(B.data)?B.data:Array.isArray(B)?B:[];qt(Se),E||yt(null);let M=Ye.current?.id;if(M){let Z=Se.find(ye=>ye.id===M);Z&&ce(Z);}}catch(B){if(!nr.current)return;E||yt(B?.message??"Failed to load history");}finally{!E&&nr.current&&se(false);}}},[h]),Fr=Un.useCallback(()=>{ne(true),ut();},[ut]);Un.useEffect(()=>{if(!he||!h)return;let E=setInterval(()=>ut(true),15e3);return ()=>clearInterval(E)},[he,h,ut]);let zr=h?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},onPress:Fr,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"History",children:jsxRuntime.jsx(Dr,{size:20,color:d.foreground,strokeWidth:2})}):void 0,ar=Ke?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ee?c.amount.paymentRowHeader:c.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(Le("select"),N(true));},activeOpacity:.7,disabled:s,children:jsxRuntime.jsxs(reactNative.View,{style:c.amount.paymentLeft,children:[Ce?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):rt?jsxRuntime.jsx(Ec,{sublabel:Me,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:c.amount.paymentLabel,children:tt}),jsxRuntime.jsx(Dt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:c.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:g,title:"Enter amount",leftAction:zr}),Ee&&ar,jsxRuntime.jsxs(reactNative.View,{style:c.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.amountText,dt==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",dt]}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.currencyLabel,children:t.toUpperCase()})]}),!Ee&&ar,oe.length>0&&jsxRuntime.jsx(reactNative.View,{style:c.amount.quickRow,children:oe.map(E=>{let B=!E.disabled&&C===E.amount&&C!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,B&&{backgroundColor:d.primary},E.disabled&&{opacity:.4}],activeOpacity:.7,disabled:E.disabled||s,onPress:()=>x(E.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.quickPillText,B&&{color:d.primaryForeground}],children:E.label})},E.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:Dh.map((E,B)=>jsxRuntime.jsx(reactNative.View,{style:c.amount.numpadRow,children:E.map(Se=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.numpadKey,s&&{opacity:.3}],onPress:()=>De(Se),activeOpacity:.6,disabled:s,children:jsxRuntime.jsx(reactNative.Text,{style:Se==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:Se})},Se))},B))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.form.continueBtn,(!Qe||s)&&c.form.continueBtnDisabled],onPress:()=>Qe&&!s&&S(C,W),disabled:!Qe||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,!Qe&&c.form.continueBtnTextDisabled],children:"Continue"})}),!q&&m?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:m}):!q&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(pt,{visible:q,onClose:()=>{s||(N(false),Le("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:_,borderTopRightRadius:T,children:jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetContent,children:ue==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>N(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(Ze,{size:16,color:d.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(it,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[Je.map(E=>{let B=W===E.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[c.amount.sheetOption,B&&{borderColor:d.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{P(E.id),ee(E.isApplePay?null:E.label),N(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetOptionIcon,children:E.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Ec,{sublabel:E.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:E.label}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:E.hint})]})]}),B&&jsxRuntime.jsx(ze,{size:18,color:d.primary,strokeWidth:2.5})]},E.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Oe.current){Oe.current=true;try{let E=await y?.();E&&(P(E.token),ee(E.sublabel),N(!1));}finally{Oe.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{s||Le("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Li,{size:20,color:d.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),s?jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:m})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{i&&Qe&&i(false,C);},children:jsxRuntime.jsx(reactNative.Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(pt,{visible:he,onClose:()=>{ne(false),ce(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:_,borderTopRightRadius:T,children:ot?jsxRuntime.jsx(Ku,{session:ot,onBack:()=>ce(null)}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetContent,children:[jsxRuntime.jsx(Mt,{onPress:()=>ne(false),title:"Purchase History"}),k&&jsxRuntime.jsx(Qu,{active:he&&!pe&&le.length>0,color:d.primary}),pe?jsxRuntime.jsx(qu,{}):we?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:we})}):le.length===0?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.sheetStatusText,{color:d.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(it,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:le.map(E=>{let B=E.transaction_details,Se=B?.source_amount?`$${parseFloat(B.source_amount).toFixed(2)}`:"\u2014",M=(B?.destination_currency??"").toUpperCase(),Z=B?.destination_amount?`${parseFloat(B.destination_amount).toFixed(2)} ${M}`:"",ye=Ya(E.created),de=E.destination_token_metadata,mt=Tn(de?.icon_urls,de?.icon_url),D=Tn(de?.chain?.icon_urls,de?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.sheetOption,activeOpacity:.7,onPress:()=>ce(E),children:[jsxRuntime.jsx(Hi,{currency:M||"USD",tokenIconUrl:mt,networkIconUrl:D,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:Se}),Z?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:Z}):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($u,{status:E.status,colors:d,fontFamily:R.regular}),ye?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:d.foregroundMuted,fontFamily:R.regular},children:ye}):null]}),jsxRuntime.jsx(xr,{size:14,color:d.foregroundMuted,strokeWidth:2})]})]},E.id)})})]})})]})}var qs=4;function Xa({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Ni(),{colors:a,fonts:i,components:s}=F(),l=s.input.placeholderColor,[m,u]=Un.useState(1),[y,S]=Un.useState(e.firstName??""),[g,b]=Un.useState(e.lastName??""),[w,h]=Un.useState(e.dobMonth??""),[k,c]=Un.useState(e.dobDay??""),[d,f]=Un.useState(e.dobYear??""),[R,_]=Un.useState(e.addressLine1??""),[T,C]=Un.useState(e.addressLine2??""),[x,W]=Un.useState(e.city??""),[V,O]=Un.useState(e.state??""),[P,q]=Un.useState(e.postalCode??""),[N,ue]=Un.useState(e.country??"US"),[Le,ve]=Un.useState(e.idNumber??""),ee=Un.useRef(null),Oe=Un.useRef(null),fe=Un.useRef(null),Re=Un.useRef(null),We=Un.useRef(null),be=Un.useRef(null),oe=Un.useRef(null),De=Un.useRef(null),dt=()=>{switch(m){case 1:return y.trim().length>0&&g.trim().length>0;case 2:return w.length===2&&k.length===2&&d.length===4;case 3:return R.trim().length>0&&x.trim().length>0&&V.trim().length>0&&P.trim().length>0;case 4:return Le.trim().length>0;default:return false}},Ue=()=>{dt()&&(m<qs?u(Ce=>Ce+1):r({firstName:y,lastName:g,idNumber:Le,dobMonth:w,dobDay:k,dobYear:d,addressLine1:R,addressLine2:T,city:x,state:V,postalCode:P,country:N}));},Qe=()=>{m>1?u(Ce=>Ce-1):o();},Ke=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Ee=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],Je=[Ut.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.header,children:[jsxRuntime.jsx(reactNative.View,{style:Ut.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ut.iconButton,onPress:Qe,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:m>1?"Back":"Cancel",children:jsxRuntime.jsx(Os,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:Ut.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Je,children:[m," of ",qs]})}),jsxRuntime.jsx(reactNative.View,{style:Ut.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ut.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(Ze,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:Ut.progressTrack,children:Array.from({length:qs}).map((Ce,re)=>jsxRuntime.jsx(reactNative.View,{style:[Ut.progressSegment,{backgroundColor:re<m||re+1===m?a.primary:a.border}]},re))}),jsxRuntime.jsxs(it,{style:n.form.flex,contentContainerStyle:Ut.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:Ke[m-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:Ee[m-1]}),m===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Zo,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:y,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ee.current?.focus()})}),jsxRuntime.jsx(Zo,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ee,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:g,onChangeText:b,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ue})})]}),m===2&&jsxRuntime.jsxs(reactNative.View,{style:Ut.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:Ut.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Ut.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,Ut.dobInput],placeholder:"MM",placeholderTextColor:l,value:w,onChangeText:Ce=>{let re=Ce.replace(/\D/g,"").slice(0,2);h(re),re.length===2&&Oe.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Ut.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Oe,style:[n.form.input,Ut.dobInput],placeholder:"DD",placeholderTextColor:l,value:k,onChangeText:Ce=>{let re=Ce.replace(/\D/g,"").slice(0,2);c(re),re.length===2&&fe.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Ut.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Ut.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:fe,style:[n.form.input,Ut.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:d,onChangeText:Ce=>{let re=Ce.replace(/\D/g,"").slice(0,4);f(re);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ue})]})]}),m===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Zo,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:R,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Re.current?.focus()})}),jsxRuntime.jsx(Zo,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Re,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:T,onChangeText:C,returnKeyType:"next",onSubmitEditing:()=>We.current?.focus()})}),jsxRuntime.jsx(Zo,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:We,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:x,onChangeText:W,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>be.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:Ut.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Zo,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:be,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:V,onChangeText:Ce=>O(Ce.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>oe.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx(Zo,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:oe,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:P,onChangeText:q,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>De.current?.focus()})})})]}),jsxRuntime.jsx(Zo,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:De,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:N,onChangeText:Ce=>ue(Ce.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ue})})]}),m===4&&jsxRuntime.jsxs(Zo,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:Le,onChangeText:ve,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ue}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,Ut.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&m===qs?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!dt()&&n.form.continueBtnDisabled],onPress:Ue,disabled:!dt(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!dt()&&n.form.continueBtnTextDisabled],children:m===qs?"Submit":"Continue"})})})]})})}function Zo({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 Ut=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Qc="@unifold/stripe_oauth";async function Xu(){try{let e=await qc__default.default.getItem(Qc);return e?JSON.parse(e):null}catch{return null}}async function Kc(e){try{await qc__default.default.setItem(Qc,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function vn(){try{await qc__default.default.removeItem(Qc);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Uh=5,Fn=null,ep={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function el(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:m,registerWalletAddress:u,collectPaymentMethod:y,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[g,b]=Un.useState(r),[w,h]=Un.useState(!!e?.externalUserId),[k,c]=Un.useState(false),[d,f]=Un.useState(""),[R,_]=Un.useState(null),[T,C]=Un.useState(e?.email??""),[x,W]=Un.useState(e?.phone??""),[V,O]=Un.useState(""),[P,q]=Un.useState("US"),[N,ue]=Un.useState(""),[Le,ve]=Un.useState(""),ee=Un.useRef(""),Oe=Un.useRef(""),fe=Un.useRef(""),[Re,We]=Un.useState(false),[be,oe]=Un.useState(false),De=Un.useRef(0),dt=Un.useRef(false),Ue=Un.useRef(false),Qe=Un.useRef(false),Ke=Un.useRef(""),Ee=Un.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Je=Un.useRef(null),[Ce,re]=Un.useState(ep),[ae,tt]=Un.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[rt,Me]=Un.useState(""),[he,ne]=Un.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[le,qt]=Un.useState(e?.defaultSourceAmount??"100"),[pe,se]=Un.useState(e?.defaultSourceCurrency??"usd"),[we,yt]=Un.useState(e?.defaultDestinationCurrency??"usdc"),[ot,ce]=Un.useState(null),[Ye,nr]=Un.useState(),[ut,Fr]=Un.useState(),[zr,ar]=Un.useState(false),E=Un.useRef(null),B=Un.useRef(false),Se=Un.useRef(0),M=Un.useRef(e?.onComplete),Z=Un.useRef(e?.onError),ye=Un.useRef(e?.onStepChange),de=Un.useRef(r);Un.useEffect(()=>{M.current=e?.onComplete;},[e?.onComplete]),Un.useEffect(()=>{Z.current=e?.onError;},[e?.onError]),Un.useEffect(()=>{ye.current=e?.onStepChange;},[e?.onStepChange]);let mt=Un.useRef(r);Un.useEffect(()=>{g!==mt.current&&(ye.current?.(g,mt.current),mt.current=g),de.current=g;},[g]),Un.useEffect(()=>{w&&g!==r&&h(false);},[w,g,r]);let D=Un.useCallback((I,v,j)=>{let K={code:I,message:v,step:de.current,stripeErrorCode:j};_(K),f(""),Z.current?.(K);},[]),Or=Un.useCallback(I=>{let v={sessionId:I.id,status:I.status,sourceAmount:I.transaction_details.source_amount,sourceCurrency:I.transaction_details.source_currency,destinationAmount:I.transaction_details.destination_amount,destinationCurrency:I.transaction_details.destination_currency,destinationNetwork:I.transaction_details.destination_network,walletAddress:I.transaction_details.wallet_address,fees:{networkFee:I.transaction_details.fees.network_fee_amount,transactionFee:I.transaction_details.fees.transaction_fee_amount}};return M.current?.(v),v},[]),U=Un.useCallback(()=>_(null),[]),Rt=I=>I.refresh_token??I.refresh?.refresh_token??"",bt=Un.useCallback((I,v,j,K,_e)=>{Oe.current=v,ee.current=j,e?.externalUserId&&Kc({accessToken:v,refreshToken:j,customerId:I,externalUserId:e.externalUserId,email:_e||T,expiresAt:Date.now()+K*1e3});},[e?.externalUserId,T]),Ur=Un.useCallback(async()=>{let I=ee.current;if(!I)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let v=await Lc(I,fe.current??void 0),j=v.access_token,K=Rt(v)||I;return ve(j),bt(fe.current,j,K,v.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),j}catch(v){return console.error("[tryRefreshAccessToken] refresh failed:",v?.message),await vn(),Fn=null,Oe.current="",ee.current="",fe.current="",ve(""),ue(""),null}},[bt]),Zt=Un.useCallback(async I=>{try{return await I(Oe.current)}catch(v){let j=v?.message??"";if(j.includes("stripe_onramp_forbidden")||j.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let K=await Ur();if(!K)throw D("authorization_error","Session expired. Please sign in again."),b("email"),v;return await I(K)}throw v}},[Ur,D]);Un.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){ar(false);return}let v=false;return stripeReactNative.isPlatformPaySupported().then(j=>{v||ar(j);}),()=>{v=true;}},[e?.merchantIdentifier]),Un.useEffect(()=>(B.current=false,()=>{B.current=true,E.current&&clearTimeout(E.current);}),[]);let Oi=Un.useRef(false);Un.useEffect(()=>{if(Oi.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),vn(),Fn=null,h(false);return}let I=false;return (async()=>{try{let v=await Xu();if(I||!v){I||h(!1);return}if(v.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",v.externalUserId,"current:",e.externalUserId),await vn(),Fn=null,I||h(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",v.customerId);let j=Date.now()>=v.expiresAt,K=v.accessToken,_e=v.refreshToken;if(j){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let Ne=await Lc(v.refreshToken,v.customerId);if(I)return;K=Ne.access_token,_e=Ne.refresh_token??Ne.refresh?.refresh_token??v.refreshToken,await Kc({accessToken:K,refreshToken:_e,customerId:v.customerId,externalUserId:e.externalUserId,email:v.email,expiresAt:Date.now()+(Ne.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(Ne){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Ne?.message),await vn(),Fn=null,I||h(!1);return}}if(I)return;if(Oi.current=!0,ue(v.customerId),fe.current=v.customerId,ve(K),Oe.current=K,ee.current=_e,v.email&&C(v.email),Fn===v.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",v.customerId,"\u2014 skipping configure()"),Je.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",v.customerId);let Ne=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:v.customerId});Ne.error?console.error("[useStripeOnramp] restore configureSDK error:",Ne.error.message):Fn=v.customerId,Je.current=Promise.resolve(Ne);}if(I)return;let ft=()=>new Promise(Ne=>{let br=()=>{Qe.current&&Ke.current?Ne():setTimeout(br,200);};br();});try{if(await Promise.race([ft(),new Promise((br,At)=>setTimeout(()=>At(new Error("timeout")),1e4))]),I)return;let Ne=Ke.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",Ne,"network:",Ee.current),await u(Ne,Ee.current);}catch(Ne){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Ne?.message);}if(I)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),b("session_params");}finally{I||h(false);}})(),()=>{I=true;}},[]),Un.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Re||be)return;let I=false;oe(true);async function v(){try{let[j,K]=await Promise.all([Mu({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?zu({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Wt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Wt?.message),null)):Promise.resolve(null)]);if(I)return;let _e=e?.destinationChainType??"ethereum",ft=j.data.find(Wt=>Wt.chain_type===_e);if(ft?.address){let Wt=ft.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Wt,"recipient:",ft.recipient_address),tt(Wt),Ke.current=Wt,ft.recipient_address&&Me(ft.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",_e,"in",j.data?.length,"wallets");let Ne={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},br={8453:"base",1:"ethereum",137:"polygon"},At=K?.destination_network,mr="none";if(At&&Ne[At])ne(Ne[At]),Ee.current=Ne[At],mr=At+" (from default_token API)";else if(e?.destinationChainId&&br[e.destinationChainId]){let Wt=br[e.destinationChainId];Ne[Wt]&&(ne(Ne[Wt]),Ee.current=Ne[Wt]),mr=Wt+" (from chain_id "+e.destinationChainId+")";}else Ne[_e]&&(ne(Ne[_e]),Ee.current=Ne[_e],mr=_e+" (from chain_type fallback)");K?.destination_currency&&yt(K.destination_currency.toLowerCase());let lr=K?.destination_token_metadata,Zr=Tn(lr?.icon_urls,lr?.icon_url),Xr=Tn(lr?.chain?.icon_urls,lr?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",Zr,"network:",Xr),Zr&&nr(Zr),Xr&&Fr(Xr),We(!0),Qe.current=!0;}catch(j){console.error("[useStripeOnramp] Failed to resolve wallet:",j?.message),We(true),Qe.current=true;}finally{I||oe(false);}}return v(),()=>{I=true;}},[e?.publishableKey,e?.externalUserId]);let po=Un.useCallback(async()=>{if(Je.current)return Je.current;let I=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(v=>(v.error&&(console.error("[useStripeOnramp] configureSDK error:",v.error.message,v.error.code),Je.current=null),v)).catch(v=>{throw console.error("[useStripeOnramp] configureSDK threw:",v?.message??v),Je.current=null,v});return Je.current=I,I},[o,e?.merchantDisplayName]);Un.useEffect(()=>{e?.externalUserId||po();},[]);let qo=Un.useCallback(async I=>{if(!dt.current){dt.current=true,c(true),U(),f("Creating auth intent...");try{let v=await Vc(I);f("Waiting for authorization...");let j=await i(v);if(j?.error){console.log("[proceedToAuthorize] authorize error:",j.error.message),D("authorization_error","Something went wrong during authorization. Please try again."),b("email");return}if(j?.status==="Denied"){D("authorization_error","Authorization denied by user."),b("email");return}if(j?.status!=="Consented"||!j.customerId){D("authorization_error","Authorization was canceled."),b("email");return}f("Exchanging tokens...");let K=j.customerId,_e=await Vu(v,K),ft=_e.access_token,Ne=Rt(_e);console.log("[useStripeOnramp] customerId:",K),console.log("[useStripeOnramp] accessToken acquired, length:",ft.length),ue(K),fe.current=K,Fn=K,ve(ft),bt(K,ft,Ne,_e.expires_in??3600),f("Checking verification status...");try{let br=await Ga(K,ft),At=br.verifications.find(Cn=>Cn.name==="kyc_verified"),mr=br.verifications.find(Cn=>Cn.name==="id_document_verified"),lr=At?.status==="verified",Zr=At?.status==="rejected",Xr=mr?.status==="verified",Wt=br.provided_fields.includes("first_name");if(f(""),Zr&&!Wt)D("kyc_error","KYC was previously rejected. Please submit with correct info."),b("kyc");else if(Zr&&Wt)b(Xr?"wallet":"identity");else if(!lr&&!Wt)b("kyc");else if(!Xr)b("identity");else if(Qe.current&&Ke.current)try{let Cn=Ke.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",Cn,"network:",he);let Ra=await u(Cn,he);Ra?.error?(console.warn("[proceedToAuthorize] wallet registration error:",Ra.error.message),D("wallet_error",Ra.error.message,Ra.error.code),b("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),b("session_params"));}catch(Cn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Cn?.message),b("wallet");}else b("wallet");}catch(br){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",br?.message),f(""),b("kyc");}}catch(v){D("authorization_error",v?.message??String(v)),b("email");}finally{dt.current=false,c(false);}}},[i,U,D,bt,u,he]),Q=Un.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!T){D("validation_error","Please enter an email address.");return}c(true),U(),f("");try{f("Configuring...");let I=await po();if(I.error){D("configuration_error",I.error.message,I.error.code);return}f("Checking Link account...");let v=await n(T);if(v.error){D("authorization_error",v.error.message,v.error.code);return}v.hasLinkAccount?await qo(T):(f(""),b("register"));}catch(I){D("unknown_error",I?.message??String(I));}finally{c(false);}},[U,po,T,D,n,qo]),ge=Un.useCallback(async()=>{if(!x){D("validation_error","Please enter your phone number.");return}c(true),U(),f("");try{f("Creating Link account...");let I=await a({email:T,phone:x,fullName:V||T,country:P||"US"});if(I.error){D("registration_error",I.error.message,I.error.code);return}await qo(T);}catch(I){D("registration_error",I?.message??String(I));}finally{c(false);}},[U,P,T,D,V,x,a,qo]);Un.useEffect(()=>{if(g!=="email"||!e?.email||w)return;let I=++De.current,v=false,j=()=>v||De.current!==I;return e?.phone?(async()=>{c(true),U();try{f("Configuring...");let K=await po();if(j())return;if(K.error){D("configuration_error",K.error.message,K.error.code);return}f("Checking Link account...");let _e=await n(e.email);if(j())return;if(_e.error){D("authorization_error",_e.error.message,_e.error.code);return}if(_e.hasLinkAccount){if(j())return;await qo(e.email);}else {f("Creating Link account...");let ft=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(j())return;if(ft.error){D("registration_error",ft.error.message,ft.error.code);return}if(j())return;await qo(e.email);}}catch(K){j()||D("unknown_error",K?.message??String(K));}finally{c(false);}})():(async()=>{c(true),U();try{f("Configuring...");let K=await po();if(j())return;if(K.error){D("configuration_error",K.error.message,K.error.code);return}f("Checking Link account...");let _e=await n(e.email);if(j())return;if(_e.error){D("authorization_error",_e.error.message,_e.error.code);return}if(_e.hasLinkAccount){if(j())return;await qo(e.email);}else {if(j())return;f(""),b("register");}}catch(K){j()||D("unknown_error",K?.message??String(K));}finally{c(false);}})(),()=>{v=true;}},[g,e?.email,e?.phone,w]);let Ot=Un.useCallback(async I=>{c(true),U(),f(""),re(I);try{let v={firstName:I.firstName,lastName:I.lastName,idNumber:I.idNumber||void 0,dateOfBirth:{day:parseInt(I.dobDay,10),month:parseInt(I.dobMonth,10),year:parseInt(I.dobYear,10)},address:{line1:I.addressLine1,line2:I.addressLine2||void 0,city:I.city,state:I.state,postalCode:I.postalCode,country:I.country}},j=await s(v);if(j?.error){if(j.error.stripeErrorCode==="consumer_person_already_verified"){f(""),b("identity");return}D("kyc_error",j.error.message,j.error.stripeErrorCode??j.error.code),b("kyc");return}f("Please review your KYC information...");let K=await l(null);if(K?.error){D("kyc_error",K.error.message,K.error.stripeErrorCode??K.error.code),b("kyc");return}if(K?.status==="UpdateAddress"){D("kyc_error","Please update your address and resubmit."),b("kyc");return}f(""),b("identity");}catch(v){D("kyc_error",v?.message??String(v)),b("kyc");}finally{c(false);}},[s,U,D,l]),mo=Un.useCallback(async()=>{if(!Ue.current){Ue.current=true,c(true),U(),f("Launching identity verification...");try{let I=await m();if(I?.error){D("identity_error",I.error.message,I.error.code);return}f(""),b("wallet");}catch(I){D("identity_error",I?.message??String(I));}finally{Ue.current=false,c(false);}}},[U,D,m]);Un.useEffect(()=>{g==="identity"&&!k&&mo();},[g]);let vs=Un.useCallback(async()=>{if(!ae){D("validation_error","Please enter a wallet address.");return}c(true),U(),f("");try{let I=ae.toLowerCase();console.log("[registerWallet] registering wallet:",I,"network:",he);let v=await u(I,he);if(v?.error){console.warn("[registerWallet] error:",v.error.message),D("wallet_error",v.error.message,v.error.code);return}console.log("[registerWallet] wallet registered successfully"),f(""),b("session_params");}catch(I){D("wallet_error",I?.message??String(I));}finally{c(false);}},[U,D,ae,he,u]);Un.useEffect(()=>{g==="wallet"&&Re&&ae&&vs();},[g,Re,ae]);let fo=Un.useCallback(I=>{B.current=false,Se.current=0;let v=0,j=async()=>{v+=1;let K=Oe.current;try{let _e=await Wu(I,K);if(console.log(`[pollSessionStatus] poll #${v} session=${I} status="${_e.status}"`),B.current)return;Se.current=0,_e.status==="fulfillment_complete"?(ce(_e),b("success")):E.current=setTimeout(j,3e3);}catch(_e){if(B.current)return;let ft=_e?.message??"";if((ft.includes("stripe_onramp_forbidden")||ft.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Ur()&&!B.current)){E.current=setTimeout(j,1e3);return}if(Se.current+=1,console.error(`[pollSessionStatus] poll #${v} error:`,ft),Se.current>=Uh){D("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}E.current=setTimeout(j,5e3);}};E.current=setTimeout(j,3e3);},[D,Ur]),bn=Un.useCallback(()=>{if(de.current==="processing"&&ot?.id){if(!Oe.current){D("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}U(),Se.current=0,E.current&&(clearTimeout(E.current),E.current=null),fo(ot.id);}},[U,D,fo,ot?.id]),_a=Un.useCallback(async I=>{c(true),U(),f("");try{f("Confirming purchase...");let v=await Zt(j=>Bu(I,j));console.log("[finalizeOnrampSession] confirmed session:",v.id,"status:",v.status),ce(v),b("processing"),f(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",v.id),fo(v.id);}finally{c(false);}},[U,fo,Zt]),nc=Un.useRef(false),cf=Un.useCallback(async()=>{if(!(!ot||nc.current)){nc.current=true;try{c(!0),U(),f("Refreshing quote...");let I=await Zt(v=>Bc(ot.id,v));ce(I),await _a(I.id);}catch(I){console.log("[confirmCheckout] error:",I?.message),D("session_error","Something went wrong. Please try again."),b("quote");}finally{c(false),nc.current=false;}}},[U,D,_a,ot,Zt]),cu=Un.useCallback(async()=>{let I=T;if(!I)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",I),f("Verifying identity...");let v=await Vc(I),j=await i(v);return j?.status==="Consented"&&j.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",j.customerId),fe.current=j.customerId,ue(j.customerId),Fn=j.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",j?.status),!1)}catch(v){return console.warn("[reauthorizeLink] failed:",v?.message),false}},[i,T]),df=Un.useCallback(async(I=false,v,j)=>{let K=v??le;if(console.log("[collectPaymentMethod] called:",{useApplePay:I,amt:K,amountOverride:v,sourceAmount:le,hasSavedToken:!!j}),!K||isNaN(Number(K))||Number(K)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),D("validation_error","Please enter a valid amount.");return}v&&qt(v),c(true),U(),f("");try{let _e=await po();if(_e.error){D("configuration_error",_e.error.message,_e.error.code);return}let ft;if(j)console.log("[collectPaymentMethod] using saved payment token"),ft=j;else if(I){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),D("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),b("session_params");return}f("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let At={applePay:{merchantCountryCode:"US",currencyCode:pe.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${we.toUpperCase()} purchase + fees`,amount:K}]}},mr=await y("PlatformPay",At);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!mr?.error),mr?.error){let Zr=mr.error.message??"",Xr=mr.error.code??"",Wt=/cancel/i.test(Zr)||/cancel/i.test(Xr);console.log("[collectPaymentMethod] pmResult error:",mr.error,"isCancellation:",Wt),Wt||(D("payment_error",Zr,Xr),b("session_params"));return}if(!mr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}f("Creating payment token...");let lr=await S();if(console.log("[collectPaymentMethod] tokenResult ok:",!lr?.error),lr?.error){D("payment_error",lr.error.message,lr.error.code),b("session_params");return}ft=lr.cryptoPaymentToken;}else {f("Select a payment method...");let At=await y("Card");if(console.log("[collectPaymentMethod] Card result ok:",!At?.error),At?.error){let Zr=At.error.message??"",Xr=At.error.code??"",Wt=/cancel/i.test(Zr)||/cancel/i.test(Xr);console.log("[collectPaymentMethod] pmResult error:",At.error,"isCancellation:",Wt),Wt||(D("payment_error",Zr,Xr),b("session_params"));return}if(!At?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let mr=At.displayData;console.log("[collectPaymentMethod] displayData:",{type:mr.type,label:mr.label,sublabel:mr.sublabel,hasIcon:!!mr.icon}),f("Creating payment token...");let lr=await S();if(console.log("[collectPaymentMethod] tokenResult ok:",!lr?.error),lr?.error){D("payment_error",lr.error.message,lr.error.code),b("session_params");return}ft=lr.cryptoPaymentToken;}f("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",ae,"walletAddressRef:",Ke.current);let Ne=Ke.current||ae.toLowerCase(),br=await Zt(At=>Lu({cryptoCustomerId:fe.current,paymentToken:ft,sourceAmount:Number(K),sourceCurrency:pe,destinationCurrency:we,walletAddress:Ne,destinationNetwork:he},At));console.log("[collectPaymentMethod] session created:",br?.id,"useApplePay:",I),ce(br),f(""),I?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await _a(br.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):b("quote");}catch(_e){console.log("[collectPaymentMethod] error caught:",_e?.message),D("session_error","Something went wrong. Please try again."),b("session_params");}finally{c(false),f("");}},[U,po,y,S,we,D,_a,qt,le,pe,ae,he,Zt,e?.merchantIdentifier]),uf=Un.useCallback(async()=>{c(true),U(),f("Select a payment method...");try{let I=await po();if(I.error)return D("configuration_error",I.error.message,I.error.code),null;let v=await y("Card");if(console.log("[addPaymentMethod] Card result ok:",!v?.error),v?.error?.message&&/no active link consumer/i.test(v.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await cu())return D("authorization_error","Please verify your identity to add a payment method."),null;v=await y("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!v?.error);}if(v?.error){let _e=v.error.message??"",ft=v.error.code??"",Ne=/cancel/i.test(_e)||/cancel/i.test(ft);return console.log("[addPaymentMethod] pmResult error:",v.error,"isCancellation:",Ne),Ne||D("payment_error",_e,ft),null}if(!v?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let j=v.displayData;console.log("[addPaymentMethod] displayData:",{type:j.type,label:j.label,sublabel:j.sublabel,hasIcon:!!j.icon}),f("Saving payment method...");let K=await S();return console.log("[addPaymentMethod] tokenResult ok:",!K?.error),K?.error?(D("payment_error",K.error.message,K.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:K.cryptoPaymentToken,sublabel:j.sublabel??""})}catch(I){return console.log("[addPaymentMethod] error:",I?.message),D("session_error",I?.message??String(I)),null}finally{c(false),f("");}},[U,po,y,S,D,cu]),pf=Un.useCallback(async()=>{if(ot){c(true),U(),f("");try{let I=await Zt(v=>Bc(ot.id,v));ce(I);}catch(I){console.log("[refreshQuote] error:",I?.message),D("session_error","Something went wrong. Please try again.");}finally{c(false);}}},[U,D,ot,Zt]),mf=Un.useCallback(()=>{B.current=true,Se.current=0,E.current&&(clearTimeout(E.current),E.current=null),b(r),c(false),f(""),_(null),C(e?.email??""),W(e?.phone??""),O(""),q("US"),ue(""),fe.current="",ve(""),Oe.current="",ee.current="",We(false),oe(false),re(ep),tt(e?.recipientAddress??""),Ke.current="",Qe.current=false,ne(stripeReactNative.Onramp.CryptoNetwork.ethereum),qt(e?.defaultSourceAmount??"100"),se(e?.defaultSourceCurrency??"usd"),yt(e?.defaultDestinationCurrency??"usdc"),Me(""),nr(void 0),Fr(void 0),ce(null),De.current+=1,dt.current=false,Ue.current=false;},[e,r]);return {step:g,restoring:w,loading:k,status:d,error:R,email:T,phone:x,fullName:V,country:P,customerId:N,accessToken:Le,session:ot,kycData:Ce,walletAddress:ae,resolvedRecipientAddress:rt,walletNetwork:he,sourceAmount:le,sourceCurrency:pe,destinationCurrency:we,tokenIconUrl:Ye,networkIconUrl:ut,applePaySupported:zr,walletReady:Re,walletLoading:be,setStep:b,setStatus:f,setEmail:C,setPhone:W,setFullName:O,setCountry:q,setWalletAddress:tt,setWalletNetwork:ne,setSourceAmount:qt,setSourceCurrency:se,setDestinationCurrency:yt,checkEmail:Q,register:ge,attachKyc:Ot,verifyIdentity:mo,registerWallet:vs,collectPaymentMethod:df,addPaymentMethod:uf,refreshQuote:pf,confirmCheckout:cf,reset:mf,clearError:U,emitComplete:Or,resumeFulfillmentPolling:bn,amountFirst:t}}function tp({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:m}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Rr,{error:n,progress:a,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(Mt,{onPress:m}),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,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),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})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Rr,{error:n,progress:a,loading:o})]})]})})}function op({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:a}),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(Rr,{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 ip({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:m,onRetryStatusCheck:u}){let{colors:y}=F(),S=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[S?jsxRuntime.jsx(Mt,{onPress:m}):jsxRuntime.jsx(reactNative.View,{style:Na}),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:y.primary,gradientTo:y.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
-
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&a&&i&&jsxRuntime.jsx($a,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Rr,{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 sp({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:m}){let{colors:u}=F(),y=t.transaction_details,S=Ha(y.destination_amount,y.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:m??l,title:"Review your purchase",variant:m?"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(Hi,{currency:y.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(ho,{quote:e.quote,label:"You pay",value:`${y.source_amount} ${y.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(ho,{quote:e.quote,label:"You receive",value:`${S} ${y.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(ho,{quote:e.quote,label:"Network fee",value:`$${y.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(ho,{quote:e.quote,label:"Transaction fee",value:`$${y.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:u.primaryForeground,gradientTo:u.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Rr,{error:o,progress:n,loading:r})]})]})}function ap({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:m}){let u=F();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Rr,{error:o,progress:n,loading:r})]})]}):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(Mt,{onPress:m}),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.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:u.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:y=>s(y.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),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:a})]})]}),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})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Rr,{error:o,progress:n,loading:r})]})]})})}function og({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=F(),n=e.toLowerCase(),a=ja[n]??o.primary,i=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[Oo.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsxRuntime.jsx(reactNative.Text,{style:[Oo.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Oo.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(ze,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function lp({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:m}=F(),u=t.transaction_details,y=Ha(u.destination_amount,u.destination_currency),S=r||o||"";Ui(u.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(it,{style:e.form.flex,contentContainerStyle:Oo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Oo.iconSection,children:[jsxRuntime.jsx(og,{currency:u.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Oo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Oo.statusDot,{backgroundColor:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Oo.statusText,{color:s.foreground,fontFamily:m.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Oo.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx($a,{sourceCurrency:u.source_currency,destinationCurrency:u.destination_currency,destinationNetwork:u.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Oo.detailCard],children:[jsxRuntime.jsx(ho,{quote:e.quote,label:"You Paid",value:`${u.source_amount} ${u.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(ho,{quote:e.quote,label:"You Received",value:`${y} ${u.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(ho,{quote:e.quote,label:"Network Fee",value:`$${u.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(ho,{quote:e.quote,label:"Transaction Fee",value:`$${u.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Dc,{quote:e.quote,label:"Intent Address",address:u.wallet_address,hideDivider:true}),S?jsxRuntime.jsx(Dc,{quote:e.quote,label:"Recipient Address",address:S,last:true}):jsxRuntime.jsx(ho,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var Oo=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 cp({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:m,registerWallet:u,onClose:y}){let{components:S}=F();if(t){let g=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Mt,{onPress:y}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!g&&jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Rr,{error:o,progress:n,loading:r})]}),g&&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(Mt,{onPress:y}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:S.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),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:za.map(g=>{let b=i===g.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,b&&e.wallet.rowSelected],onPress:()=>{l(g.value),m(g.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(g.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,b&&e.wallet.rowTextSelected],children:g.label}),b&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(ze,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},g.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})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:u,disabled:!a,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Rr,{error:o,progress:n,loading:r})]})]})})}function il({config:e,onClose:t}){let r=F(),o=Ni(),{step:n,restoring:a,loading:i,status:s,error:l,email:m,phone:u,session:y,kycData:S,walletAddress:g,resolvedRecipientAddress:b,walletNetwork:w,sourceAmount:h,sourceCurrency:k,destinationCurrency:c,tokenIconUrl:d,networkIconUrl:f,applePaySupported:R,setStep:_,setEmail:T,setPhone:C,setWalletAddress:x,setWalletNetwork:W,setSourceAmount:V,setDestinationCurrency:O,checkEmail:P,register:q,attachKyc:N,verifyIdentity:ue,registerWallet:Le,collectPaymentMethod:ve,addPaymentMethod:ee,confirmCheckout:Oe,reset:fe,emitComplete:Re,resumeFulfillmentPolling:We,amountFirst:be,customerId:oe,accessToken:De}=el(e),dt=!!e?.email,Ue=!!e?.phone,Qe=!!e?.publishableKey&&!!e?.externalUserId,[Ke,Ee]=Un.useState(void 0),[Je,Ce]=Un.useState([]);Un.useEffect(()=>{if(a||n!=="session_params"||!oe||!De)return;console.log("[OnrampScreen] customerId:",oe);let Me=ne=>{let le=ne?.message??"";return le.includes("stripe_onramp_forbidden")||le.includes("403")},he=ne=>{Me(ne)&&(vn(),fe());};Ga(oe,De).then(ne=>{console.log("[OnrampScreen] customer fetched, id:",ne?.id);}).catch(ne=>{console.warn("[OnrampScreen] customer fetch error:",ne?.message),he(ne);}),Ac(oe,De).then(ne=>{console.log("[OnrampScreen] payment_tokens fetched, count:",ne.data?.length??0),Ce(ne.data??[]);}).catch(ne=>{console.warn("[OnrampScreen] payment_tokens error:",ne?.message),he(ne);}),console.log("[OnrampScreen] walletAddress:",g,"walletNetwork:",w),g&&(console.log("[OnrampScreen] calling getTransactionLimits..."),Eu({destinationNetwork:w||"ethereum",walletAddress:g,accessToken:De,cryptoCustomerId:oe}).then(ne=>{console.log("[OnrampScreen] transaction_limits fetched");let le=ne.limits?.usd;if(le?.card?.length){let qt=Math.max(...le.card.map(pe=>pe.limit));Ee(qt),console.log("[OnrampScreen] card max amount:",qt);}}).catch(ne=>{console.warn("[OnrampScreen] transaction_limits error:",ne?.message),he(ne);}));},[a,n,oe,De,g,w,fe]);let re=async()=>{if(!(!oe||!De))try{let Me=await Ac(oe,De);console.log("[OnrampScreen] payment_tokens refreshed, count:",Me.data?.length??0),Ce(Me.data??[]);}catch(Me){console.warn("[OnrampScreen] payment_tokens refresh error:",Me?.message);let he=Me?.message??"";(he.includes("stripe_onramp_forbidden")||he.includes("403"))&&(vn(),fe());}},ae=async()=>{let Me=await ee();return Me&&await re(),Me},tt=e?.skipSuccessConfirmation===true;Un.useEffect(()=>{n==="success"&&tt&&y&&(Re(y),fe(),t?.());},[n,tt,y,Re,fe,t]);let rt=()=>{fe(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:[cg.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsxRuntime.jsx(tp,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:dt,loading:i,error:l,status:s,email:m,setEmail:T,checkEmail:P,onClose:rt}):n==="register"?jsxRuntime.jsx(ap,{styles:o,hasPrefilledPhone:Ue,loading:i,error:l,status:s,email:m,phone:u,setPhone:C,register:q,onClose:rt}):n==="kyc"?jsxRuntime.jsx(Xa,{initialData:S,loading:i,onComplete:N,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx(op,{styles:o,loading:i,status:s,error:l,verifyIdentity:ue,onClose:rt}):n==="wallet"?jsxRuntime.jsx(cp,{styles:o,hasAutoWallet:Qe,loading:i,error:l,status:s,walletAddress:g,walletNetwork:w,setWalletAddress:x,setWalletNetwork:W,setDestinationCurrency:O,registerWallet:Le,onClose:rt}):n==="session_params"?jsxRuntime.jsx(Za,{initialAmount:h,currency:k,applePaySupported:R,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:Ke,paymentTokens:Je,onAddPaymentMethod:ae,onCollectPayment:(Me,he)=>{ve(Me,he);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(Me,he)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:Me,selectedMethod:he,amountFirst:be}),be&&!oe)V(Me),_("email");else {let ne=he==="apple_pay",le=!ne&&he?he:void 0;console.log("[OnrampScreen] isApplePay:",ne,"hasSavedToken:",!!le),ve(ne,Me,le);}},onCancel:rt,accessToken:De,showHistoryProgressBar:e?.showHistoryProgressBar}):n==="quote"&&y?jsxRuntime.jsx(sp,{styles:o,session:y,loading:i,error:l,status:s,confirmCheckout:Oe,tokenIconUrl:d,networkIconUrl:f,onClose:rt,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(ip,{styles:o,error:l,status:s,loading:i,sourceCurrency:y?.transaction_details.source_currency,destinationCurrency:y?.transaction_details.destination_currency??c,destinationNetwork:y?.transaction_details.destination_network??"base",tokenIconUrl:d,networkIconUrl:f,onClose:rt,onRetryStatusCheck:We}):n==="success"&&y&&!tt?jsxRuntime.jsx(lp,{styles:o,session:y,resolvedRecipientAddress:b,recipientFromConfig:e?.recipientAddress,tokenIconUrl:d,networkIconUrl:f,onDone:()=>{Re(y),fe(),t?.();}}):null}var cg=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function pp(){try{let e=dg__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let a=n.trim();if(a.length>0)return a}}}catch{}}function sl({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:m,onError:u,onStepChange:y,onClose:S,merchantIdentifier:g="",urlScheme:b="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:h=false}){let{colors:k,fonts:c,components:d}=F(),f=e||La(),R=Un.useMemo(()=>{let V=g.trim();return V.length>0?V:pp()??""},[g]),[_,T]=Un.useState("loading"),[C,x]=Un.useState(null);Un.useEffect(()=>{let V=false;async function O(){try{f&&(qa(f),Qa(Es()));let P=await Ka();if(V)return;let q=R.trim();if(await stripeReactNative.initStripe({publishableKey:P,urlScheme:b,...q?{merchantIdentifier:q}:{}}),V)return;T("ready");}catch(P){if(V)return;console.error("[StripeOnramp] Init failed:",P),x(P?.message??"Failed to load Stripe configuration"),T("error");}}return O(),()=>{V=true;}},[f,R,b]);let W=Un.useMemo(()=>{let V={publishableKey:f,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:m,onError:u,onStepChange:y};return s&&(V.destinationTokenAddress=s),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),w&&(V.paymentSelectorPosition=w),V.skipSuccessConfirmation=h,V.merchantIdentifier=R,V},[f,o,a,i,s,l,t,r,n,w,h,R,m,u,y]);return _==="error"?jsxRuntime.jsxs(reactNative.View,{style:[Yi.centered,{backgroundColor:k.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Yi.errorText,{color:k.error,fontFamily:c.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[Yi.errorDetail,{color:k.foregroundMuted,fontFamily:c.regular}],children:C}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Yi.retryBtn,{backgroundColor:d.button.primaryBackground,borderRadius:d.button.borderRadius}],onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:[Yi.retryBtnText,{color:d.button.primaryText,fontFamily:c.medium}],children:"Go Back"})})]}):_==="loading"?jsxRuntime.jsx(reactNative.View,{style:[Yi.centered,{backgroundColor:k.background}],children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3,gradientFrom:k.primary,gradientTo:k.primary})}):jsxRuntime.jsx(il,{config:W,onClose:S})}var Yi=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 gp(){let{configure:e}=stripeReactNative.useOnramp(),t=Un.useRef(false);return Un.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 yp="__unifold_stripe_onramp__";function al(e){globalThis[yp]=e;}function bp(){return globalThis[yp]}al(sl);var Do=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 ai,Vn,Ji,Cp,Cg=(Cp=class extends Do{constructor(){super();X(this,ai);X(this,Vn);X(this,Ji);A(this,Ji,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){p(this,Vn)||this.setEventListener(p(this,Ji));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,Vn))==null||t.call(this),A(this,Vn,void 0));}setEventListener(t){var r;A(this,Ji,t),(r=p(this,Vn))==null||r.call(this),A(this,Vn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){p(this,ai)!==t&&(A(this,ai,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof p(this,ai)=="boolean"?p(this,ai):globalThis.document?.visibilityState!=="hidden"}},ai=new WeakMap,Vn=new WeakMap,Ji=new WeakMap,Cp),Zi=new Cg;var wg={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Vo,li,wp,Sg=(wp=class{constructor(){X(this,Vo,wg);X(this,li,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&p(this,li)&&e!==p(this,Vo)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:p(this,Vo),provider:e}),A(this,Vo,e),process.env.NODE_ENV!=="production"&&A(this,li,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&A(this,li,true),p(this,Vo).setTimeout(e,t)}clearTimeout(e){p(this,Vo).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&A(this,li,true),p(this,Vo).setInterval(e,t)}clearInterval(e){p(this,Vo).clearInterval(e);}},Vo=new WeakMap,li=new WeakMap,wp),Lo=new Sg;function Sp(e){setTimeout(e,0);}var Zc=typeof window>"u"||"Deno"in globalThis;function rr(){}function xp(e,t){return typeof e=="function"?e(t):e}function Js(e){return typeof e=="number"&&e>=0&&e!==1/0}function cl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wo(e,t){return typeof e=="function"?e(t):e}function Ar(e,t){return typeof e=="function"?e(t):e}function dl(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==Zs(i,t.options))return false}else if(!ui(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function ul(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(ci(t.options.mutationKey)!==ci(a))return false}else if(!ui(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Zs(e,t){return (t?.queryKeyHashFn||ci)(e)}function ci(e){return JSON.stringify(e,(t,r)=>Jc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ui(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ui(e[r],t[r])):false}var kg=Object.prototype.hasOwnProperty;function ll(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=kp(e)&&kp(t);if(!o&&!(Jc(e)&&Jc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},m=0;for(let u=0;u<s;u++){let y=o?u:i[u],S=e[y],g=t[y];if(S===g){l[y]=S,(o?u<a:kg.call(e,y))&&m++;continue}if(S===null||g===null||typeof S!="object"||typeof g!="object"){l[y]=g;continue}let b=ll(S,g,r+1);l[y]=b,b===S&&m++;}return a===s&&m===a?e:l}function pl(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 kp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Jc(e){if(!Tp(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Tp(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Tp(e){return Object.prototype.toString.call(e)==="[object Object]"}function _p(e){return new Promise(t=>{Lo.setTimeout(t,e);})}function Xs(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 ll(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 ll(e,t)}return t}function Rp(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Ip(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var di=Symbol();function ml(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===di&&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===di?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fl(e,t){return typeof e=="function"?e(...t):!!e}function vp(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 Bo=(()=>{let e=()=>Zc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function ea(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Pp=Sp;function Tg(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=Pp,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var Tt=Tg();var Xi,Ln,es,Fp,xg=(Fp=class extends Do{constructor(){super();X(this,Xi,true);X(this,Ln);X(this,es);A(this,es,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){p(this,Ln)||this.setEventListener(p(this,es));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,Ln))==null||t.call(this),A(this,Ln,void 0));}setEventListener(t){var r;A(this,es,t),(r=p(this,Ln))==null||r.call(this),A(this,Ln,t(this.setOnline.bind(this)));}setOnline(t){p(this,Xi)!==t&&(A(this,Xi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return p(this,Xi)}},Xi=new WeakMap,Ln=new WeakMap,es=new WeakMap,Fp),ts=new xg;function _g(e){return Math.min(1e3*2**e,3e4)}function Xc(e){return (e??"online")==="online"?ts.isOnline():true}var hl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function gl(e){let t=false,r=0,o,n=ea(),a=()=>n.status!=="pending",i=w=>{if(!a()){let h=new hl(w);S(h),e.onCancel?.(h);}},s=()=>{t=true;},l=()=>{t=false;},m=()=>Zi.isFocused()&&(e.networkMode==="always"||ts.isOnline())&&e.canRun(),u=()=>Xc(e.networkMode)&&e.canRun(),y=w=>{a()||(o?.(),n.resolve(w));},S=w=>{a()||(o?.(),n.reject(w));},g=()=>new Promise(w=>{o=h=>{(a()||m())&&w(h);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),b=()=>{if(a())return;let w,h=r===0?e.initialPromise:void 0;try{w=h??e.fn();}catch(k){w=Promise.reject(k);}Promise.resolve(w).then(y).catch(k=>{if(a())return;let c=e.retry??(Bo.isServer()?0:3),d=e.retryDelay??_g,f=typeof d=="function"?d(r,k):d,R=c===true||typeof c=="number"&&r<c||typeof c=="function"&&c(r,k);if(t||!R){S(k);return}r++,e.onFail?.(r,k),_p(f).then(()=>m()?void 0:g()).then(()=>{t?S(k):b();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:u,start:()=>(u()?b():g().then(b),n)}}var pi,Op,yl=(Op=class{constructor(){X(this,pi);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Js(this.gcTime)&&A(this,pi,Lo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Bo.isServer()?1/0:300*1e3));}clearGcTimeout(){p(this,pi)!==void 0&&(Lo.clearTimeout(p(this,pi)),A(this,pi,void 0));}},pi=new WeakMap,Op);var mi,rs,ao,fi,dr,ta,hi,Kr,Ap,en,Lp,Bp=(Lp=class extends yl{constructor(t){super();X(this,Kr);X(this,mi);X(this,rs);X(this,ao);X(this,fi);X(this,dr);X(this,ta);X(this,hi);A(this,hi,false),A(this,ta,t.defaultOptions),this.setOptions(t.options),this.observers=[],A(this,fi,t.client),A(this,ao,p(this,fi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,A(this,mi,Vp(this.options)),this.state=t.state??p(this,mi),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return p(this,dr)?.promise}setOptions(t){if(this.options={...p(this,ta),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Vp(this.options);r.data!==void 0&&(this.setState(Dp(r.data,r.dataUpdatedAt)),A(this,mi,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&p(this,ao).remove(this);}setData(t,r){let o=Xs(this.state.data,t,this.options);return Be(this,Kr,en).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Be(this,Kr,en).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=p(this,dr)?.promise;return p(this,dr)?.cancel(t),r?r.then(rr).catch(rr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return p(this,mi)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Ar(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===di||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>wo(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:!cl(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),p(this,dr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),p(this,dr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),p(this,ao).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(p(this,dr)&&(p(this,hi)||Be(this,Kr,Ap).call(this)?p(this,dr).cancel({revert:true}):p(this,dr).cancelRetry()),this.scheduleGc()),p(this,ao).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Be(this,Kr,en).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&p(this,dr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(p(this,dr))return p(this,dr).continueRetry(),p(this,dr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(m=>m.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(A(this,hi,true),o.signal)});},a=()=>{let l=ml(this.options,r),u=(()=>{let y={client:p(this,fi),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return A(this,hi,false),this.options.persister?this.options.persister(l,u,this):l(u)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:p(this,fi),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),A(this,rs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Be(this,Kr,en).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),A(this,dr,gl({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof hl&&l.revert&&this.setState({...p(this,rs),fetchStatus:"idle"}),o.abort();},onFail:(l,m)=>{Be(this,Kr,en).call(this,{type:"failed",failureCount:l,error:m});},onPause:()=>{Be(this,Kr,en).call(this,{type:"pause"});},onContinue:()=>{Be(this,Kr,en).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await p(this,dr).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),p(this,ao).config.onSuccess?.(l,this),p(this,ao).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof hl){if(l.silent)return p(this,dr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Be(this,Kr,en).call(this,{type:"error",error:l}),p(this,ao).config.onError?.(l,this),p(this,ao).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},mi=new WeakMap,rs=new WeakMap,ao=new WeakMap,fi=new WeakMap,dr=new WeakMap,ta=new WeakMap,hi=new WeakMap,Kr=new WeakSet,Ap=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},en=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,...ed(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Dp(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return A(this,rs,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),Tt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),p(this,ao).notify({query:this,type:"updated",action:t});});},Lp);function ed(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dp(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Vp(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 Wr,je,oa,Ir,gi,os,tn,Bn,na,ns,is,yi,bi,An,ss,at,ra,td,rd,od,nd,id,sd,ad,zp,Mp,cd=(Mp=class extends Do{constructor(t,r){super();X(this,at);X(this,Wr);X(this,je);X(this,oa);X(this,Ir);X(this,gi);X(this,os);X(this,tn);X(this,Bn);X(this,na);X(this,ns);X(this,is);X(this,yi);X(this,bi);X(this,An);X(this,ss,new Set);this.options=r,A(this,Wr,t),A(this,Bn,null),A(this,tn,ea()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(p(this,je).addObserver(this),Wp(p(this,je),this.options)?Be(this,at,ra).call(this):this.updateResult(),Be(this,at,nd).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return ld(p(this,je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ld(p(this,je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Be(this,at,id).call(this),Be(this,at,sd).call(this),p(this,je).removeObserver(this);}setOptions(t){let r=this.options,o=p(this,je);if(this.options=p(this,Wr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,p(this,je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Be(this,at,ad).call(this),p(this,je).setOptions(this.options),r._defaulted&&!pl(this.options,r)&&p(this,Wr).getQueryCache().notify({type:"observerOptionsUpdated",query:p(this,je),observer:this});let n=this.hasListeners();n&&Ep(p(this,je),o,this.options,r)&&Be(this,at,ra).call(this),this.updateResult(),n&&(p(this,je)!==o||Ar(this.options.enabled,p(this,je))!==Ar(r.enabled,p(this,je))||wo(this.options.staleTime,p(this,je))!==wo(r.staleTime,p(this,je)))&&Be(this,at,td).call(this);let a=Be(this,at,rd).call(this);n&&(p(this,je)!==o||Ar(this.options.enabled,p(this,je))!==Ar(r.enabled,p(this,je))||a!==p(this,An))&&Be(this,at,od).call(this,a);}getOptimisticResult(t){let r=p(this,Wr).getQueryCache().build(p(this,Wr),t),o=this.createResult(r,t);return Ig(this,o)&&(A(this,Ir,o),A(this,os,this.options),A(this,gi,p(this,je).state)),o}getCurrentResult(){return p(this,Ir)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&p(this,tn).status==="pending"&&p(this,tn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){p(this,ss).add(t);}getCurrentQuery(){return p(this,je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=p(this,Wr).defaultQueryOptions(t),o=p(this,Wr).getQueryCache().build(p(this,Wr),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Be(this,at,ra).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),p(this,Ir)))}createResult(t,r){let o=p(this,je),n=this.options,a=p(this,Ir),i=p(this,gi),s=p(this,os),m=t!==o?t.state:p(this,oa),{state:u}=t,y={...u},S=false,g;if(r._optimisticResults){let x=this.hasListeners(),W=!x&&Wp(t,r),V=x&&Ep(t,o,r,n);(W||V)&&(y={...y,...ed(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(y.fetchStatus="idle");}let{error:b,errorUpdatedAt:w,status:h}=y;g=y.data;let k=false;if(r.placeholderData!==void 0&&g===void 0&&h==="pending"){let x;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(x=a.data,k=true):x=typeof r.placeholderData=="function"?r.placeholderData(p(this,is)?.state.data,p(this,is)):r.placeholderData,x!==void 0&&(h="success",g=Xs(a?.data,x,r),S=true);}if(r.select&&g!==void 0&&!k)if(a&&g===i?.data&&r.select===p(this,na))g=p(this,ns);else try{A(this,na,r.select),g=r.select(g),g=Xs(a?.data,g,r),A(this,ns,g),A(this,Bn,null);}catch(x){A(this,Bn,x);}p(this,Bn)&&(b=p(this,Bn),g=p(this,ns),w=Date.now(),h="error");let c=y.fetchStatus==="fetching",d=h==="pending",f=h==="error",R=d&&c,_=g!==void 0,C={status:h,fetchStatus:y.fetchStatus,isPending:d,isSuccess:h==="success",isError:f,isInitialLoading:R,isLoading:R,data:g,dataUpdatedAt:y.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:c,isRefetching:c&&!d,isLoadingError:f&&!_,isPaused:y.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:f&&_,isStale:dd(t,r),refetch:this.refetch,promise:p(this,tn),isEnabled:Ar(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let x=C.data!==void 0,W=C.status==="error"&&!x,V=q=>{W?q.reject(C.error):x&&q.resolve(C.data);},O=()=>{let q=A(this,tn,C.promise=ea());V(q);},P=p(this,tn);switch(P.status){case "pending":t.queryHash===o.queryHash&&V(P);break;case "fulfilled":(W||C.data!==P.value)&&O();break;case "rejected":(!W||C.error!==P.reason)&&O();break}}return C}updateResult(){let t=p(this,Ir),r=this.createResult(p(this,je),this.options);if(A(this,gi,p(this,je).state),A(this,os,this.options),p(this,gi).data!==void 0&&A(this,is,p(this,je)),pl(r,t))return;A(this,Ir,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!p(this,ss).size)return true;let i=new Set(a??p(this,ss));return this.options.throwOnError&&i.add("error"),Object.keys(p(this,Ir)).some(s=>{let l=s;return p(this,Ir)[l]!==t[l]&&i.has(l)})};Be(this,at,zp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Be(this,at,nd).call(this);}},Wr=new WeakMap,je=new WeakMap,oa=new WeakMap,Ir=new WeakMap,gi=new WeakMap,os=new WeakMap,tn=new WeakMap,Bn=new WeakMap,na=new WeakMap,ns=new WeakMap,is=new WeakMap,yi=new WeakMap,bi=new WeakMap,An=new WeakMap,ss=new WeakMap,at=new WeakSet,ra=function(t){Be(this,at,ad).call(this);let r=p(this,je).fetch(this.options,t);return t?.throwOnError||(r=r.catch(rr)),r},td=function(){Be(this,at,id).call(this);let t=wo(this.options.staleTime,p(this,je));if(Bo.isServer()||p(this,Ir).isStale||!Js(t))return;let o=cl(p(this,Ir).dataUpdatedAt,t)+1;A(this,yi,Lo.setTimeout(()=>{p(this,Ir).isStale||this.updateResult();},o));},rd=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,je)):this.options.refetchInterval)??false},od=function(t){Be(this,at,sd).call(this),A(this,An,t),!(Bo.isServer()||Ar(this.options.enabled,p(this,je))===false||!Js(p(this,An))||p(this,An)===0)&&A(this,bi,Lo.setInterval(()=>{(this.options.refetchIntervalInBackground||Zi.isFocused())&&Be(this,at,ra).call(this);},p(this,An)));},nd=function(){Be(this,at,td).call(this),Be(this,at,od).call(this,Be(this,at,rd).call(this));},id=function(){p(this,yi)!==void 0&&(Lo.clearTimeout(p(this,yi)),A(this,yi,void 0));},sd=function(){p(this,bi)!==void 0&&(Lo.clearInterval(p(this,bi)),A(this,bi,void 0));},ad=function(){let t=p(this,Wr).getQueryCache().build(p(this,Wr),this.options);if(t===p(this,je))return;let r=p(this,je);A(this,je,t),A(this,oa,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},zp=function(t){Tt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(p(this,Ir));}),p(this,Wr).getQueryCache().notify({query:p(this,je),type:"observerResultsUpdated"});});},Mp);function Rg(e,t){return Ar(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function Wp(e,t){return Rg(e,t)||e.state.data!==void 0&&ld(e,t,t.refetchOnMount)}function ld(e,t,r){if(Ar(t.enabled,e)!==false&&wo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&dd(e,t)}return false}function Ep(e,t,r,o){return (e!==t||Ar(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&dd(e,r)}function dd(e,t){return Ar(t.enabled,e)!==false&&e.isStaleByTime(wo(t.staleTime,e))}function Ig(e,t){return !pl(e.getCurrentResult(),t)}function ud(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,m=async()=>{let u=false,y=b=>{vp(b,()=>t.signal,()=>u=true);},S=ml(t.options,t.fetchOptions),g=async(b,w,h)=>{if(u)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);let c=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:h?"backward":"forward",meta:t.options.meta};return y(_),_})(),d=await S(c),{maxPages:f}=t.options,R=h?Ip:Rp;return {pages:R(b.pages,d,f),pageParams:R(b.pageParams,w,f)}};if(n&&a.length){let b=n==="backward",w=b?vg:Up,h={pages:a,pageParams:i},k=w(o,h);s=await g(h,k,b);}else {let b=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:Up(o,s);if(l>0&&w==null)break;s=await g(s,w),l++;}while(l<b)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=m;}}}function Up(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 vg(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var ia,Ao,wr,Ci,Wo,Wn,Hp,Np=(Hp=class extends yl{constructor(t){super();X(this,Wo);X(this,ia);X(this,Ao);X(this,wr);X(this,Ci);A(this,ia,t.client),this.mutationId=t.mutationId,A(this,wr,t.mutationCache),A(this,Ao,[]),this.state=t.state||Pg(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){p(this,Ao).includes(t)||(p(this,Ao).push(t),this.clearGcTimeout(),p(this,wr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){A(this,Ao,p(this,Ao).filter(r=>r!==t)),this.scheduleGc(),p(this,wr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){p(this,Ao).length||(this.state.status==="pending"?this.scheduleGc():p(this,wr).remove(this));}continue(){return p(this,Ci)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Be(this,Wo,Wn).call(this,{type:"continue"});},o={client:p(this,ia),meta:this.options.meta,mutationKey:this.options.mutationKey};A(this,Ci,gl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Be(this,Wo,Wn).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Be(this,Wo,Wn).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(this,wr).canRun(this)}));let n=this.state.status==="pending",a=!p(this,Ci).canStart();try{if(n)r();else {Be(this,Wo,Wn).call(this,{type:"pending",variables:t,isPaused:a}),p(this,wr).config.onMutate&&await p(this,wr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Be(this,Wo,Wn).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await p(this,Ci).start();return await p(this,wr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await p(this,wr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Be(this,Wo,Wn).call(this,{type:"success",data:i}),i}catch(i){try{await p(this,wr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await p(this,wr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Be(this,Wo,Wn).call(this,{type:"error",error:i}),i}finally{p(this,wr).runNext(this);}}},ia=new WeakMap,Ao=new WeakMap,wr=new WeakMap,Ci=new WeakMap,Wo=new WeakSet,Wn=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),Tt.batch(()=>{p(this,Ao).forEach(o=>{o.onMutationUpdate(t);}),p(this,wr).notify({mutation:this,type:"updated",action:t});});},Hp);function Pg(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var rn,So,sa,jp,$p=(jp=class extends Do{constructor(t={}){super();X(this,rn);X(this,So);X(this,sa);this.config=t,A(this,rn,new Set),A(this,So,new Map),A(this,sa,0);}build(t,r,o){let n=new Np({client:t,mutationCache:this,mutationId:++Ps(this,sa)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){p(this,rn).add(t);let r=bl(t);if(typeof r=="string"){let o=p(this,So).get(r);o?o.push(t):p(this,So).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(p(this,rn).delete(t)){let r=bl(t);if(typeof r=="string"){let o=p(this,So).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&p(this,So).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=bl(t);if(typeof r=="string"){let n=p(this,So).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=bl(t);return typeof r=="string"?p(this,So).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Tt.batch(()=>{p(this,rn).forEach(t=>{this.notify({type:"removed",mutation:t});}),p(this,rn).clear(),p(this,So).clear();});}getAll(){return Array.from(p(this,rn))}find(t){let r={exact:true,...t};return this.getAll().find(o=>ul(r,o))}findAll(t={}){return this.getAll().filter(r=>ul(t,r))}notify(t){Tt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Tt.batch(()=>Promise.all(t.map(r=>r.continue().catch(rr))))}},rn=new WeakMap,So=new WeakMap,sa=new WeakMap,jp);function bl(e){return e.options.scope?.id}var Eo,qp,Qp=(qp=class extends Do{constructor(t={}){super();X(this,Eo);this.config=t,A(this,Eo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??Zs(n,r),i=this.get(a);return i||(i=new Bp({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){p(this,Eo).has(t.queryHash)||(p(this,Eo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=p(this,Eo).get(t.queryHash);r&&(t.destroy(),r===t&&p(this,Eo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Tt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return p(this,Eo).get(t)}getAll(){return [...p(this,Eo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>dl(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>dl(t,o)):r}notify(t){Tt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Tt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Tt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Eo=new WeakMap,qp);var jt,En,Mn,as,ls,zn,cs,ds,Kp,pd=(Kp=class{constructor(e={}){X(this,jt);X(this,En);X(this,Mn);X(this,as);X(this,ls);X(this,zn);X(this,cs);X(this,ds);A(this,jt,e.queryCache||new Qp),A(this,En,e.mutationCache||new $p),A(this,Mn,e.defaultOptions||{}),A(this,as,new Map),A(this,ls,new Map),A(this,zn,0);}mount(){Ps(this,zn)._++,p(this,zn)===1&&(A(this,cs,Zi.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,jt).onFocus());})),A(this,ds,ts.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,jt).onOnline());})));}unmount(){var e,t;Ps(this,zn)._--,p(this,zn)===0&&((e=p(this,cs))==null||e.call(this),A(this,cs,void 0),(t=p(this,ds))==null||t.call(this),A(this,ds,void 0));}isFetching(e){return p(this,jt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return p(this,En).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,jt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=p(this,jt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(wo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return p(this,jt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=p(this,jt).get(o.queryHash)?.state.data,i=xp(t,a);if(i!==void 0)return p(this,jt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return Tt.batch(()=>p(this,jt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,jt).get(t.queryHash)?.state}removeQueries(e){let t=p(this,jt);Tt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=p(this,jt);return Tt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Tt.batch(()=>p(this,jt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(rr).catch(rr)}invalidateQueries(e,t={}){return Tt.batch(()=>(p(this,jt).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=Tt.batch(()=>p(this,jt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(rr)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(rr)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=p(this,jt).build(this,t);return r.isStaleByTime(wo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rr).catch(rr)}fetchInfiniteQuery(e){return e.behavior=ud(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rr).catch(rr)}ensureInfiniteQueryData(e){return e.behavior=ud(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ts.isOnline()?p(this,En).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(this,jt)}getMutationCache(){return p(this,En)}getDefaultOptions(){return p(this,Mn)}setDefaultOptions(e){A(this,Mn,e);}setQueryDefaults(e,t){p(this,as).set(ci(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...p(this,as).values()],r={};return t.forEach(o=>{ui(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){p(this,ls).set(ci(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...p(this,ls).values()],r={};return t.forEach(o=>{ui(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...p(this,Mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Zs(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===di&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...p(this,Mn).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){p(this,jt).clear(),p(this,En).clear();}},jt=new WeakMap,En=new WeakMap,Mn=new WeakMap,as=new WeakMap,ls=new WeakMap,zn=new WeakMap,cs=new WeakMap,ds=new WeakMap,Kp);var md=Un__namespace.createContext(void 0),fd=e=>{let t=Un__namespace.useContext(md);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},hd=({client:e,children:t})=>(Un__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(md.Provider,{value:e,children:t}));var Gp=Un__namespace.createContext(false),Yp=()=>Un__namespace.useContext(Gp);Gp.Provider;function Og(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Dg=Un__namespace.createContext(Og()),Jp=()=>Un__namespace.useContext(Dg);var Xp=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?fl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},em=e=>{Un__namespace.useEffect(()=>{e.clearReset();},[e]);},tm=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||fl(r,[e.error,o]));var rm=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));}},om=(e,t)=>e.isLoading&&e.isFetching&&!t,nm=(e,t)=>e?.suspense&&t.isPending,gd=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function im(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=Yp(),n=Jp(),a=fd(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",rm(i),Xp(i,n,s),em(n);let l=!a.getQueryCache().get(i.queryHash),[m]=Un__namespace.useState(()=>new t(a,i)),u=m.getOptimisticResult(i),y=!o&&e.subscribed!==false;if(Un__namespace.useSyncExternalStore(Un__namespace.useCallback(S=>{let g=y?m.subscribe(Tt.batchCalls(S)):rr;return m.updateResult(),g},[m,y]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),Un__namespace.useEffect(()=>{m.setOptions(i);},[i,m]),nm(i,u))throw gd(i,m,n);if(tm({result:u,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,u),i.experimental_prefetchInRender&&!Bo.isServer()&&om(u,o)&&(l?gd(i,m,n):s?.promise)?.catch(rr).finally(()=>{m.updateResult();}),i.notifyOnChangeProps?u:m.trackResult(u)}function on(e,t){return im(e,cd)}var ms=new Map;function sm({width:e,height:t,borderRadius:r,color:o}){let n=Un.useRef(new reactNative.Animated.Value(.3)).current;return Un.useEffect(()=>{let a=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 a.start(),()=>a.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function Nn({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=F(),[m,u]=Un.useState(false),[y,S]=Un.useState(false),[g,b]=Un.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let R=ms.get(e);return R?{uri:e,xml:R}:null}),w=e?.toLowerCase().endsWith(".svg"),h=w&&e&&g?.uri===e?g.xml:null;Un.useEffect(()=>{u(false),S(false);},[e]),Un.useEffect(()=>{if(!w||!e)return;if(ms.has(e)){b({uri:e,xml:ms.get(e)});return}let R=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{R||(ms.set(e,_),b({uri:e,xml:_}));}).catch(()=>{R||u(true);}),()=>{R=true;}},[e,w]);let k=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:k},s]});let c={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},d=t-n*2,f=r-n*2;return m?jsxRuntime.jsx(reactNative.View,{style:[c,{backgroundColor:i||k}]}):w?jsxRuntime.jsxs(reactNative.View,{style:c,children:[!!!h&&jsxRuntime.jsx(sm,{width:d,height:f,borderRadius:o,color:k}),h?jsxRuntime.jsx(Et.SvgXml,{xml:h,width:d,height:f,onError:()=>u(true)}):jsxRuntime.jsx(Et.SvgUri,{uri:e,width:d,height:f,onError:()=>u(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:c,children:[!y&&jsxRuntime.jsx(sm,{width:d,height:f,borderRadius:o,color:k}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:d,height:f},resizeMode:"contain",onLoad:()=>S(true),onError:()=>u(true)})]})}function Cd(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(ms.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{ms.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function vr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:m,balanceChainId:u,balanceTokenAddress:y,publishableKey:S,projectName:g,leftIcon:b,onLeftAction:w}){let{colors:h,fonts:k,components:c}=F(),[d,f]=Un.useState(null),[R,_]=Un.useState(false),T=Un.useState(()=>new reactNative.Animated.Value(0))[0];Un.useEffect(()=>{if(!R)return;let x=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(T,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(T,{toValue:0,duration:700,useNativeDriver:true})]));return x.start(),()=>x.stop()},[R,T]),Un.useEffect(()=>{if(!s||!l||!m||!u||!y||!S){f(null),_(false);return}let x=false;return _(true),Ma(l,m,u,y,S).then(W=>{if(x)return;let V=W.balance,O=null;V&&(V.amount_usd!=null&&V.amount_usd!==""?O=`$${V.amount_usd}`:O="$0.00"),f(O);}).catch(()=>{x||f(null);}).finally(()=>{x||_(false);}),()=>{x=true;}},[s,l,m,u,y,S]);let C=T.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Sr.header,children:[jsxRuntime.jsx(reactNative.View,{style:Sr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Sr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Os,{size:20,color:c.header.buttonColor,strokeWidth:2})}):b&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[Sr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:b}):jsxRuntime.jsx(reactNative.View,{style:Sr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Sr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Sr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Sr.title,{color:c.header.titleColor,fontFamily:k.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Sr.titleBadge,{backgroundColor:h.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Sr.titleBadgeText,{color:h.foregroundMuted,fontFamily:k.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[Sr.balanceText,{color:h.foregroundMuted,fontFamily:k.regular}],children:t}):null,s&&(R?jsxRuntime.jsx(reactNative.Animated.View,{style:[Sr.balanceSkeleton,{backgroundColor:h.cardHover,opacity:C}]}):d!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Sr.balanceText,{color:h.foregroundMuted,fontFamily:k.regular}],children:[g?`${g} `:"","Balance: ",d]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Sr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,style:[Sr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ze,{size:20,color:c.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Sr.spacer})})]})}var Sr=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function or({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=F(),s=a??i.card,l=s.backShadowColor!=="transparent",m={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},u=[dm.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],y=[m,r];return jsxRuntime.jsxs(reactNative.View,{style:u,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[dm.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:y,children:e}):jsxRuntime.jsx(reactNative.View,{style:y,children:e})]})}var dm=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function la({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=F(),i=a.depositMenu.card,s=o?[...o].sort((l,m)=>l.position-m.position):[];return jsxRuntime.jsxs(or,{cardTokens:i,onPress:e,style:Mo.wrapper,contentStyle:Mo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Mo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Mo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(pc,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Mo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Mo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Mo.networkIcons,children:s.map((l,m)=>{let u=l.icon_urls.find(y=>y.format==="png")?.url||l.icon_urls.find(y=>y.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Mo.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:s.length-m}],children:jsxRuntime.jsx(Nn,{uri:te(u),width:20,height:20})},l.name)})})})]})}var Mo=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 da({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=F(),i=a.depositMenu.card;return jsxRuntime.jsxs(or,{cardTokens:i,onPress:e,style:nn.wrapper,contentStyle:nn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:nn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[nn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Vi,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:nn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[nn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:nn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:nn.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(m=>m.format==="png")?.url||s.icon_urls.find(m=>m.format==="svg")?.url;return jsxRuntime.jsx(Nn,{uri:te(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var nn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function ua({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=F(),i=a.depositMenu.card;return jsxRuntime.jsx(or,{cardTokens:i,onPress:e,style:sn.wrapper,contentStyle:sn.container,children:jsxRuntime.jsxs(reactNative.View,{style:sn.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[sn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(Dr,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[sn.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[sn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:sn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[sn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[sn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var sn=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 ma({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=F(),a=n.depositMenu.card;return jsxRuntime.jsxs(or,{cardTokens:a,onPress:e,style:zo.wrapper,contentStyle:zo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:zo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[zo.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsxRuntime.jsx(Oa,{size:20,color:a.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:zo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[zo.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[zo.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:zo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:zo.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[zo.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var zo=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var fm=1e4,hm=2500,gm=3e3,ym=6e4;function fa(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:m,setDepositExecutions:u,setTrackedExecutions:y,setLatestExecution:S,setShowStatusSheet:g,onDepositSuccess:b,onExecutionsChange:w,onDepositError:h}=e,[k,c]=Un.useState(false),[d,f]=Un.useState(false);return Un.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;c(false),t==="auto_ui"&&f(false);let _=setTimeout(()=>{c(true),t==="auto_ui"&&f(true);},fm);return ()=>clearTimeout(_)},[t,r,o]),Un.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-ym),T=setInterval(async()=>{try{let W=[...(await Jo(n,a)).data??[]].sort((O,P)=>{let q=O.created_at?new Date(O.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-q}),V=null;for(let O of W){let P=O.created_at?new Date(O.created_at):null;if(!P||P<=_)continue;let q=m.get(O.id);if(!q){V=O;break}if(["pending","waiting","delayed"].includes(q)&&O.status==="succeeded"){V=O;break}}if(V){let O=V;u(P=>{let q=P.findIndex(N=>N.id===O.id);if(q>=0){let N=[...P];return N[q]=O,N}return [...P,O]}),y(P=>{let q=new Map(P);return q.set(O.id,O.status),q}),S(O),g(!0),O.status==="succeeded"&&b?.({message:"Deposit completed successfully",executionId:O.id}),w?.([...l,O]);}}catch(C){h?.({message:"Failed to check deposit status",error:C});}},hm);return ()=>clearInterval(T)},[n,a,i,m,l,w,b,h]),Un.useEffect(()=>{if(!k||!s)return;let _=async()=>{try{await Ba(s,a);}catch{}};_();let T=setInterval(_,gm);return ()=>clearInterval(T)},[k,s,a]),{pollingEnabled:k,showWaitingUi:d,handleIveDeposited:()=>{c(true),f(true);}}}function ys({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=F(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",m=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[Cm.container,{width:t,height:t}],children:[jsxRuntime.jsx($g__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[Cm.logoContainer,{width:o+12,height:o+12,backgroundColor:m,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(Nn,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var Cm=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function km(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Gg(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function bs({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:m}){let{colors:u,fonts:y,components:S}=F(),[g,b]=Un.useState(false),w=t==="pending"||t==="waiting"||t==="delayed",h=t==="succeeded",k=()=>{o&&reactNative.Linking.openURL(o);},c=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(pt,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:m,children:jsxRuntime.jsxs(reactNative.View,{style:Vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Vt.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ze,{size:20,color:S.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Vt.iconContainer,children:w?jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(r)},style:Vt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Vt.tokenIconFill,{backgroundColor:u.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(r)},style:Vt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Vt.tokenIconLarge,{backgroundColor:u.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Vt.statusBadge,{backgroundColor:S.container.iconBackgroundColor}],children:jsxRuntime.jsx(ze,{size:16,color:S.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.title,{color:S.container.titleColor,fontFamily:y.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Vt.amount,{color:S.container.titleColor,fontFamily:y.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Vt.date,{color:S.container.subtitleColor,fontFamily:y.regular}],children:Gg(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.subtitle,{color:S.container.subtitleColor,fontFamily:y.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),h&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Vt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Vt.divider,{backgroundColor:u.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Vt.detailsToggle,onPress:()=>b(!g),children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.detailsToggleText,{color:S.container.actionTitle,fontFamily:y.medium}],children:g?"See less":"See more details"}),g?jsxRuntime.jsx(_o,{size:18,color:S.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Dt,{size:18,color:S.container.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsxs(reactNative.View,{style:Vt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Vt.txButton,{backgroundColor:S.card.backgroundColor,borderColor:u.border}],onPress:k,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.txLabel,{color:S.card.titleColor,fontFamily:y.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.txHash,{color:S.card.subtitleColor,fontFamily:y.regular}],children:km(o)}),jsxRuntime.jsx(xo,{size:16,color:S.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Vt.txButton,{backgroundColor:S.card.backgroundColor,borderColor:u.border}],onPress:c,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.txLabel,{color:S.card.titleColor,fontFamily:y.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.txHash,{color:S.card.subtitleColor,fontFamily:y.regular}],children:km(n)}),jsxRuntime.jsx(xo,{size:16,color:S.card.actionColor,strokeWidth:2})]})]})]})]})})}var Vt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function _l({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=F();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[ki.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ki.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[ki.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[ki.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mc,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ki.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ki.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[ki.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var ki=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var ha=(e,t)=>`${t}:${e}`,ny=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Il({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:u="auto_ui",onExecutionsChange:y,onDepositSuccess:S,onDepositError:g,borderTopLeftRadius:b,borderTopRightRadius:w,sheetBorderRadius:h}){let{colors:k,fonts:c,components:d}=F(),f=s&&l?`${s}:${l}`:"solana:mainnet",[R,_]=Un.useState("USDC"),[T,C]=Un.useState(f),[x,W]=Un.useState([]),[V,O]=Un.useState(true),[P,q]=Un.useState([]),[N,ue]=Un.useState(true),[Le,ve]=Un.useState(false),[ee,Oe]=Un.useState(false),[fe,Re]=Un.useState(false),[We,be]=Un.useState(false),[oe,De]=Un.useState([]),[dt,Ue]=Un.useState(new Map),[Qe]=Un.useState(()=>new Date),[Ke,Ee]=Un.useState(null),[Je,Ce]=Un.useState(false),[re,ae]=Un.useState(null),[tt,rt]=Un.useState(false),Me=new Map;P.forEach(M=>{M.chains.forEach(Z=>{let ye=`${Z.chain_type}:${Z.chain_id}`;Me.has(ye)||Me.set(ye,Z);});});let he=Array.from(Me.values()),ne=ny(T),qt=he.find(M=>M.chain_type===ne.chainType&&M.chain_id===ne.chainId)?.chain_type||"ethereum",pe=Yo(x,qt),se=pe?.address||"",we=Un.useRef(false);Un.useEffect(()=>{async function M(){try{ue(!0),Ee(null);let ye=await ei(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(q(ye.data),ye.data.length>0&&!we.current){we.current=!0;let de,mt;if(s&&l)if(m)for(let D of ye.data){let Or=D.chains.find(U=>U.chain_type===s&&U.chain_id===l&&U.token_address.toLowerCase()===m.toLowerCase());if(Or){de=D,mt=Or;break}}else for(let D of ye.data){let Or=D.chains.find(U=>U.chain_type===s&&U.chain_id===l);if(Or){de=D,mt=Or;break}}if(!de&&a)for(let D of ye.data){let Or=D.chains.find(U=>U.token_address.toLowerCase()===a.toLowerCase());if(Or){de=D,mt=Or;break}}de||(de=ye.data.find(D=>D.symbol==="USDC"),de&&de.chains.length>0&&(mt=de.chains[0])),de||(de=ye.data.find(D=>D.symbol==="USDT"),de&&de.chains.length>0&&(mt=de.chains[0])),de||(de=ye.data[0],de.chains.length>0&&(mt=de.chains[0])),de&&_(de.symbol),mt&&C(ha(mt.chain_id,mt.chain_type));}}catch(Z){console.error("Error fetching supported tokens:",Z),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:Z});}finally{ue(false);}}M();},[t,g,s,l,m,a,n,o]),Un.useEffect(()=>{async function M(){try{O(!0),Ee(null);let Z=await Go({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);W(Z.data);}catch(Z){console.error("Error fetching wallets:",Z),Ee("Failed to load wallets"),g?.({message:"Failed to load wallets",error:Z});}finally{O(false);}}M();},[e,r,o,n,a,t,g]);let yt=pe?.id??"",{showWaitingUi:ot,handleIveDeposited:ce}=fa({depositConfirmationMode:u,depositAddress:se,chain:T,externalUserId:e,publishableKey:t,modalOpenedAt:Qe,depositWalletId:yt,depositExecutions:oe,trackedExecutions:dt,setDepositExecutions:De,setTrackedExecutions:Ue,setLatestExecution:ae,setShowStatusSheet:Ce,onDepositSuccess:S,onExecutionsChange:y,onDepositError:g});Un.useEffect(()=>{if(!P.length)return;let M=P.find(ye=>ye.symbol===R);if(!M||M.chains.length===0)return;if(!M.chains.some(ye=>ha(ye.chain_id,ye.chain_type)===T)){let ye=M.chains[0];C(ha(ye.chain_id,ye.chain_type));}},[R,P,T]);let Ye=P.find(M=>M.symbol===R),nr=Ye?.chains||[],ut=nr.find(M=>ha(M.chain_id,M.chain_type)===T),Fr=async()=>{if(se)try{reactNative.Clipboard.setString(se),ve(!0),setTimeout(()=>ve(!1),2e3);}catch(M){console.error("Failed to copy:",M);}},zr=ut?.estimated_price_impact_percent??0,ar=ut?.max_slippage_percent??.25,E=ut?.minimum_deposit_amount_usd??3;if(N)return jsxRuntime.jsxs(reactNative.View,{style:L.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Loading currencies..."})]});if(Ke&&P.length===0)return jsxRuntime.jsxs(reactNative.View,{style:L.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:k.error,fontFamily:c.regular}],children:Ke}),jsxRuntime.jsx(reactNative.Text,{style:[L.errorHint,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Please check your network connection and try again."})]});let B=()=>jsxRuntime.jsxs(pt,{visible:fe,onClose:()=>Re(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.tokenSelector?.borderTopLeftRadius??b,borderTopRightRadius:h?.tokenSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:c.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Re(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(Ze,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(it,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:P.map(M=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(M.symbol),Re(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:R===M.symbol?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(M,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:d.card.titleColor,fontFamily:c.medium}],children:M.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:c.regular}],children:[M.chains.length," network",M.chains.length!==1?"s":""," available"]})]}),R===M.symbol&&jsxRuntime.jsx(ze,{size:20,color:k.primary,strokeWidth:2})]},M.symbol))})]}),Se=()=>jsxRuntime.jsxs(pt,{visible:We,onClose:()=>be(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.chainSelector?.borderTopLeftRadius??b,borderTopRightRadius:h?.chainSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:c.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>be(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(Ze,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(it,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:nr.map(M=>{let Z=ha(M.chain_id,M.chain_type),ye=T===Z;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{C(Z),be(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:ye?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(M,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:d.card.titleColor,fontFamily:c.medium}],children:M.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:c.regular}],children:["Min deposit: $",M.minimum_deposit_amount_usd]})]}),ye&&jsxRuntime.jsx(ze,{size:20,color:k.primary,strokeWidth:2})]},Z)})})]});return jsxRuntime.jsxs(reactNative.View,{style:L.container,children:[jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.selectorLabel,{color:d.card.labelColor,fontFamily:c.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Re(true),style:[L.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[Ye&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(Ye,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:d.card.titleColor,fontFamily:c.medium}],children:R}),jsxRuntime.jsx(Dt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[L.selectorLabel,{color:d.card.labelColor,fontFamily:c.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[L.minDeposit,{fontFamily:c.regular}],children:["($",E," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>be(true),style:[L.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[ut&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(ut,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:d.card.titleColor,fontFamily:c.medium}],numberOfLines:1,children:ut?.chain_name||"Select network"}),jsxRuntime.jsx(Dt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:L.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[L.qrWrapper,{backgroundColor:k.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:V?jsxRuntime.jsxs(reactNative.View,{style:L.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Loading..."})]}):se?jsxRuntime.jsx(ys,{value:se,size:160,logoUri:te(ke(ut,"png")||Kt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:L.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:k.error,fontFamily:c.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:L.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:L.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressLabel,{color:d.card.labelColor,fontFamily:c.medium}],children:"Deposit Address"}),Le&&jsxRuntime.jsxs(reactNative.View,{style:L.copiedIndicator,children:[jsxRuntime.jsx(ze,{size:14,color:k.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[L.copiedText,{color:k.success,fontFamily:c.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(or,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!V&&se?Fr:void 0,contentStyle:L.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressText,{color:d.card.titleColor,fontFamily:c.regular}],numberOfLines:2,children:V?"Loading...":se||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:L.addressCopyIcon,children:jsxRuntime.jsx(Qo,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Oe(!ee),style:L.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Dr,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:c.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:L.chevronContainer,children:ee?jsxRuntime.jsx(_o,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Dt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),ee&&jsxRuntime.jsxs(reactNative.View,{style:L.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(wn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:c.regular}],children:["Price impact: ",zr.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Bi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:c.regular}],children:["Slippage: Auto \u2022 ",ar.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Bi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Pa,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:c.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(_l,{depositConfirmationMode:u,depositAddress:se,showWaitingUi:ot,latestExecution:re,onIveDeposited:ce}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:L.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[L.termsText,{color:k.primary,fontFamily:c.regular}],children:"Terms apply"})}),B(),Se(),jsxRuntime.jsxs(pt,{visible:tt,onClose:()=>rt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:h?.infoSheet?.borderTopLeftRadius??b,borderTopRightRadius:h?.infoSheet?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:c.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(Ze,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(wn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:d.card.titleColor,fontFamily:c.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:d.card.titleColor,fontFamily:c.medium}],children:[zr.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:d.card.descriptionColor,fontFamily:c.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:d.card.titleColor,fontFamily:c.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:d.card.titleColor,fontFamily:c.medium}],children:[ar.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:d.card.descriptionColor,fontFamily:c.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),re&&jsxRuntime.jsx(bs,{visible:Je,status:re.status,tokenIconUrl:re.destination_token_metadata?.icon_urls?.find(M=>M.format==="png")?.url||re.destination_token_metadata?.icon_url||ke(Ye,"png"),explorerUrl:re.explorer_url,completionExplorerUrl:re.destination_explorer_url,date:re.created_at?new Date(re.created_at):void 0,amountUsd:re.source_amount_usd?parseFloat(re.source_amount_usd):void 0,onClose:()=>Ce(false),borderTopLeftRadius:h?.depositStatus?.borderTopLeftRadius??b,borderTopRightRadius:h?.depositStatus?.borderTopRightRadius??w})]})}var L=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function vl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=F();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ti.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ti.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ti.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(e,"png"))},style:Ti.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ti.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ti.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ti.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(ze,{size:16,color:o.primary,strokeWidth:2})]})}var Ti=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 ya({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=F();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Rm.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Rm.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(vl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Rm=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Fl({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:u}=F(),[y,S]=Un.useState(""),g=o.map(f=>r.find(R=>R.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),b=r.filter(f=>!o.includes(f.currency_code.toLowerCase())),w=f=>{if(!y)return f;let R=y.toLowerCase();return f.filter(_=>_.name.toLowerCase().includes(R)||_.currency_code.toLowerCase().includes(R))},h=w(g),k=w(b),c=f=>{a(f),t(false),S("");},d=()=>{t(false),S("");};return jsxRuntime.jsxs(pt,{visible:e,onClose:d,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(vr,{title:"Currency",showBack:false,onClose:d}),jsxRuntime.jsx(reactNative.View,{style:xi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[xi.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:m.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],value:y,onChangeText:S,placeholder:"Search",placeholderTextColor:u.search.placeholderColor})}),jsxRuntime.jsx(it,{style:xi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:xi.listContent,children:[jsxRuntime.jsx(ya,{title:"Popular currencies",currencies:h,selectedCurrency:n,onSelect:c}),h.length>0&&k.length>0&&jsxRuntime.jsx(reactNative.View,{style:xi.sectionSpacer}),jsxRuntime.jsx(ya,{title:"All currencies",currencies:k,selectedCurrency:n,onSelect:c}),h.length===0&&k.length===0&&jsxRuntime.jsx(reactNative.View,{style:xi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[xi.noResultsText,{color:u.container.subtitleColor,fontFamily:m.regular}],children:"No currencies found"})})]})})]})}var xi=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 zd(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 Vl({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:m,onDepositError:u,borderTopLeftRadius:y,borderTopRightRadius:S,sheetBorderRadius:g}){let{colors:b,fonts:w,components:h}=F(),[k,c]=Un.useState(""),[d,f]=Un.useState("usd"),[R,_]=Un.useState(false),[T,C]=Un.useState(false),[x,W]=Un.useState([]),[V,O]=Un.useState(false),[P,q]=Un.useState(null),[N,ue]=Un.useState(null),[Le,ve]=Un.useState("amount"),[ee,Oe]=Un.useState(null),[fe,Re]=Un.useState(true),[We,be]=Un.useState(null),[oe,De]=Un.useState(false),dt=Un.useRef(null),Ue=Un.useRef(false);Un.useEffect(()=>{dt.current=ee;},[ee]),Un.useEffect(()=>{Ue.current=oe;},[oe]);let[Qe,Ke]=Un.useState([]),[Ee,Je]=Un.useState(true),[Ce,re]=Un.useState(60),[ae,tt]=Un.useState([]),[rt,Me]=Un.useState([]),[he,ne]=Un.useState(null),[le,qt]=Un.useState(null),[pe,se]=Un.useState(true),[we,yt]=Un.useState(null),[ot,ce]=Un.useState(false),[Ye,nr]=Un.useState(null),[ut,Fr]=Un.useState(false),[zr,ar]=Un.useState(false),[E,B]=Un.useState(false),[Se,M]=Un.useState(null),Z=r??Le,ye=Un.useRef(null),de=ae.find(Q=>Q.currency_code.toLowerCase()===d.toLowerCase()),mt=Un.useCallback(Q=>{ve(Q),Q==="quotes"?o?.(Q,x.length):o?.(Q);},[x.length,o]);Un.useEffect(()=>{async function Q(){try{let ge=await zs();qt(ge);}catch(ge){console.error("Error fetching user IP:",ge);}finally{se(false);}}Q();},[]),Un.useEffect(()=>{async function Q(){try{let ge=await Go({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);Ke(ge.data);}catch(ge){console.error("Error fetching wallets:",ge),q("Failed to load wallet addresses");}finally{Je(false);}}Q();},[e,a,i,s,l,t]);let D=n||he?.symbol.toUpperCase()||"USDC",Or=Ei(he?.icon_urls,"png")||he?.icon_url,U=Ei(he?.chain_icon_urls,"png")||he?.chain_icon_url;Un.useEffect(()=>{async function Q(){try{let ge=await Tc(t);tt(ge.data),Me(ge.preferred||[]);}catch(ge){console.error("Error fetching fiat currencies:",ge);}}Q();},[t]),Un.useEffect(()=>{if(R||ae.length===0||!le?.alpha2)return;let Q=le.alpha2.toUpperCase(),ge=ae.find(Ot=>Ot.country_codes.includes(Q));if(ge)f(ge.currency_code.toLowerCase()),!k&&!T&&c(String(ge.default_amount??100));else if(!k&&!T){let Ot=ae.find(mo=>mo.currency_code.toLowerCase()==="usd");Ot&&c(String(Ot.default_amount??100));}},[ae,le,R,k,T]),Un.useEffect(()=>{if(ae.length!==0){if(ye.current!==null&&ye.current!==d){let Q=ae.find(ge=>ge.currency_code.toLowerCase()===d.toLowerCase());Q&&c(String(Q.default_amount??100));}ye.current=d;}},[d,ae]),Un.useEffect(()=>{async function Q(){try{let ge=await Cc({chain_type:i||"",chain_id:s||"",token_address:l||""},t);ne(ge);}catch(ge){console.error("Error fetching supported tokens:",ge);}}Q();},[i,s,l,t]),Un.useEffect(()=>{async function Q(){if(!(!l||!s||!i)&&!pe){ce(true);try{let ge=await kc({country_code:le?.alpha2?.toUpperCase()||"US",subdivision_code:le?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);yt(ge);}catch(ge){console.error("Error fetching default onramp token:",ge);}finally{ce(false);}}}Q();},[l,s,i,le,pe,t]),Un.useEffect(()=>{let Q=parseFloat(k);if(isNaN(Q)||Q<=0){W([]),ue(null);return}if(!we||ot){W([]),Oe(null);return}let ge=ae.find(mo=>mo.currency_code.toLowerCase()===d.toLowerCase());if(ge){if(Q<ge.minimum_amount){W([]),Oe(null),ue(`Minimum amount is ${zd(d)}${ge.minimum_amount.toLocaleString()}`);return}if(Q>ge.maximum_amount){W([]),Oe(null),ue(`Maximum amount is ${zd(d)}${ge.maximum_amount.toLocaleString()}`);return}}ue(null);let Ot=setTimeout(()=>{Rt(Q);},500);return ()=>clearTimeout(Ot)},[k,d,t,we,ot,ae]);let Rt=async Q=>{if(!we){q("Loading token information...");return}O(true),q(null);try{let ge={country_code:le?.alpha2?.toUpperCase()||"US",source_amount:Q.toString(),source_currency:d.toLowerCase(),destination_currency:we.destination_currency,destination_network:we.destination_network,subdivision_code:le?.state||void 0},Ot=await wc(ge,t);W(Ot.data);let mo=Ue.current,vs=dt.current;if(mo&&vs){let fo=Ot.data.find(bn=>bn.service_provider===vs.service_provider);if(fo){if(Oe(fo),Ot.data.length>0){let bn=Ot.data[0];We||be(bn.service_provider),Re(fo.service_provider===We);}}else if(Ot.data.length>0){let bn=Ot.data[0];Oe(bn),be(bn.service_provider),Re(!0),De(!1);}}else if(Ot.data.length>0){let fo=Ot.data[0];Oe(fo),be(fo.service_provider),Re(!0);}re(60);}catch(ge){console.error("Failed to fetch quotes:",ge),q("Failed to fetch quotes. Please try again."),W([]);}finally{O(false);}};Un.useEffect(()=>{if(x.length===0)return;let Q=setInterval(()=>{re(ge=>{if(ge<=1){let Ot=parseFloat(k);return !isNaN(Ot)&&Ot>0&&Rt(Ot),60}return ge-1});},1e3);return ()=>clearInterval(Q)},[x.length,k]);let bt=Q=>{(/^\d*\.?\d{0,2}$/.test(Q)||Q==="")&&(c(Q),C(true));},Ur=Q=>{c(Q.toString()),C(true);},Zt=async()=>{if(ee&&we)try{let Q=we.destination_token_metadata.chain_type,ge=Yo(Qe,Q);if(!ge?.address){q("Wallet address not available");return}let Ot={service_provider:ee.service_provider,country_code:ee.country_code?.toUpperCase()||le?.alpha2?.toUpperCase()||"US",source_currency:ee.source_currency,source_amount:k,destination_currency:ee.destination_currency,destination_network:ee.destination_network,wallet_address:ge.address,subdivision_code:le?.state||void 0},mo=await Sc(Ot,t);nr({provider:ee,sourceCurrency:d,sourceAmount:k,sessionUrl:mo.url}),M(mo.url),B(!0);}catch(Q){console.error("Failed to create session:",Q),q("Failed to start payment flow"),u?.({message:"Failed to start payment flow",error:Q});}},Oi=zd(d),po=()=>{B(false),mt("onramp"),m?.({message:"Payment flow completed"});},qo=()=>jsxRuntime.jsx(by,{visible:E,onClose:po,url:Se,providerName:ee?.service_provider_display_name||"Complete Payment",colors:b,fonts:w,borderTopLeftRadius:g?.webView?.borderTopLeftRadius??y,borderTopRightRadius:g?.webView?.borderTopRightRadius??S});return Z==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:$.amountViewContainer,children:[jsxRuntime.jsxs(it,{style:$.scrollContainer,contentContainerStyle:$.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:$.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Fr(true),style:[$.currencyButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.input.borderRadius,borderWidth:h.input.borderWidth,borderColor:h.input.borderColor}],children:[de&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(de,"png"))},style:$.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[$.currencyText,{color:h.card.titleColor,fontFamily:w.medium}],children:d.toUpperCase()}),jsxRuntime.jsx(Dt,{size:16,color:h.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Fl,{open:ut,onOpenChange:Fr,currencies:ae,preferredCurrencyCodes:rt,selectedCurrency:d,onSelectCurrency:Q=>{f(Q.toLowerCase()),_(true);},borderTopLeftRadius:g?.currencyModal?.borderTopLeftRadius??y,borderTopRightRadius:g?.currencyModal?.borderTopRightRadius??S}),jsxRuntime.jsx(reactNative.View,{style:$.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:$.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.currencySymbol,{color:h.container.titleColor,fontFamily:w.medium}],children:Oi}),jsxRuntime.jsx(reactNative.TextInput,{style:[$.amountInput,{color:h.container.titleColor,fontFamily:w.medium}],value:k,onChangeText:bt,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:b.foregroundMuted})]})}),de?.suggested_amounts&&de.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:$.quickAmounts,children:de.suggested_amounts.map(Q=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ur(Q),style:[$.quickAmountButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.button.borderRadius,borderWidth:parseFloat(k)===Q?2:h.button.borderWidth,borderColor:parseFloat(k)===Q?b.primary:h.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[$.quickAmountText,{color:h.card.titleColor,fontFamily:w.medium}],children:[Oi,Q.toLocaleString()]})},Q))}),N&&jsxRuntime.jsx(reactNative.Text,{style:[$.validationError,{color:b.error,fontFamily:w.regular}],children:N}),jsxRuntime.jsxs(reactNative.View,{style:$.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:$.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.providerLabel,{color:h.card.labelColor,fontFamily:w.medium}],children:"Provider"}),x.length>0&&!V&&jsxRuntime.jsxs(reactNative.Text,{style:[$.refreshText,{color:h.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",Ce,"s"]})]}),jsxRuntime.jsx(or,{cardTokens:h.depositCard.quoteProvider.card,onPress:V||x.length===0?void 0:()=>ar(true),contentStyle:reactNative.StyleSheet.flatten([$.providerButton,(V||x.length===0)&&$.disabled]),children:V?jsxRuntime.jsxs(reactNative.View,{style:$.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[$.loadingText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):ee?jsxRuntime.jsxs(reactNative.View,{style:$.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:$.providerInfo,children:[fe&&jsxRuntime.jsx(reactNative.Text,{style:[$.autoPickedText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:$.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Aa(ee.icon_urls,"png",ee.icon_url))},style:$.providerIconImage},`provider-${ee.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[$.providerName,{color:h.card.titleColor,fontFamily:w.medium}],children:ee.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[$.bestPriceText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:[ee.destination_amount.toFixed(2)," ",D]})]})]})]}),jsxRuntime.jsx(xr,{size:20,color:h.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[$.noProviderText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(k)>0?"No providers available":"Enter an amount to see providers"})}),P&&jsxRuntime.jsx(reactNative.Text,{style:[$.errorText,{color:b.error,fontFamily:w.regular}],children:P})]}),jsxRuntime.jsxs(pt,{visible:zr,onClose:()=>ar(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:g?.providerModal?.borderTopLeftRadius??y,borderTopRightRadius:g?.providerModal?.borderTopRightRadius??S,children:[jsxRuntime.jsx(vr,{title:"Select Provider",showBack:false,onClose:()=>ar(false)}),jsxRuntime.jsx(it,{style:$.providerModalList,contentContainerStyle:$.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:$.quotesList,children:x.map(Q=>{let ge=ee?.service_provider===Q.service_provider;return jsxRuntime.jsxs(or,{cardTokens:h.depositCard.quoteProvider.card,onPress:()=>{Oe(Q),De(true),Re(Q.service_provider===We),ar(false);},contentStyle:reactNative.StyleSheet.flatten([$.quoteItem,ge&&{borderWidth:2,borderColor:b.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:$.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Aa(Q.icon_urls,"png",Q.icon_url))},style:$.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[$.quoteName,{color:h.card.titleColor,fontFamily:w.medium}],children:Q.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:$.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[$.quoteAmount,{color:h.card.textRightColor,fontFamily:w.medium}],children:[Q.destination_amount.toFixed(2)," ",D]}),jsxRuntime.jsxs(reactNative.Text,{style:[$.quoteSource,{color:h.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",Oi,Q.total_fee.toFixed(2)]})]})]},Q.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[$.continueButtonContainer,{backgroundColor:b.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:V||Ee||!ee||parseFloat(k)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Zt,disabled:V||Ee||!ee||parseFloat(k)<=0,style:[$.continueButton,{backgroundColor:h.container.buttonColor,borderRadius:h.button.borderRadius,borderWidth:h.button.borderWidth,borderColor:h.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[$.continueButtonText,{color:h.container.buttonTitleColor,fontFamily:w.medium}],children:Ee?"Loading...":"Continue"})})})})]}),qo()]}):Z==="onramp"&&Ye?jsxRuntime.jsxs(reactNative.View,{style:$.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Aa(Ye.provider.icon_urls,"png",Ye.provider.icon_url))},style:$.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[$.onrampTitle,{color:h.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",Ye.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[$.onrampSubtitle,{color:h.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[$.flowDiagram,{backgroundColor:h.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:$.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Kt(`/icons/currencies/png/${Ye.sourceCurrency.toLowerCase()}.png`)},style:$.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowLabel,{color:h.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowValue,{color:h.card.titleColor,fontFamily:w.medium}],children:Ye.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(xr,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:$.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:$.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Ei(we?.destination_token_metadata?.icon_urls,"png")||we?.destination_token_metadata?.icon_url||Kt("/icons/tokens/png/usdc.png")},style:$.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Ei(we?.destination_token_metadata?.chain?.icon_urls,"png")||we?.destination_token_metadata?.chain?.icon_url||Kt("/icons/networks/png/polygon.png")},style:[$.flowNetworkBadge,{borderColor:b.background,borderRadius:h.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowLabel,{color:h.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowValue,{color:h.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsxRuntime.jsx(xr,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:$.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:$.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Or||Kt("/icons/tokens/png/usdc.png")},style:$.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:U||Kt("/icons/networks/png/polygon.png")},style:[$.flowNetworkBadge,{borderColor:b.background,borderRadius:h.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowLabel,{color:h.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowValue,{color:h.card.titleColor,fontFamily:w.medium}],children:D})]})]}),jsxRuntime.jsx(reactNative.View,{style:[$.onrampInfoBox,{backgroundColor:h.card.backgroundColor,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth,borderColor:h.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[$.onrampInfoText,{color:h.card.descriptionColor,fontFamily:w.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function by({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxRuntime.jsxs(pt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:_i.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:_i.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ze,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[_i.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:_i.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:_i.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:_i.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:_i.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var _i=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"}}),$=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 ky(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 Ty(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Al({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=F(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=te(ke(e.destination_token_metadata,"png")||Kt("/icons/tokens/png/usdc.png")),m=i?"Deposit Processing":"Deposit Completed",u=ky(e.created_at||new Date().toISOString()),y=Ty(e.source_amount_usd);return jsxRuntime.jsxs(or,{cardTokens:a,onPress:t,contentStyle:dn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:dn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:dn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[dn.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsxRuntime.jsx(Fa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(ze,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:dn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[dn.title,{color:a.titleColor,fontFamily:o.medium}],children:m}),jsxRuntime.jsx(reactNative.Text,{style:[dn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:u})]}),jsxRuntime.jsxs(reactNative.View,{style:dn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[dn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:y}),jsxRuntime.jsx(xr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var dn=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Fm(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Om(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 _y(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Dm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Vm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Ry(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 Iy({count:e=4}){let{colors:t,components:r}=F(),o=Un.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return Un.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Ri.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[Ri.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Ri.icon,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Ri.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Ri.titleBar,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Ri.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Ri.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var Ri=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 Nd({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=F(),[l,m]=Un.useState(r),[u,y]=Un.useState(false),[S,g]=Un.useState(null),[b,w]=Un.useState(false),h=Un.useRef(null);Un.useEffect(()=>{if(!e||!o)return;let T=async()=>{y(true);try{let W=[...(await Jo(o,n)).data].sort((V,O)=>{let P=V.created_at?new Date(V.created_at).getTime():0;return (O.created_at?new Date(O.created_at).getTime():0)-P});m(W);}catch(x){console.error("Failed to fetch executions:",x),m(r);}finally{y(false);}};T();let C=setInterval(T,1e4);return ()=>clearInterval(C)},[e,o,n,r]),Un.useEffect(()=>{r.length>0&&m(T=>{let C=new Set(T.map(W=>W.id)),x=r.filter(W=>!C.has(W.id));return x.length>0?[...x,...T]:T});},[r]),Un.useEffect(()=>{e||g(null);},[e]);let k=T=>{g(T);},c=()=>{g(null),w(false);},d=()=>{g(null),t();},f=()=>{if(!S)return null;let T=S,C=T.status==="pending"||T.status==="waiting"||T.status==="delayed",x=T.status==="succeeded",W=te(ke(T.destination_token_metadata,"png")||Kt("/icons/tokens/png/usdc.png")),V=T.provider_metadata?.details,O=V?.currencyIn,P=V?.currencyOut;O?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let ue=Om(T.source_amount_base_unit,T.source_token_metadata?.decimals),Le=Om(T.destination_amount_base_unit,T.destination_token_metadata?.decimals),ve=_y(T.source_amount_usd),ee=Fm(T.source_chain_type,T.source_chain_id),Oe=Fm(T.destination_chain_type,T.destination_chain_id),fe=()=>{T.explorer_url&&reactNative.Linking.openURL(T.explorer_url);},Re=()=>{T.destination_explorer_url&&reactNative.Linking.openURL(T.destination_explorer_url);};return jsxRuntime.jsxs(it,{ref:h,style:me.scrollContainer,contentContainerStyle:me.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:me.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:me.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W},style:me.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[me.statusBadge,{backgroundColor:C?a.warning:a.success,borderColor:a.background}],children:C?jsxRuntime.jsx(Dt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(ze,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:me.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[me.statusDot,{backgroundColor:C?a.warning:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[me.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[me.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:Ry(T.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[me.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[ue," ",Vm(T.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[me.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[Le," ",Vm(T.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[me.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:ve})]}),jsxRuntime.jsx(reactNative.View,{style:[me.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:ee})]}),jsxRuntime.jsx(reactNative.View,{style:[me.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Oe})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let We=!b;w(We),We?setTimeout(()=>{h.current?.scrollToEnd({animated:true});},100):h.current?.scrollTo({y:0,animated:true});},style:me.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:b?"See less":"See more details"}),b?jsxRuntime.jsx(_o,{size:14,color:s.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Dt,{size:14,color:s.container.actionColor,strokeWidth:2})]}),b&&jsxRuntime.jsxs(reactNative.View,{style:[me.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[T.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:fe,style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:me.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Dm(T.transaction_hash)}),jsxRuntime.jsx(xo,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[me.cardDivider,{backgroundColor:a.border}]})]}),T.destination_explorer_url&&x&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Re,style:me.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:me.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Dm(T.destination_transaction_hashes[0])}),jsxRuntime.jsx(xo,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},R=u&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vr,{title:S?"Deposit Details":"Deposit Tracker",onClose:d,showClose:!S,showBack:!!S,onBack:c}),S?f():R?jsxRuntime.jsx(Iy,{}):jsxRuntime.jsx(it,{style:me.scrollContainer,contentContainerStyle:me.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:me.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[me.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[me.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:me.executionsList,children:l.map(T=>jsxRuntime.jsx(Al,{execution:T,onPress:()=>k(T)},T.id))})})]})}var me=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 ba(e,t=true){let[r,o]=Un.useState(null),[n,a]=Un.useState(null),[i,s]=Un.useState(false),[l,m]=Un.useState(false),[u,y]=Un.useState(null),[S,g]=Un.useState(null);Un.useEffect(()=>{!t||r||(s(true),zs().then(k=>{o(k),y(null);}).catch(k=>{y(k instanceof Error?k:new Error(String(k)));}).finally(()=>{s(false);}));},[t,r]),Un.useEffect(()=>{!t||!e||n||(m(true),Ms(e).then(k=>{a(k),g(null);}).catch(k=>{g(k instanceof Error?k:new Error(String(k)));}).finally(()=>{m(false);}));},[t,e,n]);let b=i||l,w=u||S||null,h=null;if(r&&n){let k=n.blocked_country_codes||[],c=r.alpha2.toUpperCase();h=!k.some(d=>d.toUpperCase()===c);}return {isAllowed:h,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:b,error:w}}var qd="unifold_recent_tokens",Dy=5,Mm=[{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 Ul(){try{let e=await qc__default.default.getItem(qd);return e?JSON.parse(e):[]}catch{return []}}async function Vy(e){try{let r=(await Ul()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Dy);await qc__default.default.setItem(qd,JSON.stringify(o));}catch{}}async function Ly(e){try{let r=(await Ul()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await qc__default.default.setItem(qd,JSON.stringify(r)),r}catch{return []}}function Qd({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:u}=F(),[y,S]=Un.useState(""),[g,b]=Un.useState([]);Un.useEffect(()=>{e&&Ul().then(b);},[e]),Un.useEffect(()=>{e||S("");},[e]);let w=Un.useMemo(()=>{let R=[];return r.forEach(_=>{_.chains.forEach(T=>{R.push({token:_,chain:T});});}),R},[r]),h=Un.useMemo(()=>{let R=[],_=new Set,T=(C,x,W,V)=>{let O=`${C}-${x}:${W}`;if(_.has(O))return;let P=r.find(N=>N.symbol===C);if(!P)return;let q=P.chains.find(N=>N.chain_type===x&&N.chain_id===W);q&&(_.add(O),R.push({token:P,chain:q,isRecent:V}));};return g.forEach(C=>{T(C.symbol,C.chainType,C.chainId,true);}),Mm.forEach(C=>{T(C.symbol,C.chainType,C.chainId,false);}),R},[r,g]),k=Un.useMemo(()=>{if(!y.trim())return w;let R=y.toLowerCase();return w.filter(({token:_,chain:T})=>_.symbol.toLowerCase().includes(R)||_.name.toLowerCase().includes(R)||T.chain_name.toLowerCase().includes(R))},[w,y]),c=(R,_,T)=>Mm.some(C=>C.symbol===R&&C.chainType===_&&C.chainId===T),d=async(R,_)=>{let T=`${_.chain_type}:${_.chain_id}`;if(!c(R.symbol,_.chain_type,_.chain_id)){await Vy({symbol:R.symbol,chainType:_.chain_type,chainId:_.chain_id});let C=await Ul();b(C);}S(""),a(R.symbol,T),t();},f=async(R,_)=>{let T=await Ly({symbol:R.symbol,chainType:_.chain_type,chainId:_.chain_id});b(T);};return jsxRuntime.jsxs(pt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:ct.header,children:[jsxRuntime.jsx(reactNative.View,{style:ct.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ct.headerTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:ct.closeButton,children:jsxRuntime.jsx(Ze,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ct.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ct.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:m.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],placeholder:"Search",placeholderTextColor:u.search.placeholderColor,value:y,onChangeText:S,autoCapitalize:"none",autoCorrect:false})}),h.length>0&&!y&&jsxRuntime.jsxs(reactNative.View,{style:ct.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.sectionLabel,{color:u.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ct.quickSelectScroll,children:h.map(({token:R,chain:_,isRecent:T})=>{let C=`${_.chain_type}:${_.chain_id}`;R.symbol===o&&C===n;return jsxRuntime.jsxs(reactNative.View,{children:[T&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(R,_),style:ct.removeButton,children:jsxRuntime.jsx(Ze,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(R,_),activeOpacity:.7,style:[ct.quickSelectItem,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ct.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(R,"png"))},style:ct.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(_,"png"))},style:[ct.quickSelectChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ct.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.quickSelectSymbol,{color:u.card.titleColor,fontFamily:m.medium}],children:R.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ct.quickSelectChain,{color:u.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]})]})]},`quick-${R.symbol}-${C}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[ct.sectionLabel,{color:u.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsxRuntime.jsx(it,{style:ct.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ct.tokenListContent,children:k.length===0?jsxRuntime.jsx(reactNative.View,{style:ct.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ct.emptyText,{color:l.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):k.map(({token:R,chain:_})=>{let T=`${_.chain_type}:${_.chain_id}`,C=R.symbol===o&&T===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(R,_),activeOpacity:.7,style:[ct.tokenItem,{backgroundColor:C?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:ct.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(R,"png"))},style:ct.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(_,"png"))},style:[ct.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ct.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ct.tokenSymbol,{color:u.card.titleColor,fontFamily:m.medium}],children:R.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ct.tokenChainName,{color:u.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[ct.minDeposit,{color:u.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:u.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${R.symbol}-${T}`)})})]})}var ct=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Nl=(e,t)=>`${t}:${e}`,My=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Kd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:u="auto_ui",onExecutionsChange:y,onDepositSuccess:S,onDepositError:g,wallets:b,borderTopLeftRadius:w,borderTopRightRadius:h,sheetBorderRadius:k}){let{colors:c,fonts:d,components:f}=F(),R=s&&l?`${s}:${l}`:"solana:mainnet",[_,T]=Un.useState("USDC"),[C,x]=Un.useState(R),[W,V]=Un.useState([]),[O,P]=Un.useState(!b?.length),q=b?.length?b:W,[N,ue]=Un.useState([]),[Le,ve]=Un.useState(true),[ee,Oe]=Un.useState(false),[fe,Re]=Un.useState(false),[We,be]=Un.useState(false),[oe,De]=Un.useState([]),[dt,Ue]=Un.useState(new Map),[Qe]=Un.useState(()=>new Date),[Ke,Ee]=Un.useState(null),[Je,Ce]=Un.useState(false),[re,ae]=Un.useState(null),[tt,rt]=Un.useState(false),Me=new Map;N.forEach(B=>{B.chains.forEach(Se=>{let M=`${Se.chain_type}:${Se.chain_id}`;Me.has(M)||Me.set(M,Se);});});let he=Array.from(Me.values()),ne=My(C),le=he.find(B=>B.chain_type===ne.chainType&&B.chain_id===ne.chainId),qt=le?.chain_type||"ethereum",pe=Yo(q,qt),se=pe?.address||"",we=Un.useRef(false);Un.useEffect(()=>{async function B(){try{ve(!0),Ee(null);let M=await ei(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(ue(M.data),M.data.length>0&&!we.current){we.current=!0;let Z,ye;if(s&&l)if(m)for(let de of M.data){let mt=de.chains.find(D=>D.chain_type===s&&D.chain_id===l&&D.token_address.toLowerCase()===m.toLowerCase());if(mt){Z=de,ye=mt;break}}else for(let de of M.data){let mt=de.chains.find(D=>D.chain_type===s&&D.chain_id===l);if(mt){Z=de,ye=mt;break}}if(!Z&&a)for(let de of M.data){let mt=de.chains.find(D=>D.token_address.toLowerCase()===a.toLowerCase());if(mt){Z=de,ye=mt;break}}Z||(Z=M.data.find(de=>de.symbol==="USDC"),Z&&Z.chains.length>0&&(ye=Z.chains[0])),Z||(Z=M.data.find(de=>de.symbol==="USDT"),Z&&Z.chains.length>0&&(ye=Z.chains[0])),Z||(Z=M.data[0],Z.chains.length>0&&(ye=Z.chains[0])),Z&&T(Z.symbol),ye&&x(Nl(ye.chain_id,ye.chain_type));}}catch(Se){console.error("Error fetching supported tokens:",Se),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:Se});}finally{ve(false);}}B();},[t,a,n,o,s,l,m,g]),Un.useEffect(()=>{y&&y(oe);},[oe,y]),Un.useEffect(()=>{if(b?.length){P(false);return}if(W.length>0){P(false);return}let B=null,Se=false,M=async()=>{if(!Se){P(true);try{let Z=await Go({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);Se||(V(Z.data),Ee(null),P(!1));}catch(Z){console.error("Error fetching wallets, retrying in 5s:",Z),Se||(Ee(Z instanceof Error?Z.message:"Failed to load wallets"),P(false),B=setTimeout(M,5e3));}}};return M(),()=>{Se=true,B&&clearTimeout(B);}},[e,r,o,n,a,t,b,W.length]);let yt=pe?.id??"",{showWaitingUi:ot,handleIveDeposited:ce}=fa({depositConfirmationMode:u,depositAddress:se,chain:C,externalUserId:e,publishableKey:t,modalOpenedAt:Qe,depositWalletId:yt,depositExecutions:oe,trackedExecutions:dt,setDepositExecutions:De,setTrackedExecutions:Ue,setLatestExecution:ae,setShowStatusSheet:Ce,onDepositSuccess:S,onExecutionsChange:y,onDepositError:g});Un.useEffect(()=>{if(!N.length)return;let B=N.find(M=>M.symbol===_);if(!B||B.chains.length===0)return;if(!B.chains.some(M=>Nl(M.chain_id,M.chain_type)===C)){let M=B.chains[0];x(Nl(M.chain_id,M.chain_type));}},[_,N,C]);let Ye=N.find(B=>B.symbol===_),ut=(Ye?.chains||[]).find(B=>Nl(B.chain_id,B.chain_type)===C),Fr=async()=>{if(se)try{reactNative.Clipboard.setString(se),Oe(!0),setTimeout(()=>Oe(!1),2e3);}catch(B){console.error("Failed to copy:",B);}},zr=ut?.estimated_price_impact_percent??0,ar=ut?.max_slippage_percent??.25,E=ut?.minimum_deposit_amount_usd??3;return Le?jsxRuntime.jsxs(reactNative.View,{style:H.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[H.loadingText,{color:c.foregroundMuted,fontFamily:d.regular}],children:"Loading currencies..."})]}):Ke&&N.length===0?jsxRuntime.jsxs(reactNative.View,{style:H.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.errorText,{color:c.error,fontFamily:d.regular}],children:Ke}),jsxRuntime.jsx(reactNative.Text,{style:[H.errorHint,{color:c.foregroundMuted,fontFamily:d.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:H.container,children:[jsxRuntime.jsxs(reactNative.View,{style:H.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.selectorLabel,{color:f.card.labelColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>be(true),disabled:Le||N.length===0,style:[H.tokenSelectorButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:Le?jsxRuntime.jsxs(reactNative.View,{style:H.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[H.loadingIcon,{backgroundColor:c.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:H.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[H.loadingLine,{backgroundColor:c.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[H.loadingLine,{backgroundColor:c.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:H.tokenIconWrapper,children:[Ye&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(Ye,"png"))},style:H.tokenMainIcon}),(ut||le)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(ut||le,"png"))},style:[H.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:H.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:d.semibold}],children:Ye?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[H.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:d.regular}],numberOfLines:1,children:ut?.chain_name||le?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:H.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[H.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:d.medium}],children:["$",E," min"]}),jsxRuntime.jsx(xr,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Qd,{visible:We,onClose:()=>be(false),tokens:N,selectedToken:_,selectedChainKey:C,onSelect:(B,Se)=>{T(B),x(Se);},borderTopLeftRadius:k?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:k?.tokenSelector?.borderTopRightRadius??h}),jsxRuntime.jsx(reactNative.View,{style:H.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[H.qrWrapper,{backgroundColor:c.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:O?jsxRuntime.jsxs(reactNative.View,{style:H.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[H.loadingText,{color:c.foregroundMuted,fontFamily:d.regular}],children:"Loading..."})]}):se?jsxRuntime.jsx(ys,{value:se,size:180,logoUri:te(ke(ut,"png")||Kt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:H.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[H.errorText,{color:c.error,fontFamily:d.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:H.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:H.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.addressLabel,{color:f.card.labelColor,fontFamily:d.medium}],children:"Deposit Address"}),ee&&jsxRuntime.jsxs(reactNative.View,{style:H.copiedIndicator,children:[jsxRuntime.jsx(ze,{size:14,color:c.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[H.copiedText,{color:c.success,fontFamily:d.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(or,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!O&&se?Fr:void 0,contentStyle:H.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.addressText,{color:f.card.titleColor,fontFamily:d.regular}],numberOfLines:2,children:O?"Loading...":se||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:H.addressCopyIcon,children:jsxRuntime.jsx(Qo,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[H.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Re(!fe),style:H.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Dr,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:H.chevronContainer,children:fe?jsxRuntime.jsx(_o,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Dt,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),fe&&jsxRuntime.jsxs(reactNative.View,{style:H.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(wn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[H.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Price impact: ",zr.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Bi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[H.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Slippage: Auto \u2022 ",ar.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Bi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:H.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[H.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Pa,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[H.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(_l,{depositConfirmationMode:u,depositAddress:se,showWaitingUi:ot,latestExecution:re,onIveDeposited:ce}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:H.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[H.termsText,{color:c.primary,fontFamily:d.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(pt,{visible:tt,onClose:()=>rt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:k?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:k?.infoSheet?.borderTopRightRadius??h,children:[jsxRuntime.jsxs(reactNative.View,{style:[H.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:H.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[H.sheetTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>rt(false),style:H.sheetCloseButton,children:jsxRuntime.jsx(Ze,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:H.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[H.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:H.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[H.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(wn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardTitle,{color:f.card.titleColor,fontFamily:d.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[H.infoCardValue,{color:f.card.titleColor,fontFamily:d.medium}],children:[zr.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardDescription,{color:f.card.descriptionColor,fontFamily:d.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[H.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:H.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[H.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardTitle,{color:f.card.titleColor,fontFamily:d.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[H.infoCardValue,{color:f.card.titleColor,fontFamily:d.medium}],children:[ar.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.infoCardDescription,{color:f.card.descriptionColor,fontFamily:d.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),re&&jsxRuntime.jsx(bs,{visible:Je,status:re.status,tokenIconUrl:re.destination_token_metadata?.icon_urls?.find(B=>B.format==="png")?.url||re.destination_token_metadata?.icon_url||ke(Ye,"png"),explorerUrl:re.explorer_url,completionExplorerUrl:re.destination_explorer_url,date:re.created_at?new Date(re.created_at):void 0,amountUsd:re.source_amount_usd?parseFloat(re.source_amount_usd):void 0,onClose:()=>Ce(false),borderTopLeftRadius:k?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:k?.depositStatus?.borderTopRightRadius??h})]})}var H=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 mn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function jy(){let{colors:e,components:t}=F(),r=Un.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Un.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let a=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[Yn.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Yn.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:Yn.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Yn.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Yn.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:Yn.rightIcons,children:Array.from({length:i}).map((s,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[Yn.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:Yn.container,children:[jsxRuntime.jsx(a,{rightIcons:3}),jsxRuntime.jsx(a,{rightIcons:2}),jsxRuntime.jsx(a,{rightIcons:0})]})}var Yn=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 $y({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,defaultChainType:u,defaultChainId:y,defaultTokenAddress:S,showBalance:g=false,hideDepositTracker:b=false,enableStripeLinkPay:w=false,StripeOnrampComponent:h,stripeOnrampEmail:k,stripeOnrampPhone:c,stripeMerchantIdentifier:d,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:R,stripeTheme:_,depositConfirmationMode:T="auto_ui",transferInputVariant:C="double_input",initialScreen:x="main",onDepositSuccess:W,onDepositError:V,sheetBorderRadius:O}){let P=O?.globalBorderTopLeftRadius,q=O?.globalBorderTopRightRadius,{colors:N,fonts:ue}=F(),[Le,ve]=Un.useState([]),[ee,Oe]=Un.useState(null),[fe,Re]=Un.useState("amount"),We=x==="tracker"&&!b?"tracker":x==="transfer"?"transfer":x==="card"?"card":"main",be=We==="main",[oe,De]=Un.useState(We),{isAllowed:dt,isLoading:Ue}=ba(o,e);Un.useEffect(()=>{if(!e||ee)return;let pe=false;return Ms(o).then(async se=>{if(pe)return;let we=[];for(let yt of se?.transfer_crypto?.networks??[]){let ot=yt.icon_urls.find(ce=>ce.format==="png")?.url||yt.icon_urls.find(ce=>ce.format==="svg")?.url;ot&&we.push(te(ot));}for(let yt of se?.payment_networks?.networks??[]){let ot=yt.icon_urls.find(ce=>ce.format==="png")?.url||yt.icon_urls.find(ce=>ce.format==="svg")?.url;ot&&we.push(te(ot));}we.length>0&&await Cd(we),pe||Oe(se);}).catch(console.error),()=>{pe=true;}},[e,ee,o]);let Qe=()=>{t();};Un.useEffect(()=>{e&&(De(We),Re("amount"));},[e,We]);let Ke=Un.useCallback(()=>{be?(De("main"),Re("amount")):Qe();},[be,Qe]),Ee=Le.filter(pe=>pe.status==="pending"||pe.status==="waiting").length,Ce=!!(i&&s&&l&&m&&o)&&g!==false&&!!ee,re=Ue||e&&!ee,ae=dt===false,tt=null;if(oe==="stripe"&&h){let pe=jsxRuntime.jsx(h,{publishableKey:o,email:k,phone:c,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,merchantIdentifier:d,paymentSelectorPosition:f,skipSuccessConfirmation:R,onClose:Ke});tt=_?jsxRuntime.jsx(Ai,{..._,children:pe}):pe;}let rt=oe==="stripe"?.9:oe==="transfer"||oe==="card"?.94:oe==="tracker"?.6:oe==="main"?.5:void 0,Me=oe==="tracker"||oe==="main"?.9:void 0,ne={main:O?.main,transfer:O?.transferCrypto,card:O?.buyWithCard,stripe:O?.stripeLinkPay,tracker:O?.depositsTracker}[oe],le=ne?.borderTopLeftRadius??P,qt=ne?.borderTopRightRadius??q;return jsxRuntime.jsxs(pt,{visible:e,onClose:oe==="main"?Qe:Ke,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:rt,maxHeightPercent:Me,borderTopLeftRadius:le,borderTopRightRadius:qt,children:[oe==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vr,{title:n,showBack:false,onClose:Qe,showBalance:Ce,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:ee?.project_name}),re&&jsxRuntime.jsx(jy,{}),!re&&ae&&jsxRuntime.jsxs(reactNative.View,{style:Tr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Tr.iconContainer,{backgroundColor:N.cardHover}],children:jsxRuntime.jsx(Vs,{size:32,color:N.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedTitle,{color:N.foreground,fontFamily:ue.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedDescription,{color:N.foreground,opacity:.7,fontFamily:ue.regular}],children:"There are no supported tokens available from your current location."})]}),!re&&!ae&&jsxRuntime.jsxs(reactNative.View,{style:Tr.optionsContainer,children:[jsxRuntime.jsx(la,{onPress:()=>De("transfer"),title:mn.transferCrypto.title,subtitle:mn.transferCrypto.subtitle,featuredTokens:ee?.transfer_crypto?.networks}),jsxRuntime.jsx(da,{onPress:()=>De("card"),title:mn.depositWithCard.title,subtitle:mn.depositWithCard.subtitle,paymentNetworks:ee?.payment_networks?.networks}),w&&h&&jsxRuntime.jsx(ma,{onPress:()=>De("stripe"),title:mn.stripeLinkPay.title,subtitle:mn.stripeLinkPay.subtitle}),!b&&jsxRuntime.jsx(ua,{onPress:()=>De("tracker"),title:mn.depositTracker.title,subtitle:mn.depositTracker.subtitle,badge:Ee>0?Ee:void 0})]})]}),oe==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vr,{title:mn.transferCrypto.title,showBack:false,onClose:Ke,showBalance:Ce,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:ee?.project_name}),Ue&&jsxRuntime.jsx(reactNative.View,{style:[Tr.centeredContainer,Tr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:N.primary})}),!Ue&&ae&&jsxRuntime.jsxs(reactNative.View,{style:[Tr.centeredContainer,Tr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Tr.iconContainer,{backgroundColor:N.cardHover}],children:jsxRuntime.jsx(Vs,{size:32,color:N.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedTitle,{color:N.foreground,fontFamily:ue.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedDescription,{color:N.foreground,opacity:.7,fontFamily:ue.regular}],children:"There are no supported tokens available from your current location."})]}),!Ue&&!ae&&jsxRuntime.jsx(it,{style:Tr.transferScrollContainer,contentContainerStyle:Tr.scrollContent,showsVerticalScrollIndicator:false,children:C==="single_input"?jsxRuntime.jsx(Kd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:u,defaultChainId:y,defaultTokenAddress:S,depositConfirmationMode:T,onExecutionsChange:ve,onDepositSuccess:W,onDepositError:V,borderTopLeftRadius:P,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:O?.tokenSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}}):jsxRuntime.jsx(Il,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:u,defaultChainId:y,defaultTokenAddress:S,depositConfirmationMode:T,onExecutionsChange:ve,onDepositSuccess:W,onDepositError:V,borderTopLeftRadius:P,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:O?.tokenSelector,chainSelector:O?.chainSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}})})]}),oe==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vr,{title:`Deposit ${a||"USDC"}`,showBack:fe==="onramp",onBack:()=>Re("amount"),onClose:Ke,showBalance:Ce,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:ee?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Tr.buyWithCardContainer,children:jsxRuntime.jsx(Vl,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,onDepositSuccess:W,onDepositError:V,view:fe,onViewChange:pe=>Re(pe),borderTopLeftRadius:P,borderTopRightRadius:q,sheetBorderRadius:{providerModal:O?.providerModal,webView:O?.webView,currencyModal:O?.currencyModal}})})]}),oe==="stripe"&&tt&&jsxRuntime.jsx(reactNative.View,{style:Tr.stripeLinkPayContainer,children:tt}),oe==="tracker"&&jsxRuntime.jsx(Nd,{active:oe==="tracker",onClose:Ke,executions:Le,externalUserId:r,publishableKey:o})]})}function ql({theme:e="auto",...t}){return jsxRuntime.jsx($y,{...t})}var Tr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Ql(e,t=true){return on({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ea(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Jd(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return on({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await ei(a),m=null,u=null,y=null,S=null,g,b,w,h=l.data.some(k=>k.chains.some(c=>{let d=c.chain_type===t&&c.chain_id===r&&c.token_address.toLowerCase()===o.toLowerCase();return d&&(m=c.minimum_deposit_amount_usd,u=c.estimated_processing_time,y=c.max_slippage_percent,S=c.estimated_price_impact_percent,w=c.chain_name,b=k),d}));if(b){let k=ke(b,"png");k&&(g=te(k));}return {isSupported:h,minimumAmountUsd:m,estimatedProcessingTime:u,maxSlippagePercent:y,priceImpactPercent:S,errorMessage:h?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:g,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Zd(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return on({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await Ma(t,r,o,n,a);if(l.balance){let m=l.balance.token?.decimals??6,u=l.balance.token?.symbol??"",y=l.balance.amount,S=BigInt(y),g=BigInt(10**m),b=S/g,h=(S%g).toString().padStart(m,"0").replace(/0+$/,""),k=h?`${b}.${h}`:b.toString();return {balanceBaseUnit:y,balanceHuman:k,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:m,symbol:u}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var Qy=2500,Ky=3e3,Gy=6e4;function Xd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=Un.useState([]),[l,m]=Un.useState(false),u=Un.useRef(new Date),y=Un.useRef(new Map),S=Un.useRef(false),g=Un.useRef(n),b=Un.useRef(a);return Un.useEffect(()=>{g.current=n;},[n]),Un.useEffect(()=>{b.current=a;},[a]),Un.useEffect(()=>{o&&!S.current&&(u.current=new Date,y.current.clear()),o||y.current.clear(),S.current=o;},[o]),Un.useEffect(()=>{if(!e||!o)return;let w=u.current,h=async()=>{try{let c=await Jo(e,t,"withdraw"),d=new Date(w.getTime()-Gy),f=[...c.data].sort((C,x)=>{let W=C.created_at?new Date(C.created_at).getTime():0;return (x.created_at?new Date(x.created_at).getTime():0)-W}),R=["pending","waiting","delayed"],_=["succeeded","failed"],T=null;for(let C of f){let x=C.created_at?new Date(C.created_at):null;if(!x||x<d)continue;let W=y.current.get(C.id);if(!W){T=C;break}if(R.includes(W)&&_.includes(C.status)){T=C;break}}if(T){let C=T,x=C.created_at?new Date(C.created_at):null;if(!x||x<u.current)return;let W=y.current.get(C.id);y.current.set(C.id,C.status),s(V=>{let O=V.findIndex(P=>P.id===C.id);if(O>=0){let P=[...V];return P[O]=C,P}return [...V,C]}),C.status==="succeeded"&&(!W||R.includes(W))?g.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&W!=="failed"&&b.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(c){console.error("Failed to fetch withdraw executions:",c),b.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:c});}};h();let k=setInterval(h,Qy);return m(true),()=>{clearInterval(k),m(false);}},[e,t,o]),Un.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await Rc({deposit_wallet_id:r},t);}catch{}};w();let h=setInterval(w,Ky);return ()=>clearInterval(h)},[o,r,t]),{executions:i,isPolling:l}}var eu=(e,t)=>`${t}:${e}`;function Sa({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:m,chainPickerBorderTopLeftRadius:u,chainPickerBorderTopRightRadius:y}){let{colors:S,fonts:g,components:b}=F(),[w,h]=Un.useState(false),[k,c]=Un.useState(false),d=b.card,f=t?e.find(C=>C.symbol===t):void 0,R=f?.chains||[],_=r?R.find(C=>eu(C.chain_id,C.chain_type)===r):void 0,T={backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth||1,borderColor:d.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Ge.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.label,{color:d.labelColor,fontFamily:g.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.selectButton,T],onPress:()=>!a&&e.length>0&&h(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Ge.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Loading..."}):f?jsxRuntime.jsxs(reactNative.View,{style:Ge.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(f,"png"))},style:Ge.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.selectedText,{color:d.titleColor,fontFamily:g.medium}],numberOfLines:1,children:f.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Ge.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Select receive token"}),jsxRuntime.jsx(Dt,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ge.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.label,{color:d.labelColor,fontFamily:g.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.selectButton,T,(!f||R.length===0)&&Ge.disabled],onPress:()=>!a&&f&&R.length>0&&c(true),activeOpacity:.7,disabled:a||!f||R.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Ge.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(_,"png"))},style:Ge.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.selectedText,{color:d.titleColor,fontFamily:g.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Ge.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Chain"}),jsxRuntime.jsx(Dt,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(pt,{visible:w,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:m,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Ge.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.pickerTitle,{color:S.foreground,fontFamily:g.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ge.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ze,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Wi,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Ge.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.pickerItem,{backgroundColor:C.symbol===t?S.cardHover:"transparent"}],onPress:()=>{o(C.symbol),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(C,"png"))},style:Ge.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.pickerItemText,{color:S.foreground,fontFamily:g.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.pickerItemSub,{color:S.foregroundMuted,fontFamily:g.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(ze,{size:18,color:S.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(pt,{visible:k,onClose:()=>c(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:u,borderTopRightRadius:y,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Ge.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.pickerTitle,{color:S.foreground,fontFamily:g.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ge.pickerHeaderClose,onPress:()=>c(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ze,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Wi,{data:R,keyExtractor:C=>eu(C.chain_id,C.chain_type),contentContainerStyle:Ge.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let x=eu(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.pickerItem,{backgroundColor:x===r?S.cardHover:"transparent"}],onPress:()=>{n(x),c(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(ke(C,"png"))},style:Ge.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.pickerItemText,{color:S.foreground,fontFamily:g.medium}],children:C.chain_name}),x===r&&jsxRuntime.jsx(ze,{size:18,color:S.primary,strokeWidth:2.5})]})}})]})]})}var Ge=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 tu(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return on({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>_c({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Xy(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function eb(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function tb(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Gl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:m,balanceData:u,isLoadingBalance:y,minimumWithdrawAmountUsd:S,estimatedProcessingTime:g,maxSlippagePercent:b,priceImpactPercent:w,canWithdraw:h,onDepositWalletCreation:k,onWithdraw:c,onWithdrawError:d,onWithdrawSubmitted:f,onViewTracker:R}){let _="https://unifold.io/terms",T="https://unifold.io/support",{colors:C,fonts:x,components:W}=F(),[V,O]=Un.useState(s||""),[P,q]=Un.useState(""),[N,ue]=Un.useState(false),[Le,ve]=Un.useState(null),[ee,Oe]=Un.useState(false),[fe,Re]=Un.useState(""),We=Un.useRef(null);Un.useEffect(()=>{O(s||""),q(""),ve(null);},[s]);let be=V.trim();Un.useEffect(()=>{let ce=setTimeout(()=>Re(be),500);return ()=>clearTimeout(ce)},[be]);let{data:oe,isLoading:De,error:dt}=tu({chainType:m?.chain_type,chainId:m?.chain_id,tokenAddress:m?.token_address,recipientAddress:fe,publishableKey:e,enabled:fe.length>5&&!!m}),Ue=be!==fe,Qe=Un.useMemo(()=>!be||be.length<=5||Ue||De?null:dt?"Invalid address":oe&&!oe.valid?oe.failure_code==="account_not_found"?`Account not found on ${m?.chain_name}`:oe.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${m?.chain_name}`:"Invalid address":null,[be,Ue,De,dt,oe,m,l]),Ke=!Ue&&!!oe?.valid&&!Qe,Ee=Un.useMemo(()=>u?.exchangeRate?parseFloat(u.exchangeRate):0,[u]),Je=Un.useMemo(()=>u?.balanceHuman?parseFloat(u.balanceHuman):0,[u]),Ce=n||u?.symbol||"TOKEN",re=u?.decimals??6,ae=Un.useMemo(()=>{let ce=parseFloat(P);return !ce||ce<=0?0:ce},[P]),tt=Un.useMemo(()=>{let ce=parseFloat(P);return !ce||ce<=0?0:ce*Ee},[P,Ee]),rt=Un.useCallback(async()=>{try{let Ye=await ff("expo-clipboard").getStringAsync();Ye&&(O(Ye.trim()),ve(null));}catch{}},[]),Me=Un.useCallback(()=>{Je<=0||q(u?.balanceHuman??"0");},[Je,u]),he=S!==null&&tt>0&&tt<S,ne=ae>0&&Je>0&&ae>Je,le=be.length>0&&P.trim().length>0&&ae>0&&Ke&&!he&&!ne&&!!u,qt=Un.useCallback(async()=>{if(!(!l||!m||!le||!h)){ue(true),ve(null);try{let ce=await k({destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,recipientAddress:be}),Ye=eb(ae,re),nr=tb(ae,re),ut={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:Ce,sourceTokenIconUrl:i,destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,destinationTokenSymbol:l.symbol,destinationChainName:m.chain_name,destinationTokenIconUrl:l?te(ke(l,"png")):void 0,amount:nr,amountBaseUnit:Ye,submittedAt:new Date,withdrawIntentAddress:ce.address,recipientAddress:be};await c(ut),f(ut);}catch(ce){let Ye=ce instanceof Error?ce.message:"Withdrawal failed. Please try again.",nr=Ye.length>120?"Withdrawal failed. Please try again.":Ye;ve(nr),d?.({message:Ye,error:ce,code:"WITHDRAW_FAILED"});}finally{ue(false);}}},[l,m,le,h,be,t,r,o,Ce,i,P,Je,u,ae,re,tt,k,c,d,f]),pe=W.input,se=W.card,we=W.button,yt=Qe?C.error:pe.borderColor,ot=Un.useMemo(()=>N?"Processing...":ne?"Insufficient balance":he?`Minimum $${S?.toFixed(2)}`:Le?"Withdrawal failed \u2014 try again":"Withdraw",[N,ne,he,S,Le]);return jsxRuntime.jsxs(reactNative.View,{style:qe.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:qe.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qe.label,{color:se.labelColor,fontFamily:x.medium}],children:"Recipient address"}),(Ue||De)&&be.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:rt,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(fu,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[qe.inputRow,{backgroundColor:pe.backgroundColor,borderRadius:pe.borderRadius,borderWidth:pe.borderWidth,borderColor:yt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[qe.textInput,{color:pe.textColor,fontFamily:x.regular}],placeholder:"Enter wallet address",placeholderTextColor:pe.placeholderColor,value:V,onChangeText:ce=>{O(ce),ve(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>We.current?.focus()})}),Qe?jsxRuntime.jsx(reactNative.Text,{style:[qe.errorText,{color:C.error,fontFamily:x.regular}],children:Qe}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[qe.label,{color:se.labelColor,fontFamily:x.medium,paddingBottom:8}],children:["Amount",S!=null&&S>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:x.regular},children:` ($${S.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[qe.amountRow,{backgroundColor:pe.backgroundColor,borderRadius:pe.borderRadius,borderWidth:pe.borderWidth,borderColor:pe.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:We,style:[qe.amountInput,{color:pe.textColor,fontFamily:x.regular}],placeholder:"0.00",placeholderTextColor:pe.placeholderColor,value:P,onChangeText:ce=>{(ce===""||/^\d*\.?\d*$/.test(ce))&&(q(ce),ve(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[qe.unitLabel,{color:C.foregroundMuted,fontFamily:x.medium}],children:Ce}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[qe.maxButton,{backgroundColor:`${C.primary}20`}],onPress:Me,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[qe.maxText,{color:C.primary,fontFamily:x.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[qe.detailsCard,{marginTop:24,backgroundColor:se.backgroundColor,borderRadius:se.borderRadius,borderWidth:se.borderWidth||1,borderColor:se.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:qe.detailsToggle,onPress:()=>Oe(!ee),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:qe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[qe.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(Dr,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[qe.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:x.medium},children:Xy(g)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ee?"180deg":"0deg"}]},children:jsxRuntime.jsx(Dt,{size:16,color:se.actionColor,strokeWidth:2})})]})}),ee&&jsxRuntime.jsxs(reactNative.View,{style:qe.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:qe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[qe.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sn,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[qe.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:x.medium},children:["Auto \u2022 ",(b??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:qe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[qe.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(wn,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[qe.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:x.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Le&&jsxRuntime.jsx(reactNative.Text,{style:[qe.errorText,{color:C.error,fontFamily:x.regular,textAlign:"center"}],children:Le}),jsxRuntime.jsxs(reactNative.View,{style:qe.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[qe.withdrawButton,{backgroundColor:we.primaryBackground,borderRadius:we.borderRadius,borderWidth:we.borderWidth,borderColor:we.borderColor,opacity:!le||!h||N?.5:1}],onPress:qt,disabled:!le||!h||N,activeOpacity:.8,children:[N&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:we.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[qe.withdrawButtonText,{color:we.primaryText,fontFamily:x.medium}],children:ot})]}),jsxRuntime.jsxs(reactNative.View,{style:qe.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:qe.historyLink,onPress:R,activeOpacity:.7,children:[jsxRuntime.jsx(Dr,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[qe.historyText,{color:C.foregroundMuted,fontFamily:x.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:qe.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[qe.legalText,{color:C.foregroundMuted,fontFamily:x.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[qe.legalSeparator,{color:C.foregroundMuted,fontFamily:x.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(T),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[qe.legalText,{color:C.foregroundMuted,fontFamily:x.regular}],children:"Help"})})]})]})]})]})}var qe=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 nb(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 ib(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Zl({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=F(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,m=te(ke(e.destination_token_metadata,"png")||Kt("/icons/tokens/png/usdc.png")),u=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",y=nb(e.created_at||new Date().toISOString()),S=ib(e.source_amount_usd);return jsxRuntime.jsxs(or,{cardTokens:a,onPress:t,contentStyle:hn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:hn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:m},style:hn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[hn.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsxRuntime.jsx(Ds,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(Fa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(ze,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:hn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[hn.title,{color:a.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[hn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:y})]}),jsxRuntime.jsxs(reactNative.View,{style:hn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[hn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:S}),jsxRuntime.jsx(xr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var hn=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 nu(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let m=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${m} ${l}`}catch{return e}}function ef(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 ab(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 tf(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function rf(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function ka({label:e,value:t,isLast:r}){let{fonts:o,components:n}=F(),a=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ae.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Ae.divider,{backgroundColor:a.borderColor}]})]})}function su({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=F(),[m,u]=Un.useState([]),[y,S]=Un.useState(!!n),g=l.card,b=l.button,w=l.header,h=l.container;Un.useEffect(()=>{xc().then(ue=>u(ue.data)).catch(()=>{});},[]),Un.useEffect(()=>{S(!!n);},[e?.id]);let k=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,c=e?e.status==="failed"||e.status==="refunded":false,d=c?i.error:k?i.warning:i.success,f=c?"Failed":k?"Processing":"Completed",R=e?.destination_token_metadata?te(ke(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?te(t.destinationTokenIconUrl):te(Kt("/icons/tokens/png/usdc.png")),_=e?.created_at?nu(e.created_at):t.submittedAt?nu(t.submittedAt.toISOString()):nu(new Date().toISOString()),T=e?`${ef(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${tf(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${ef(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${tf(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,x=e?ab(e.source_amount_usd,e.source_amount_base_unit):"$0.00",W=e?Wa(m,e.source_chain_type,e.source_chain_id):t.sourceChainId,V=e?Wa(m,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,O=e?.transaction_hash,P=e?.explorer_url,q=e?.destination_transaction_hashes?.[0],N=e?.destination_explorer_url;return jsxRuntime.jsxs(it,{style:Ae.scroll,contentContainerStyle:Ae.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ae.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Li,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ae.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.headerTitle,{color:w.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Ae.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ze,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:R},style:Ae.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ae.statusBadge,{backgroundColor:d}],children:c?jsxRuntime.jsx(Ds,{size:10,color:"#FFFFFF",strokeWidth:3}):k?jsxRuntime.jsx(reactNative.View,{style:Ae.spinnerDot}):jsxRuntime.jsx(ze,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ae.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ae.statusDot,{backgroundColor:d}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.statusText,{color:d,fontFamily:s.medium}],children:f})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.dateText,{color:h.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Ae.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:[jsxRuntime.jsx(ka,{label:"Amount Sent",value:T}),jsxRuntime.jsx(ka,{label:"Amount Received",value:C}),jsxRuntime.jsx(ka,{label:"USD Value",value:x}),jsxRuntime.jsx(ka,{label:"Source Network",value:W}),jsxRuntime.jsx(ka,{label:"Destination Network",value:V,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ae.moreDetailsRow,onPress:()=>S(ue=>!ue),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.moreDetailsText,{color:h.actionTitle,fontFamily:s.regular}],children:y?"See less":n?"See more":"See more details"}),y?jsxRuntime.jsx(_o,{size:16,color:h.actionColor,strokeWidth:2}):jsxRuntime.jsx(Dt,{size:16,color:h.actionColor,strokeWidth:2})]}),y&&jsxRuntime.jsx(reactNative.View,{style:[Ae.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:O&&P?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ae.txRow,onPress:()=>reactNative.Linking.openURL(P),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.txHash,{color:g.titleColor,fontFamily:s.regular}],children:rf(O)}),jsxRuntime.jsx(xo,{size:14,color:g.actionColor,strokeWidth:2})]}),!k&&q&&N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Ae.divider,{backgroundColor:g.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ae.txRow,onPress:()=>reactNative.Linking.openURL(N),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ae.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ae.txHash,{color:g.titleColor,fontFamily:s.regular}],children:rf(q)}),jsxRuntime.jsx(xo,{size:14,color:g.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Ae.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Ae.detailLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Ae.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ae.button,Ae.halfButton,{backgroundColor:b.secondaryBackground,borderRadius:b.borderRadius,borderWidth:b.borderWidth,borderColor:b.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ae.buttonText,{color:b.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ae.button,Ae.halfButton,{backgroundColor:b.primaryBackground,borderRadius:b.borderRadius,borderWidth:b.borderWidth,borderColor:b.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ae.buttonText,{color:b.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Ae=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 of(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Xl({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=F(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",m=s?.status==="failed",u={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:kt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kt.closeButton,onPress:r,children:jsxRuntime.jsx(Ze,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[kt.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(ze,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[kt.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[kt.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",of(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:kt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[kt.button,kt.halfButton,u,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[kt.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[kt.button,kt.halfButton,u,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[kt.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):m?jsxRuntime.jsxs(reactNative.View,{style:kt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kt.closeButton,onPress:r,children:jsxRuntime.jsx(Ze,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[kt.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(Ze,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[kt.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[kt.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[kt.button,kt.fullButton,u,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[kt.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:kt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kt.closeButton,onPress:r,children:jsxRuntime.jsx(Ze,{size:20,color:i.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:te(e.sourceTokenIconUrl)},style:kt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[kt.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[kt.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[kt.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",of(e.recipientAddress)]})]})}var kt=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 mb(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:te(ke(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:te(ke(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 nf=(e,t)=>`${t}:${e}`;function fb(){let{colors:e}=F(),t=Un.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Un.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 rc({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,defaultDestinationChainType:i,defaultDestinationChainId:s,defaultDestinationTokenAddress:l,modalTitle:m="Withdraw Crypto",onWithdraw:u,onWithdrawSuccess:y,onWithdrawError:S,heightPercent:g=.94,sheetBorderRadius:b,sourceChainType:w,sourceChainId:h,sourceTokenAddress:k,sourceTokenSymbol:c,sourceChainName:d,sourceTokenIconUrl:f}){let{colors:R,fonts:_}=F(),[T,C]=Un.useState("form"),[x,W]=Un.useState(w),[V,O]=Un.useState(h),[P,q]=Un.useState(k),[N,ue]=Un.useState(c),[Le,ve]=Un.useState(d),[ee,Oe]=Un.useState(f),[fe,Re]=Un.useState(null),[We,be]=Un.useState(null),[oe,De]=Un.useState(null),[dt,Ue]=Un.useState(),[Qe,Ke]=Un.useState([]),[Ee,Je]=Un.useState(null),[Ce,re]=Un.useState("form"),ae=Un.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,tt=Un.useRef(null),rt=!!x&&!!V&&!!P,{data:Me,isLoading:he}=Ql(r,e&&T==="form"),ne=Me?.data??[],{data:le,isLoading:qt}=Jd({sourceChainType:x,sourceChainId:V,sourceTokenAddress:P,sourceTokenSymbol:N,publishableKey:r,enabled:e&&rt&&T==="form"}),{data:pe,isLoading:se}=Zd({address:n,chainType:x,chainId:V,tokenAddress:P,publishableKey:r,enabled:e&&rt}),{executions:we}=Xd({userId:o,publishableKey:r,depositWalletId:dt,enabled:!!dt&&e,onWithdrawSuccess:y,onWithdrawError:S});Un.useEffect(()=>{if(!e||T!=="tracker")return;let U=false;return Jo(o,r,"withdraw").then(Rt=>{U||Ke(Rt.data);}).catch(console.error),()=>{U=true;}},[e,T,o,r]),Un.useEffect(()=>{e&&(tt.current&&(clearTimeout(tt.current),tt.current=null),C("form"),W(w),O(h),q(k),ue(c),ve(d),Oe(f),Re(null),be(null),De(null),Ue(void 0),Ke([]),Je(null),re("form"),ae.setValue(reactNative.Dimensions.get("window").width));},[e]),Un.useEffect(()=>()=>{tt.current&&clearTimeout(tt.current);},[]),Un.useEffect(()=>{ee||le?.iconUrl&&Oe(le.iconUrl);},[le?.iconUrl,ee]),Un.useEffect(()=>{Le||le?.chainName&&ve(le.chainName);},[le?.chainName,Le]),Un.useEffect(()=>{if(!ne.length||fe)return;let U,Rt;if(i&&s)if(l)for(let bt of ne){let Ur=bt.chains.find(Zt=>Zt.chain_type===i&&Zt.chain_id===s&&Zt.token_address.toLowerCase()===l.toLowerCase());if(Ur){U=bt,Rt=Ur;break}}else for(let bt of ne){let Ur=bt.chains.find(Zt=>Zt.chain_type===i&&Zt.chain_id===s);if(Ur){U=bt,Rt=Ur;break}}U||(U=ne[0]),U&&(Re(U),be(Rt??U.chains[0]??null));},[ne,fe,i,s,l]),Un.useEffect(()=>{T==="confirming"&&we.length>0&&C("details");},[T,we]);let yt=Un.useCallback(()=>{t(),tt.current=setTimeout(()=>{C("form"),W(w),O(h),q(k),ue(c),ve(d),Oe(f),Re(null),be(null),De(null),Ue(void 0),Ke([]),Je(null),re("form"),tt.current=null;},300);},[t,w,h,k,c,d,f]),ot=Un.useCallback(U=>{let Rt=ne.find(bt=>bt.symbol===U);Rt&&(Re(Rt),Rt.chains.length>0&&be(Rt.chains[0]));},[ne]),ce=Un.useCallback(U=>{if(!fe)return;let Rt=fe.chains.find(bt=>nf(bt.chain_id,bt.chain_type)===U);Rt&&be(Rt);},[fe]),Ye=Un.useCallback(async U=>{let Rt=await Go({external_user_id:o,destination_chain_type:U.destinationChainType,destination_chain_id:U.destinationChainId,destination_token_address:U.destinationTokenAddress,recipient_address:U.recipientAddress,action_type:"withdraw"},r),bt=Yo(Rt.data,x??"");if(!bt)throw new Error(`No deposit wallet found for chain type: ${x}`);return Ue(bt.id),{id:bt.id,address:bt.address}},[o,r,x]),nr=Un.useCallback(U=>{De(U),C("confirming");},[]),ut=Un.useCallback(U=>{Je(U),ae.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(ae,{toValue:0,duration:280,useNativeDriver:true}).start();},[ae]),Fr=Un.useCallback(()=>{reactNative.Animated.timing(ae,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Je(null));},[ae]),zr=he||qt,ar=le?.isSupported??null,E=T==="confirming"?"Withdrawal Status":m,B=b?.globalBorderTopLeftRadius,Se=b?.globalBorderTopRightRadius,M=b?.main?.borderTopLeftRadius??B,Z=b?.main?.borderTopRightRadius??Se,ye=b?.tokenSelector?.borderTopLeftRadius??B,de=b?.tokenSelector?.borderTopRightRadius??Se,mt=b?.chainSelector?.borderTopLeftRadius??B,D=b?.chainSelector?.borderTopRightRadius??Se,Or=(()=>{if(T!=="form"||!rt||se||!pe)return;let U=N||pe.symbol,Rt=pe.balanceUsd;if(Rt!=null){let Zt=`$${parseFloat(Rt).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return U?`Balance: ${Zt} ${U}`:`Balance: ${Zt}`}let bt=pe.balanceHuman;if(!(!bt||bt==="0"))return U?`Balance: ${bt} ${U}`:`Balance: ${bt}`})();return jsxRuntime.jsx(pt,{visible:e,onClose:yt,closeOnBackdropPress:false,enablePanDownToClose:T==="tracker"||T==="form",showHandle:T==="tracker"||T==="form",heightPercent:T==="confirming"?.3:T==="details"?.7:T==="tracker"?.6:g,maxHeightPercent:T==="tracker"?.9:void 0,borderTopLeftRadius:M,borderTopRightRadius:Z,children:T==="confirming"&&oe?jsxRuntime.jsx(Xl,{txInfo:oe,executions:we,onClose:yt,onViewTracker:()=>{re("confirming"),C("tracker");}}):T==="details"&&oe?jsxRuntime.jsx(su,{execution:we.length>0?we[we.length-1]:null,txInfo:oe,onClose:yt,onViewHistory:()=>{re("details"),C("tracker");},onHeaderClose:()=>C("form")}):T==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:jo.trackerContainer,children:[jsxRuntime.jsx(vr,{title:"Withdrawal History",onClose:()=>C(Ce)}),Qe.length===0?jsxRuntime.jsx(reactNative.View,{style:jo.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[jo.emptyText,{color:R.foregroundMuted,fontFamily:_.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Wi,{data:Qe,keyExtractor:U=>U.id,contentContainerStyle:jo.listContent,showsVerticalScrollIndicator:false,renderItem:({item:U})=>jsxRuntime.jsx(Zl,{execution:U,onPress:()=>ut(U)})}),Ee&&jsxRuntime.jsx(reactNative.Animated.View,{style:[jo.historyDetailOverlay,{backgroundColor:R.background,transform:[{translateX:ae}]}],children:jsxRuntime.jsx(su,{execution:Ee,txInfo:mb(Ee),onClose:yt,onBack:Fr,onViewHistory:Fr})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vr,{title:E,subtitle:Or,onClose:yt}),zr?jsxRuntime.jsx(fb,{}):ar===false?jsxRuntime.jsxs(reactNative.View,{style:jo.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[jo.unsupportedTitle,{color:R.foreground,fontFamily:_.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[jo.unsupportedMessage,{color:R.foregroundMuted,fontFamily:_.regular}],children:le?.errorMessage})]}):jsxRuntime.jsx(hb,{publishableKey:r,sourceChainType:x??"",sourceChainId:V??"",sourceTokenAddress:P??"",sourceTokenSymbol:N,sourceChainName:Le,sourceTokenIconUrl:ee,recipientAddressProp:a,destinationTokens:ne,selectedToken:fe,selectedChain:We,selectedChainKey:We?nf(We.chain_id,We.chain_type):null,onTokenChange:ot,onChainChange:ce,tokensLoading:he,balanceData:pe??null,isLoadingBalance:se,sourceValidation:le??null,onDepositWalletCreation:Ye,onWithdraw:u,onWithdrawError:S,onWithdrawSubmitted:nr,onViewTracker:()=>{re("form"),C("tracker");},tokenSelectorLeft:ye,tokenSelectorRight:de,chainSelectorLeft:mt,chainSelectorRight:D})]})})}function hb({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:m,selectedChain:u,selectedChainKey:y,onTokenChange:S,onChainChange:g,tokensLoading:b,balanceData:w,isLoadingBalance:h,sourceValidation:k,onDepositWalletCreation:c,onWithdraw:d,onWithdrawError:f,onWithdrawSubmitted:R,onViewTracker:_,tokenSelectorLeft:T,tokenSelectorRight:C,chainSelectorLeft:x,chainSelectorRight:W}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(it,{style:{flex:1,paddingTop:16},contentContainerStyle:jo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:jo.doubleInputWrapper,children:jsxRuntime.jsx(Sa,{tokens:l,selectedTokenSymbol:m?.symbol??null,selectedChainKey:y,onTokenChange:S,onChainChange:g,isLoading:b,tokenPickerBorderTopLeftRadius:T,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:x,chainPickerBorderTopRightRadius:W})}),jsxRuntime.jsx(Gl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:m,selectedChain:u,balanceData:w,isLoadingBalance:h,minimumWithdrawAmountUsd:k?.minimumAmountUsd??null,estimatedProcessingTime:k?.estimatedProcessingTime??null,maxSlippagePercent:k?.maxSlippagePercent??null,priceImpactPercent:k?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:c,onWithdraw:d,onWithdrawError:f,onWithdrawSubmitted:R,onViewTracker:_})]})})}var jo=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 lf=Un.createContext(null);function _b({children:e,publishableKey:t,config:r}){let[o]=Un.useState(()=>new pd({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=Un.useState(false),[i,s]=Un.useState(null),[l,m]=Un.useState(false),[u,y]=Un.useState(null),S=reactNative.useColorScheme(),g=Un.useRef(false);g.current||(Va({publishableKey:t}),g.current=true);let b=Un.useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?S==="dark"?"dark":"light":P},[r?.appearance,S]);Un.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.'),Va({publishableKey:t});},[t]),Un.useEffect(()=>()=>{h.current&&clearTimeout(h.current),_.current&&clearTimeout(_.current);},[]);let w=Un.useRef(null),h=Un.useRef(null),k=Un.useCallback(P=>{h.current&&(clearTimeout(h.current),h.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let q=new Promise((N,ue)=>{w.current={resolve:N,reject:ue};});return s(P),a(true),q},[]),c=Un.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),a(false),h.current=setTimeout(()=>{s(null),h.current=null;},200);},[]),d=Un.useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),f=Un.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),R=Un.useRef(null),_=Un.useRef(null),T=Un.useRef(void 0),C=Un.useCallback(P=>{_.current&&(clearTimeout(_.current),_.current=null),R.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),R.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),R.current=null);let q=new Promise((N,ue)=>{R.current={resolve:N,reject:ue};});return T.current=P.onClose,y(P),m(true),q},[]),x=Un.useCallback(()=>{R.current&&(R.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),R.current=null),T.current?.(),T.current=void 0,m(false),_.current=setTimeout(()=>{y(null),_.current=null;},200);},[]),W=Un.useCallback(P=>{u?.onSuccess&&u.onSuccess(P),R.current&&(R.current.resolve(P),R.current=null);},[u]),V=Un.useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),u?.onError&&u.onError(P),R.current&&(R.current.reject(P),R.current=null);},[u]),O=Un.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:c,beginWithdraw:C,closeWithdraw:x}),[t,k,c,C,x]);return jsxRuntime.jsx(hd,{client:o,children:jsxRuntime.jsx(lf.Provider,{value:O,children:jsxRuntime.jsxs(Ai,{mode:b,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(ql,{visible:n,onClose:c,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:b,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?bp():void 0,onDepositSuccess:d,onDepositError:f,theme:b,sheetBorderRadius:r?.sheetBorderRadius}),u&&jsxRuntime.jsx(rc,{visible:l,onClose:x,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:W,onWithdrawError:V,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Rb(){let e=Un.useContext(lf);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
-
|
|
1
|
+
'use strict';var ai=require('react'),reactNative=require('react-native'),Ft=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),Sp=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Nd=require('@react-native-async-storage/async-storage'),lb=require('expo-constants'),Nb=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ai__namespace=/*#__PURE__*/_interopNamespace(ai);var Ft__default=/*#__PURE__*/_interopDefault(Ft);var Sp__default=/*#__PURE__*/_interopDefault(Sp);var Nd__default=/*#__PURE__*/_interopDefault(Nd);var lb__default=/*#__PURE__*/_interopDefault(lb);var Nb__default=/*#__PURE__*/_interopDefault(Nb);var pp=e=>{throw TypeError(e)};var Hh=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ed=(e,t,r)=>t.has(e)||pp("Cannot "+r);var f=(e,t,r)=>(ed(e,t,"read from private field"),r?r.call(e):t.get(e)),X=(e,t,r)=>t.has(e)?pp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),W=(e,t,r,o)=>(ed(e,t,"write to private field"),t.set(e,r),r),je=(e,t,r)=>(ed(e,t,"access private method"),r);var na=(e,t,r,o)=>({set _(n){W(e,t,n);},get _(){return f(e,t,o)}});var td={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)"}},rd=td;function ul(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ia(e,t,r){let o=r?t?.[r]:void 0,n=(c,g,C)=>{let S=o?.[c]?.[g];if(S!==void 0)return S;let w=t?.[c]?.[g];return w!==void 0?w:C},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,m=(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:ul(i,s)},transferCrypto:{depositAddress:{card:ul(i,a)}},depositCard:{quoteProvider:{card:ul(i,l)}},depositTracker:{executionRow:{card:ul(i,m)}}}}function od(e,t,r){let n={...td[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var nd=ai.createContext(null);function V(){let e=ai.useContext(nd);if(!e){let t=rd.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ia(t,void 0,"dark"),isDark:true}}return e}function ot({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=V(),l=i??a.warning,m=s??"#FBBF24",c=ai.useRef(new reactNative.Animated.Value(0)).current,g=ai.useId(),C=ai.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),S=(e-t)/2,w=2*Math.PI*S,u=e/2,h=o??Math.max(0,Math.round(e-t*2-8)),y=(e-h)/2;ai.useEffect(()=>{let p=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),k=requestAnimationFrame(()=>p.start());return ()=>{cancelAnimationFrame(k),p.stop();}},[c]);let T=c.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:T}]},children:jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ft.Defs,{children:jsxRuntime.jsxs(Ft.LinearGradient,{id:C,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ft.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Ft.Stop,{offset:"100%",stopColor:m})]})}),jsxRuntime.jsx(Ft.Circle,{cx:u,cy:u,r:S,stroke:`url(#${C})`,strokeWidth:t,fill:"none",strokeDasharray:`${w*.75} ${w*.25}`,strokeLinecap:"round",rotation:-90,origin:`${u}, ${u}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:y+1.5,left:y,width:h,height:h},children:r}):null]})}function sd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ft.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function rs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function st({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function xr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ft.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function os({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ft.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Yt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ft.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.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 De({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ft.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ad({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Eo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function zn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.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 ml({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ft.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ns({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.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 is({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function la({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.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(Ft.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(Ft.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.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(Ft.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ft.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ft.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function bp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ft.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wp({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Ft__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Ft.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(Ft.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ft.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 ss({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=ai.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),m=ai.useMemo(()=>{let S=o?.[l];return od(l,S,r)},[l,o,r]),c=ai.useMemo(()=>ia(m,s,l),[m,s,l]),g=ai.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]),C=ai.useMemo(()=>({mode:l,colors:m,fonts:g,components:c,isDark:l==="dark"}),[l,m,g,c]);return jsxRuntime.jsx(nd.Provider,{value:C,children:e})}var ma={damping:28,stiffness:300,mass:.8},bg=80,wg=500;function wt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:i=true,heightPercent:s,maxHeightPercent:a,startExpanded:l=false,noPadding:m=false,borderTopLeftRadius:c=24,borderTopRightRadius:g=24}){let{colors:C}=V(),{height:S}=reactNative.useWindowDimensions(),[w,u]=ai.useState(false),h=ai.useRef(e);h.current=e;let y=ai.useRef(0),T=s!=null&&s>=1,p=T||m?0:reactNative.Platform.OS==="ios"?34:24,k=a!=null&&s!=null&&a>s,d=s!=null?(k?a:s)*S:void 0,x=k?(a-s)*S:0,R=l?0:x,b=Sp.useSharedValue(S),I=ai.useRef(null),A=ai.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null),h.current||u(false);},[]);ai.useEffect(()=>{e?(I.current&&(clearTimeout(I.current),I.current=null),u(true),b.value=Sp.withSpring(R,ma)):w&&(b.value=Sp.withTiming(S,{duration:250},U=>{U&&Sp.runOnJS(A)();}),I.current=setTimeout(()=>{I.current=null,A();},350));},[e]),ai.useEffect(()=>()=>{I.current&&clearTimeout(I.current);},[]),ai.useEffect(()=>{w&&e&&(b.value=Sp.withSpring(R,ma));},[R]);let E=ai.useCallback(()=>{o&&t();},[o,t]),O=ai.useMemo(()=>{if(!(!n&&!k))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{y.current=b.value;},onPanResponderMove:(U,he)=>{if(Math.abs(he.dy)<4)return;let Be=y.current+he.dy;b.value=Math.max(0,Be);},onPanResponderRelease:(U,he)=>{if(!(Math.abs(he.dy)<4)){if(n&&(he.dy>bg||he.vy>wg)){t();return}if(k){let Be=x/2,We=b.value<Be?0:x;b.value=Sp.withSpring(We,ma);}else b.value=Sp.withSpring(R,ma);}},onPanResponderTerminate:()=>{b.value=Sp.withSpring(R,ma);}}).panHandlers},[n,k,x,R,b,t]),F=Sp.useAnimatedStyle(()=>({transform:[{translateY:b.value}]})),z=Sp.useAnimatedStyle(()=>({opacity:Sp.interpolate(b.value,[0,S*.5,S],[.5,.25,0],Sp.Extrapolation.CLAMP)}));return w?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Si.root,pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(Sp__default.default.View,{style:[Si.backdrop,z],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:E})}),jsxRuntime.jsxs(Sp__default.default.View,{style:[Si.sheet,F,{height:d,backgroundColor:C.background,borderTopLeftRadius:T?0:c,borderTopRightRadius:T?0:g}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Si.gestureRoot,children:[i&&jsxRuntime.jsx(reactNative.View,{style:Si.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Si.handle,{backgroundColor:C.foreground+"33"}]})}),r,p>0&&jsxRuntime.jsx(reactNative.View,{style:{height:p}})]}),O&&jsxRuntime.jsx(reactNative.View,{...O,style:Si.dragOverlay})]})]})}):null}var Si=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),at=ai__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));at.displayName="BottomSheetScrollView";function as(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Cg="https://api.unifold.io",pd="__UnifoldDevApiBaseUrl__",Hr="pk_test_123",hl={};function Sg(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[pd];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function fr(){return Sg()??Cg}function gl(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Hr=e.publishableKey;}e.defaultConfig&&(hl=e.defaultConfig);}function Tp(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[pd]=t:delete globalThis[pd];}function fa(){return fr()}function yl(){return Hr}function io(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function cr(e){let t=e.startsWith("/")?e:`/${e}`;return `${fr()}/api/public${t}`}function te(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,fr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${fr()}${e}`:`${fr()}/api/public${e}`:""}async function hn(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||hl.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||hl.destinationChainId||"8453",destination_token_address:e?.destination_token_address||hl.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Hr;io(n);let i=await fetch(`${fr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function gn(e,t){return e.find(r=>r.chain_type===t)}async function yn(e,t,r){let o=t||Hr;io(o);let n=await fetch(`${fr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function bl(e,t){let r=t||Hr;io(r);let o=await fetch(`${fr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function xe(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function ki(e,t){let r=e||Hr;io(r);let o=`${fr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function md(e,t){let r=t||Hr;io(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${fr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function wl(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function fd(e,t){let r=t||Hr;io(r);let o=await fetch(`${fr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function hd(e,t){let r=t||Hr;io(r);let o=await fetch(`${fr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function gd(e,t){let r=t||Hr;io(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${fr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function ha(e){let t=e||Hr;io(t);let r=await fetch(`${fr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function ls(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 ga(e){let t=e||Hr;io(t);let r=await fetch(`${fr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function yd(){let e=await fetch(`${fr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function Cl(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 ya(){let e=await fetch(`${fr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function Sl(e){let t=e||Hr;io(t);let r=await fetch(`${fr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function bd(e,t){let r=t||Hr;io(r);let o=await fetch(`${fr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function wd(e,t){return bl(e.deposit_wallet_id,t)}async function kl(e,t,r,o,n){let i=n||Hr;io(i);let s=await fetch(`${fr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}function Rp({size:e=28}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Ft.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Ft.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Ft.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 vp({size:e=28}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ft.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Ft.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(Ft.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ft.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Ft.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ft.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Ft.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Ft.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Ft.Defs,{children:jsxRuntime.jsx(Ft.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Ft.Rect,{width:28,height:28,fill:"white"})})})]})}function Op({size:e=28}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ft.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Ft.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(Ft.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(Ft.Defs,{children:jsxRuntime.jsx(Ft.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Ft.Rect,{width:28,height:28,fill:"white"})})})]})}function Fp({size:e=28}){return jsxRuntime.jsxs(Ft__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Ft.Defs,{children:[jsxRuntime.jsxs(Ft.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ft.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ft.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ft.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ft.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ft.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ft.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ft.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ft.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Ft.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Ft.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Ft.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(Ft.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(Ft.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 Dp({size:e=28}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Ft.G,{children:[jsxRuntime.jsx(Ft.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Ft.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 Tl=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Rp},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:vp},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Op},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Fp},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Dp}];function xl(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Rl(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 us(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Tl.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Tl.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function St({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:i}=V(),s=r==="back",a=s?jsxRuntime.jsx(os,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(st,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Un.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:Un.headerWithTitle,children:[s?l:o??jsxRuntime.jsx(reactNative.View,{style:Un.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Un.headerTitleText,{color:n.header.titleColor},...i.bold?[{fontFamily:i.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),s?jsxRuntime.jsx(reactNative.View,{style:Un.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:s?Un.headerWithTitle:Un.header,children:[s?l:jsxRuntime.jsx(reactNative.View,{style:Un.headerSpacer}),!s&&l]})}var _l={paddingTop:8,paddingBottom:8},Un=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",..._l},headerWithTitle:{flexDirection:"row",alignItems:"center",..._l,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Nr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=V();return e?jsxRuntime.jsx(reactNative.Text,{style:[Vp.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Vp.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Vp=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function Po({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ai.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 Rd({quote:e,label:t,address:r,last:o,hideDivider:n}){let[i,s]=ai.useState(false),{colors:a,components:l}=V(),m=()=>{reactNative.Clipboard.setString(r),s(true),setTimeout(()=>s(false),2e3);},c=xl(r);return jsxRuntime.jsxs(ai.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:c}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:m,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:i?jsxRuntime.jsx(De,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(mn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var vl={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ps({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=V(),i=e.toLowerCase(),s=vl[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 Il({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:i}){let{colors:s,components:a,fonts:l}=V(),m=cr(`/icons/currencies/png/${e.toLowerCase()}.png`),c=us(r);return jsxRuntime.jsxs(reactNative.View,{style:[bo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},i],children:[jsxRuntime.jsxs(reactNative.View,{style:bo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:m},style:bo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[bo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[bo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(xr,{size:16,color:s.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:bo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:bo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:bo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[bo.tokenIcon,{backgroundColor:vl[t.toLowerCase()]??s.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[bo.networkBadge,{borderColor:s.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[bo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[bo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",c]})]})]})}var bo=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 Ho(){let{colors:e,fonts:t,components:r}=V(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return ai.useMemo(()=>{let l=s.borderRadius,m={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},c={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},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}:{}}},C=Math.max(16,Math.min(l,22)),S={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:C,borderTopRightRadius:C,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:C,borderBottomRightRadius:C,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth: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}:{}}},w={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"}},u={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:m,quote:g,pm:S,wallet:w,flow:u,amount:c}},[e,t,o,n,i,s,a])}var xi=[],Wp=1,_d=new Set;function Ap(){let e=[...xi];_d.forEach(t=>t(e));}function Pl(e,t,r){let o={id:Wp++,timestamp:new Date().toISOString().slice(11,23),type:e,label:t,detail:r};xi.push(o),xi.length>500&&(xi=xi.slice(-300)),Ap();}function Ep(){xi=[],Wp=1,Ap();}function Mp(){return [...xi]}function zp(e){return _d.add(e),()=>{_d.delete(e);}}function Up(e,t){Pl("step",`\u2192 ${e}`,t);}function Hp(e,t,r,o){let n=r?{...r}:void 0;if(n?.["x-stripe-oauth-token"]){let s=n["x-stripe-oauth-token"];n["x-stripe-oauth-token"]=s.slice(0,8)+"..."+s.slice(-4);}let i=[`${e} ${t}`];n&&i.push(`Headers: ${JSON.stringify(n,null,2)}`),o&&i.push(`Body: ${JSON.stringify(o,null,2)}`),Pl("request",`${e} ${t.split("/").slice(-2).join("/")}`,i.join(`
|
|
2
|
+
|
|
3
|
+
`));}function Np(e,t,r,o){let n=o;try{o&&(n=JSON.stringify(JSON.parse(o),null,2));}catch{}let i=t.split("/").slice(-2).join("/");Pl("response",`${r} ${e} ${i}`,`Status: ${r}
|
|
4
|
+
|
|
5
|
+
${n??"(empty)"}`);}function Ol(e,t){Pl("error",`\u274C ${e}`,t);}var $p="",jp,Kg=globalThis.fetch;async function Yr(e,t){let r=t?.method??"GET",o=t?.headers,n;try{t?.body&&(n=JSON.parse(t.body));}catch{n=t?.body;}Hp(r,e,o,n);try{let i=await Kg(e,t),s=await i.text();return Np(r,e,i.status,s),new Response(s,{status:i.status,statusText:i.statusText,headers:i.headers})}catch(i){throw Ol(`${r} ${e}`,i?.message??String(i)),i}}function Fl(e){$p=e;}function Dl(e){jp=e;}function Gr(){let e=$p||yl();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Jr(){return jp??fa()}async function Vl(){let e=`${Jr()}/v1/public/onramps/headless/stripe/config`,t=Gr(),r=await Yr(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function vd(e){let t=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Gr(),"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 qp(e,t){let r=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Gr(),"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 Id(e,t){let r=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Gr(),"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 Kp(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 Yr(`${Jr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Gr(),"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 Qp(e,t){let r=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Gr(),"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 Hn(e,t){let r=`${Jr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await Yr(r,{method:"GET",headers:{"x-publishable-key":Gr(),"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 Yp(e){let t=`${Jr()}/v1/public/onramps/headless/stripe/sessions`,r=await Yr(t,{method:"GET",headers:{"x-publishable-key":Gr(),"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 Gp(e,t){let r=`${Jr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await Yr(r,{method:"GET",headers:{"x-publishable-key":Gr(),"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 Pd(e,t){let r=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Gr(),"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 Od(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 Yr(`${Jr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Gr(),"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 Fd(e,t){let r=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Gr(),"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 Jp(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 Yr(`${Jr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Gr(),"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 Nn(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 Zp(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await Yr(`${Jr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Gr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function Yg({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Ft__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Ft.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Ft.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Ft.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(Ft.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(Ft.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 Gg({size:e=24}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Ft.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Ft.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Ft.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Jg({size:e=24}){return jsxRuntime.jsx(Ft__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Ft.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Ft.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Ft.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Ft.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(Ft.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Ft.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(Ft.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Ft.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(Ft.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Ft.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(Ft.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Ft.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(Ft.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Ft.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 Vd({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(rs,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(Yg,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Gg,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Jg,{size:t}):jsxRuntime.jsx(rs,{size:t*.75,color:r,strokeWidth:1.75})}function Ll(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 Bd={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Wd(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function om({status:e,colors:t,fontFamily:r}){let o=Wd(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:Bd[e]??e})})}function nm({count:e=4}){let{colors:t,components:r}=V(),o=ai.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,i=Math.min(r.card.borderRadius??12,14);return ai.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:ms.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ms.row,{backgroundColor:t.card,borderRadius:i,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ms.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ms=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 im({active:e,interval:t=15e3,color:r}){let o=ai.useRef(new reactNative.Animated.Value(0)).current;return ai.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 sm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=V(),[i,s]=ai.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),s(true),setTimeout(()=>s(false),2e3);},l=e.transaction_details,m=e.status!=="fulfillment_complete"&&e.status!=="rejected",c=Wd(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",C=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",S=(l?.destination_currency??"").toUpperCase(),w=e.destination_token_metadata,u=Nn(w?.icon_urls,w?.icon_url),h=us(l?.destination_network??""),y=l?.wallet_address?xl(l.wallet_address):null,T=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,p=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,k=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,x=>x.toUpperCase()):null,d=[{label:"Amount",value:g},{label:"Received",value:`${C} ${S}`},...k?[{label:"Payment",value:k}]:[],{label:"Network",value:h},...y?[{label:"Wallet",value:y}]:[],...T?[{label:"Network Fee",value:T}]:[],...p?[{label:"Transaction Fee",value:p}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(St,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(at,{style:Sr.scroll,contentContainerStyle:Sr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Sr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ps,{currency:S||"USD",tokenIconUrl:u,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Sr.statusBadge,{backgroundColor:c,borderColor:o.card.backgroundColor??r.background}],children:m?jsxRuntime.jsx(Kr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(st,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(De,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Sr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Sr.statusDot,{backgroundColor:c}]}),jsxRuntime.jsx(reactNative.Text,{style:[Sr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Bd[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Sr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Ll(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Sr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Sr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Sr.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:[Sr.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(De,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(mn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),d.map(x=>jsxRuntime.jsx(ai__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Sr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Sr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:x.label}),jsxRuntime.jsx(reactNative.Text,{style:[Sr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:x.value})]})},x.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Sr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Sr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Sr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Sr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Sr=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 lm({onSelect:e,showKycOption:t=true}){let{colors:r,fonts:o,components:n}=V(),[i,s]=ai.useState(false),a=l=>{s(false),e(l);};return jsxRuntime.jsxs(reactNative.View,{style:$o.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$o.trigger,onPress:()=>s(l=>!l),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(yp,{size:20,color:r.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:$o.backdrop,onPress:()=>s(false)}),jsxRuntime.jsxs(reactNative.View,{style:[$o.menu,{backgroundColor:n.card.backgroundColor,borderRadius:n.card.borderRadius??12,borderWidth:n.card.borderWidth,borderColor:n.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$o.menuItem,onPress:()=>a("history"),activeOpacity:.6,children:[jsxRuntime.jsx(Kr,{size:18,color:r.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[$o.menuLabel,{color:r.foreground,fontFamily:o.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$o.menuItem,onPress:()=>a("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(Qr,{size:18,color:r.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[$o.menuLabel,{color:r.foreground,fontFamily:o.regular}],children:"Increase Limits (KYC)"})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$o.menuItem,onPress:()=>a("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(bp,{size:18,color:r.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[$o.menuLabel,{color:r.error,fontFamily:o.regular}],children:"Disconnect Stripe Link"})]})]})]})]})}var $o=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 uy=[50,100,500],py=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function dm(e){return e.charAt(0).toUpperCase()+e.slice(1)}function my(e){return e.card?`${dm(e.card.brand)} ${dm(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function El({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:i,paymentSelectorPosition:s="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:m,paymentError:c,paymentTokens:g=[],onAddPaymentMethod:C,onConfirm:S,onCancel:w,sheetBorderTopLeftRadius:u,sheetBorderTopRightRadius:h,accessToken:y,showHistoryProgressBar:T=true,onLogout:p,onRequestKYC:k}){let d=Ho(),{colors:x,components:R,fonts:b}=V(),I=u??R.card.borderRadius,A=h??R.card.borderRadius,[E,O]=ai.useState(e),[F,z]=ai.useState(r?"apple_pay":g.length>0?g[0].id:null),U=ai.useRef(false),he=v=>{U.current=true,z(v);};ai.useEffect(()=>{U.current||r||g.length>0&&z(g[0].id);},[g,r]);let[Be,We]=ai.useState(false),[re,Ae]=ai.useState("select"),[Ce,ye]=ai.useState(null),He=ai.useRef(false);ai.useEffect(()=>{l&&m&&/saving/i.test(m)&&Ae("card");},[l,m]);let ae=i,J=ae!=null&&ae>0,Se=ai.useMemo(()=>{if(o)return [];let v=uy.map(L=>({label:`$${L}`,amount:String(L),disabled:false}));return v.push({label:"MAX",amount:J?String(ae):"0",disabled:!J}),v},[o,J,ae]),Bt=v=>{if(v==="\u232B"){O(L=>L.slice(0,-1));return}if(v==="."){if(E.includes("."))return;O(L=>L===""?"0.":L+".");return}O(L=>{let N=L.indexOf(".");return N!==-1&&L.length-N>2?L:L==="0"&&v!=="."?v:L+v});},Ie=E===""?"0":E,Ne=parseFloat(E),Qe=n!=null&&!isNaN(Ne)&&Ne>0&&Ne<n,Ee=ae!=null&&ae>0&&!isNaN(Ne)&&Ne>ae,Ke=E!==""&&!isNaN(Ne)&&Ne>0&&!Qe&&!Ee,gt=r||g.length>0,ne=s==="header",de=ai.useMemo(()=>{let v=[];r&&v.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let L of g)v.push({id:L.id,label:my(L),hint:L.card?`Expires ${L.card.exp_month}/${L.card.exp_year}`:L.type,brand:L.card?.brand,isApplePay:false});return v},[r,g]),Oe=de.find(v=>v.id===F),Ye=F!=null&&F!=="apple_pay",Qt=Oe?Oe.label:Ye&&Ce?Ce:Ye?"Card":"Pay With",yt=Oe?!Oe.isApplePay:Ye,Fe=Oe?.brand??Ce??void 0,[dt,fe]=ai.useState(false),[ie,_e]=ai.useState([]),[et,xt]=ai.useState(false),[pe,Me]=ai.useState(null),[Wt,nt]=ai.useState(null),wr=ai.useRef(null);wr.current=Wt;let er=ai.useRef(false);er.current=dt;let $e=ai.useCallback(async(v=false)=>{if(y){v||(xt(true),Me(null));try{let L=await Yp(y);if(!er.current)return;let N=Array.isArray(L.data)?L.data:Array.isArray(L)?L:[];_e(N),v||Me(null);let ke=wr.current?.id;if(ke){let be=N.find(it=>it.id===ke);be&&nt(be);}}catch(L){if(!er.current)return;v||Me(L?.message??"Failed to load history");}finally{!v&&er.current&&xt(false);}}},[y]),Cr=ai.useCallback(()=>{fe(true),$e();},[$e]);ai.useEffect(()=>{if(!dt||!y)return;let v=setInterval(()=>$e(true),15e3);return ()=>clearInterval(v)},[dt,y,$e]);let q=ai.useCallback(v=>{switch(v){case "history":Cr();break;case "kyc":k?.();break;case "logout":p?.();break}},[Cr,k,p]),se=y?jsxRuntime.jsx(lm,{onSelect:q,showKycOption:!!k}):void 0,D=gt?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ne?d.amount.paymentRowHeader:d.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(Ae("select"),We(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:d.amount.paymentLeft,children:[Oe?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:d.amount.applePayIcon,children:"\uF8FF"}):yt?jsxRuntime.jsx(Vd,{sublabel:Fe,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:d.amount.paymentLabel,children:Qt}),jsxRuntime.jsx(Yt,{size:12,color:d.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:d.form.screen,children:[jsxRuntime.jsx(St,{onPress:w,title:"Enter amount",leftAction:se}),ne&&D,jsxRuntime.jsxs(reactNative.View,{style:d.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.amountText,Ie==="0"&&d.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ie]}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.currencyLabel,children:t.toUpperCase()}),Qe&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.minAmountText,{color:x.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),Ee&&ae!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.minAmountText,{color:x.warning}],children:["Maximum amount is $",ae.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!ne&&D,Se.length>0&&jsxRuntime.jsx(reactNative.View,{style:d.amount.quickRow,children:Se.map(v=>{let L=!v.disabled&&E===v.amount&&E!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.amount.quickPill,L&&{backgroundColor:x.primary},v.disabled&&{opacity:.4}],activeOpacity:.7,disabled:v.disabled||l,onPress:()=>O(v.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[d.amount.quickPillText,L&&{color:x.primaryForeground}],children:v.label})},v.label)})}),jsxRuntime.jsx(reactNative.View,{style:d.amount.numpad,children:py.map((v,L)=>jsxRuntime.jsx(reactNative.View,{style:d.amount.numpadRow,children:v.map(N=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.amount.numpadKey,l&&{opacity:.3}],onPress:()=>Bt(N),activeOpacity:.6,disabled:l,children:jsxRuntime.jsx(reactNative.Text,{style:N==="\u232B"?d.amount.backspaceText:d.amount.numpadKeyText,children:N})},N))},L))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.form.continueBtn,(!Ke||l)&&d.form.continueBtnDisabled],onPress:()=>Ke&&!l&&S(E,F),disabled:!Ke||l,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[d.form.continueBtnText,!Ke&&d.form.continueBtnTextDisabled],children:"Continue"})}),!Be&&c?jsxRuntime.jsx(reactNative.Text,{style:d.amount.inlineError,children:c}):!Be&&l&&m&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.inlineStatus,children:m}):null]}),jsxRuntime.jsx(wt,{visible:Be,onClose:()=>{l||(We(false),Ae("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:I,borderTopRightRadius:A,children:jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetContent,children:re==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>We(false),activeOpacity:.7,style:d.amount.sheetCloseBtn,children:jsxRuntime.jsx(st,{size:16,color:x.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(at,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[de.map(v=>{let L=F===v.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[d.amount.sheetOption,L&&{borderColor:x.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{he(v.id),ye(v.isApplePay?null:v.label),We(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetOptionIcon,children:v.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:d.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Vd,{sublabel:v.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionLabel,children:v.label}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionHint,children:v.hint})]})]}),L&&jsxRuntime.jsx(De,{size:18,color:x.primary,strokeWidth:2.5})]},v.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:d.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!He.current){He.current=true;try{let v=await C?.();v&&(he(v.token),ye(v.sublabel),We(!1));}finally{He.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||Ae("select");},activeOpacity:.7,style:d.amount.sheetBackBtn,children:jsxRuntime.jsx(os,{size:20,color:x.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetStatusText,children:m||"Loading Stripe Link..."}):null]}):c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetErrorText,children:c})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:d.form.continueBtn,onPress:()=>{a&&Ke&&a(false,E);},children:jsxRuntime.jsx(reactNative.Text,{style:d.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(wt,{visible:dt,onClose:()=>{fe(false),nt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:I,borderTopRightRadius:A,children:Wt?jsxRuntime.jsx(sm,{session:Wt,onBack:()=>nt(null)}):jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetContent,children:[jsxRuntime.jsx(St,{onPress:()=>fe(false),title:"Purchase History"}),T&&jsxRuntime.jsx(im,{active:dt&&!et&&ie.length>0,color:x.primary}),et?jsxRuntime.jsx(nm,{}):pe?jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetErrorText,children:pe})}):ie.length===0?jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[d.amount.sheetStatusText,{color:x.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(at,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:ie.map(v=>{let L=v.transaction_details,N=L?.source_amount?`$${parseFloat(L.source_amount).toFixed(2)}`:"\u2014",ke=(L?.destination_currency??"").toUpperCase(),be=L?.destination_amount?`${parseFloat(L.destination_amount).toFixed(2)} ${ke}`:"",it=Ll(v.created),le=v.destination_token_metadata,Pt=Nn(le?.icon_urls,le?.icon_url),Rt=Nn(le?.chain?.icon_urls,le?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:d.amount.sheetOption,activeOpacity:.7,onPress:()=>nt(v),children:[jsxRuntime.jsx(ps,{currency:ke||"USD",tokenIconUrl:Pt,networkIconUrl:Rt,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionLabel,children:N}),be?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionHint,children:be}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(om,{status:v.status,colors:x,fontFamily:b.regular}),it?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:x.foregroundMuted,fontFamily:b.regular},children:it}):null]}),jsxRuntime.jsx(xr,{size:14,color:x.foregroundMuted,strokeWidth:2})]})]},v.id)})})]})})]})}function Ml({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let i=Ho(),{colors:s,fonts:a,components:l}=V(),m=l.input.placeholderColor,c=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=c.length,[C,S]=ai.useState(1),[w,u]=ai.useState(e.firstName??""),[h,y]=ai.useState(e.lastName??""),[T,p]=ai.useState(e.dobMonth??""),[k,d]=ai.useState(e.dobDay??""),[x,R]=ai.useState(e.dobYear??""),[b,I]=ai.useState(e.addressLine1??""),[A,E]=ai.useState(e.addressLine2??""),[O,F]=ai.useState(e.city??""),[z,U]=ai.useState(e.state??""),[he,Be]=ai.useState(e.postalCode??""),[We,re]=ai.useState(e.country??"US"),[Ae,Ce]=ai.useState(e.idNumber??""),ye=ai.useRef(null),He=ai.useRef(null),ae=ai.useRef(null),J=ai.useRef(null),Se=ai.useRef(null),Bt=ai.useRef(null),Ie=ai.useRef(null),Ne=ai.useRef(null),Qe=c[C-1],Ee=()=>{switch(Qe){case "name":return w.trim().length>0&&h.trim().length>0;case "dob":return T.length===2&&k.length===2&&x.length===4;case "address":return b.trim().length>0&&O.trim().length>0&&z.trim().length>0&&he.trim().length>0;case "ssn":return Ae.trim().length>0;default:return false}},Ke=()=>{Ee()&&(C<g?S(ue=>ue+1):o({firstName:w,lastName:h,idNumber:Ae,dobMonth:T,dobDay:k,dobYear:x,addressLine1:b,addressLine2:A,city:O,state:z,postalCode:he,country:We}));},gt=()=>{C>1?S(ue=>ue-1):n();},ne={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:de}=ne[Qe],Oe=[or.stepCounter,{color:s.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:or.header,children:[jsxRuntime.jsx(reactNative.View,{style:or.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:or.iconButton,onPress:gt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:C>1?"Back":"Cancel",children:jsxRuntime.jsx(sa,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:or.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Oe,children:[C," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:or.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:or.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(st,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:or.progressTrack,children:Array.from({length:g}).map((ue,Ye)=>jsxRuntime.jsx(reactNative.View,{style:[or.progressSegment,{backgroundColor:Ye<C||Ye+1===C?s.primary:s.border}]},Ye))}),jsxRuntime.jsx(at,{style:i.form.flex,contentContainerStyle:or.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[i.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:de}),Qe==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wn,{form:i.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"Jane",placeholderTextColor:m,value:w,onChangeText:u,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ye.current?.focus()})}),jsxRuntime.jsx(wn,{form:i.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ye,style:i.form.input,placeholder:"Doe",placeholderTextColor:m,value:h,onChangeText:y,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ke})})]}),Qe==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:or.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:or.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,or.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,or.dobInput],placeholder:"MM",placeholderTextColor:m,value:T,onChangeText:ue=>{let Ye=ue.replace(/\D/g,"").slice(0,2);p(Ye),Ye.length===2&&He.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:or.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,or.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:He,style:[i.form.input,or.dobInput],placeholder:"DD",placeholderTextColor:m,value:k,onChangeText:ue=>{let Ye=ue.replace(/\D/g,"").slice(0,2);d(Ye),Ye.length===2&&ae.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:or.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,or.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ae,style:[i.form.input,or.dobInput],placeholder:"YYYY",placeholderTextColor:m,value:x,onChangeText:ue=>{let Ye=ue.replace(/\D/g,"").slice(0,4);R(Ye);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ke})]})]}),Qe==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wn,{form:i.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123 Main St",placeholderTextColor:m,value:b,onChangeText:I,returnKeyType:"next",onSubmitEditing:()=>J.current?.focus()})}),jsxRuntime.jsx(wn,{form:i.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:i.form.input,placeholder:"Apt 2",placeholderTextColor:m,value:A,onChangeText:E,returnKeyType:"next",onSubmitEditing:()=>Se.current?.focus()})}),jsxRuntime.jsx(wn,{form:i.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:i.form.input,placeholder:"San Francisco",placeholderTextColor:m,value:O,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Bt.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:or.row,children:[jsxRuntime.jsx(reactNative.View,{style:[i.form.flex,{marginRight:8}],children:jsxRuntime.jsx(wn,{form:i.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Bt,style:i.form.input,placeholder:"CA",placeholderTextColor:m,value:z,onChangeText:ue=>U(ue.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ie.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:i.form.flex,children:jsxRuntime.jsx(wn,{form:i.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ie,style:i.form.input,placeholder:"94001",placeholderTextColor:m,value:he,onChangeText:Be,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Ne.current?.focus()})})})]}),jsxRuntime.jsx(wn,{form:i.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ne,style:i.form.input,placeholder:"US",placeholderTextColor:m,value:We,onChangeText:ue=>re(ue.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ke})})]}),Qe==="ssn"&&jsxRuntime.jsxs(wn,{form:i.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:m,value:Ae,onChangeText:Ce,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ke}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,or.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t&&C>=g?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(ot,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!Ee()&&i.form.continueBtnDisabled],onPress:Ke,disabled:!Ee(),children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!Ee()&&i.form.continueBtnTextDisabled],children:C>=g?"Submit":"Continue"})})})]})})}function wn({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var or=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var $d="@unifold/stripe_oauth";async function pm(){try{let e=await Nd__default.default.getItem($d);return e?JSON.parse(e):null}catch{return null}}async function jd(e){try{await Nd__default.default.setItem($d,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function gs(){try{await Nd__default.default.removeItem($d);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Sy=5,Gn=null,mm={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function zl(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:m,registerWalletAddress:c,collectPaymentMethod:g,createCryptoPaymentToken:C,logOut:S}=stripeReactNative.useOnramp(),[w,u]=ai.useState(r),[h,y]=ai.useState(!!e?.externalUserId),[T,p]=ai.useState(false),[k,d]=ai.useState(""),[x,R]=ai.useState(null),[b,I]=ai.useState(e?.email??""),[A,E]=ai.useState(e?.phone??""),[O,F]=ai.useState(""),[z,U]=ai.useState("US"),[he,Be]=ai.useState(""),[We,re]=ai.useState(""),Ae=ai.useRef(""),Ce=ai.useRef(""),ye=ai.useRef(""),[He,ae]=ai.useState(false),[J,Se]=ai.useState(false),Bt=ai.useRef(0),Ie=ai.useRef(false),Ne=ai.useRef(false),Qe=ai.useRef(false),Ee=ai.useRef(false),Ke=ai.useRef(e?.email??""),gt=ai.useRef(false),ne=ai.useRef(null),de=ai.useRef(""),Oe=ai.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ue=ai.useRef(null),[Ye,Qt]=ai.useState(0),[yt,Fe]=ai.useState(mm),[dt,fe]=ai.useState(e?.defaultWalletAddress??""),[ie,_e]=ai.useState(""),[et,xt]=ai.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[pe,Me]=ai.useState(e?.defaultSourceAmount??"100"),[Wt,nt]=ai.useState(e?.defaultSourceCurrency??"usd"),[wr,er]=ai.useState(e?.defaultDestinationCurrency??"usdc"),[$e,Cr]=ai.useState(null),[q,se]=ai.useState(),[D,v]=ai.useState(),[L,N]=ai.useState(false),ke=ai.useRef(null),be=ai.useRef(false),it=ai.useRef(0),le=ai.useRef(e?.onComplete),Pt=ai.useRef(e?.onError),Rt=ai.useRef(e?.onStepChange),yo=ai.useRef(r);ai.useEffect(()=>{le.current=e?.onComplete;},[e?.onComplete]),ai.useEffect(()=>{Pt.current=e?.onError;},[e?.onError]),ai.useEffect(()=>{Rt.current=e?.onStepChange;},[e?.onStepChange]);let Br=ai.useRef(r);ai.useEffect(()=>{w!==Br.current&&(Up(w,`from: ${Br.current}`),Rt.current?.(w,Br.current),Br.current=w),yo.current=w;},[w]),ai.useEffect(()=>{h&&w!==r&&y(false);},[h,w,r]);let K=ai.useCallback((_,P,$)=>{let Y={code:_,message:P,step:yo.current,stripeErrorCode:$};Ol(`${_}: ${P}`,$?`stripeErrorCode: ${$}`:void 0),R(Y),d(""),Pt.current?.(Y);},[]),Gc=ai.useCallback(_=>{let P={sessionId:_.id,status:_.status,sourceAmount:_.transaction_details.source_amount,sourceCurrency:_.transaction_details.source_currency,destinationAmount:_.transaction_details.destination_amount,destinationCurrency:_.transaction_details.destination_currency,destinationNetwork:_.transaction_details.destination_network,walletAddress:_.transaction_details.wallet_address,fees:{networkFee:_.transaction_details.fees.network_fee_amount,transactionFee:_.transaction_details.fees.transaction_fee_amount}};return le.current?.(P),P},[]),bt=ai.useCallback(()=>R(null),[]),G=_=>_.refresh_token??_.refresh?.refresh_token??"",me=ai.useCallback((_,P,$,Y,ce)=>{Ce.current=P,Ae.current=$,e?.externalUserId&&jd({accessToken:P,refreshToken:$,customerId:_,externalUserId:e.externalUserId,email:ce||b,expiresAt:Date.now()+Y*1e3});},[e?.externalUserId,b]),Ot=ai.useCallback(async()=>{let _=Ae.current;if(!_)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let P=await Id(_,ye.current??void 0),$=P.access_token,Y=G(P)||_;return re($),me(ye.current,$,Y,P.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),$}catch(P){return console.error("[tryRefreshAccessToken] refresh failed:",P?.message),await gs(),Gn=null,ue.current=null,Ce.current="",Ae.current="",ye.current="",re(""),Be(""),null}},[me]),Dr=ai.useCallback(async _=>{try{return await _(Ce.current)}catch(P){let $=P?.message??"";if($.includes("stripe_onramp_forbidden")||$.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let Y=await Ot();if(!Y)throw K("authorization_error","Session expired. Please sign in again."),u("email"),P;return await _(Y)}throw P}},[Ot,K]);ai.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){N(false);return}let P=false;return stripeReactNative.isPlatformPaySupported().then($=>{P||N($);}),()=>{P=true;}},[e?.merchantIdentifier]),ai.useEffect(()=>(be.current=false,()=>{be.current=true,ke.current&&clearTimeout(ke.current);}),[]);let ta=ai.useRef(false);ai.useEffect(()=>{if(ta.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),gs(),Gn=null,ue.current=null,y(false);return}let _=false;return (async()=>{try{let P=await pm();if(_||!P){_||y(!1);return}if(P.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",P.externalUserId,"current:",e.externalUserId),await gs(),Gn=null,ue.current=null,_||y(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",P.customerId);let $=Date.now()>=P.expiresAt,Y=P.accessToken,ce=P.refreshToken;if($){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let we=await Id(P.refreshToken,P.customerId);if(_)return;Y=we.access_token,ce=we.refresh_token??we.refresh?.refresh_token??P.refreshToken,await jd({accessToken:Y,refreshToken:ce,customerId:P.customerId,externalUserId:e.externalUserId,email:P.email,expiresAt:Date.now()+(we.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(we){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",we?.message),await gs(),Gn=null,ue.current=null,_||y(!1);return}}if(_)return;if(ta.current=!0,Be(P.customerId),ye.current=P.customerId,re(Y),Ce.current=Y,Ae.current=ce,console.log("[useStripeOnramp] restore email from storage:",P.email??"(not stored)"),P.email&&(I(P.email),Ke.current=P.email),Gn===P.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",P.customerId,"\u2014 skipping configure()"),ue.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",P.customerId);let we=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:P.customerId});we.error?console.error("[useStripeOnramp] restore configureSDK error:",we.error.message):Gn=P.customerId,ue.current=Promise.resolve(we);}if(_)return;let _t=()=>new Promise(we=>{let tt=()=>{gt.current&&de.current?we():setTimeout(tt,200);};tt();});try{if(await Promise.race([_t(),new Promise((tt,At)=>setTimeout(()=>At(new Error("timeout")),1e4))]),_)return;let we=de.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",we,"network:",Oe.current),await c(we,Oe.current);}catch(we){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",we?.message);}if(_)return;try{(await Hn(ye.current,Ce.current)).verifications.find(At=>At.name==="kyc_verified")?.status!=="verified"?(console.log("[useStripeOnramp] credentials restored but KYC not verified \u2014 going to kyc"),u("kyc")):(console.log("[useStripeOnramp] credentials restored, KYC verified \u2014 skipping to session_params"),u("session_params"));}catch{console.log("[useStripeOnramp] credentials restored, could not check KYC \u2014 defaulting to kyc"),u("kyc");}}finally{_||y(false);}})(),()=>{_=true;}},[]),ai.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress){console.log("[resolveWallet] skipping \u2014 missing:",e?.publishableKey?"":"publishableKey",e?.externalUserId?"":"externalUserId",e?.recipientAddress?"":"recipientAddress");return}if(He)return;let _=false;Se(true);async function P(){try{console.log("[resolveWallet] fetching deposit address for:",e.externalUserId,e.recipientAddress);let[$,Y]=await Promise.all([Jp({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?Zp({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Mt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Mt?.message),null)):Promise.resolve(null)]);if(_){console.log("[resolveWallet] cancelled after fetch \u2014 discarding stale result");return}let ce=e?.destinationChainType??"ethereum",_t=$.data.find(Mt=>Mt.chain_type===ce);if(_t?.address){let Mt=_t.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Mt,"recipient:",_t.recipient_address),fe(Mt),de.current=Mt,_t.recipient_address&&_e(_t.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",ce,"in",$.data?.length,"wallets");let we={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},tt={8453:"base",1:"ethereum",137:"polygon"},At=Y?.destination_network,Tr="none";if(At&&we[At])xt(we[At]),Oe.current=we[At],Tr=At+" (from default_token API)";else if(e?.destinationChainId&&tt[e.destinationChainId]){let Mt=tt[e.destinationChainId];we[Mt]&&(xt(we[Mt]),Oe.current=we[Mt]),Tr=Mt+" (from chain_id "+e.destinationChainId+")";}else we[ce]&&(xt(we[ce]),Oe.current=we[ce],Tr=ce+" (from chain_type fallback)");Y?.destination_currency&&er(Y.destination_currency.toLowerCase());let Et=Y?.destination_token_metadata,lr=Nn(Et?.icon_urls,Et?.icon_url),Ar=Nn(Et?.chain?.icon_urls,Et?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",lr,"network:",Ar),lr&&se(lr),Ar&&v(Ar),console.log("[resolveWallet] \u2705 setting walletReady = true"),ae(!0),gt.current=!0;}catch($){if(_)return;console.error("[resolveWallet] Failed to resolve wallet:",$?.message),ae(true),gt.current=true;}finally{_||Se(false);}}return ne.current=P(),()=>{_=true;}},[e?.publishableKey,e?.externalUserId,Ye]);let Wr=ai.useCallback(async()=>{if(ue.current)return ue.current;let _=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(P=>(P.error&&(console.error("[useStripeOnramp] configureSDK error:",P.error.message,P.error.code),ue.current=null),P)).catch(P=>{throw console.error("[useStripeOnramp] configureSDK threw:",P?.message??P),ue.current=null,P});return ue.current=_,_},[o,e?.merchantDisplayName]);ai.useEffect(()=>{e?.externalUserId||Wr();},[]);let oo=ai.useCallback(async _=>{if(!Ie.current){Ie.current=true,p(true),bt(),d("Creating auth intent...");try{let P=await vd(_);d("Waiting for authorization...");let $=await s(P);if($?.error){console.log("[proceedToAuthorize] authorize error:",$.error.message),K("authorization_error","Something went wrong during authorization. Please try again."),u("email");return}if($?.status==="Denied"){K("authorization_error","Authorization denied by user."),u("email");return}if($?.status!=="Consented"||!$.customerId){K("authorization_error","Authorization was canceled."),u("email");return}d("Exchanging tokens...");let Y=$.customerId,ce=await qp(P,Y),_t=ce.access_token,we=G(ce);console.log("[useStripeOnramp] customerId:",Y),console.log("[useStripeOnramp] accessToken acquired, length:",_t.length),I(_),Ke.current=_,Be(Y),ye.current=Y,Gn=Y,re(_t),me(Y,_t,we,ce.expires_in??3600,_),d("Checking verification status...");try{let tt=await Hn(Y,_t),At=tt.verifications.find(Ar=>Ar.name==="kyc_verified"),Tr=At?.status==="verified",Et=At?.status==="rejected",lr=tt.provided_fields.includes("first_name");if(d(""),Et&&!lr)K("kyc_error","KYC was previously rejected. Please submit with correct info."),u("kyc");else if(!Tr)u("kyc");else {ne.current&&(d("Resolving wallet..."),await ne.current,d(""));let Ar=de.current;if(Ar)try{let Mt=Ar.toLowerCase(),oa=Oe.current;console.log("[proceedToAuthorize] registering wallet:",Mt,"network:",oa);let wi=await c(Mt,oa);wi?.error?(console.warn("[proceedToAuthorize] wallet registration error:",wi.error.message),K("wallet_error",wi.error.message,wi.error.code),u("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),u("kyc_offer"));}catch(Mt){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Mt?.message),u("wallet");}else console.log("[proceedToAuthorize] no resolved deposit address available, going to wallet step"),u("wallet");}}catch(tt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",tt?.message),d(""),u("kyc");}}catch(P){K("authorization_error",P?.message??String(P)),u("email");}finally{Ie.current=false,p(false);}}},[s,bt,K,me,c,et]),Fh=ai.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!b){K("validation_error","Please enter an email address.");return}p(true),bt(),d("");try{d("Configuring...");let _=await Wr();if(_.error){K("configuration_error",_.error.message,_.error.code);return}d("Checking Link account...");let P=await n(b);if(P.error){K("authorization_error",P.error.message,P.error.code);return}console.log("[checkEmail] link.hasLinkAccount:",P.hasLinkAccount),P.hasLinkAccount?await oo(b):(d(""),u("disclaimer"));}catch(_){K("unknown_error",_?.message??String(_));}finally{p(false);}},[bt,Wr,b,K,n,oo]),Dh=ai.useCallback(async()=>{if(!Qe.current){if(!A){K("validation_error","Please enter your phone number.");return}Qe.current=true,p(true),bt(),d("");try{d("Creating Link account...");let _=await i({email:b,phone:A,fullName:O||b,country:z||"US"});if(_.error){K("registration_error",_.error.message,_.error.code);return}await oo(b);}catch(_){K("registration_error",_?.message??String(_));}finally{Qe.current=false,p(false);}}},[bt,z,b,K,O,A,i,oo]);ai.useEffect(()=>{if(w!=="email"||!e?.email||h)return;if(Ee.current){Ee.current=false;return}let _=++Bt.current,P=false,$=()=>P||Bt.current!==_;return e?.phone?(async()=>{p(true),bt();try{d("Configuring...");let Y=await Wr();if($())return;if(Y.error){K("configuration_error",Y.error.message,Y.error.code);return}d("Checking Link account...");let ce=await n(e.email);if($())return;if(ce.error){K("authorization_error",ce.error.message,ce.error.code);return}if(ce.hasLinkAccount){if($())return;await oo(e.email);}else {if($())return;d(""),u("disclaimer");}}catch(Y){$()||K("unknown_error",Y?.message??String(Y));}finally{p(false);}})():(async()=>{p(true),bt();try{d("Configuring...");let Y=await Wr();if($())return;if(Y.error){K("configuration_error",Y.error.message,Y.error.code);return}d("Checking Link account...");let ce=await n(e.email);if($())return;if(ce.error){K("authorization_error",ce.error.message,ce.error.code);return}if(ce.hasLinkAccount){if($())return;await oo(e.email);}else {if($())return;d(""),u("disclaimer");}}catch(Y){$()||K("unknown_error",Y?.message??String(Y));}finally{p(false);}})(),()=>{P=true;}},[w,e?.email,e?.phone,h]);let il=ai.useCallback(async()=>{ne.current&&(d("Resolving wallet..."),await ne.current);let _=de.current;if(_)try{d("Registering wallet...");let P=_.toLowerCase(),$=Oe.current;console.log("[resolveAndRegisterWallet] registering wallet:",P,"network:",$),await c(P,$);}catch(P){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",P?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[c]),Vh=ai.useCallback(async(_,P)=>{p(true),bt(),d(""),Fe(ce=>({...ce,..._}));let $=P??"kyc_offer",Y=P?"kyc_l1":"kyc";try{let ce=_.dobDay&&_.dobMonth&&_.dobYear,_t=_.firstName&&_.lastName,we={};_t&&(we.firstName=_.firstName,we.lastName=_.lastName),_.addressLine1&&(we.address={line1:_.addressLine1,line2:_.addressLine2||void 0,city:_.city,state:_.state,postalCode:_.postalCode,country:_.country}),_.idNumber&&(we.idNumber=_.idNumber),ce&&(we.dateOfBirth={day:parseInt(_.dobDay,10),month:parseInt(_.dobMonth,10),year:parseInt(_.dobYear,10)}),console.log("[attachKyc] sending kycInfo:",JSON.stringify(we,null,2));let tt=await a(we);if(console.log("[attachKyc] attachKycInfo result:",JSON.stringify(tt,null,2)),tt?.error?.message&&(/no active link consumer/i.test(tt.error.message)||/not be verified/i.test(tt.error.message))){if(console.log("[attachKyc] Link session invalid \u2014 re-establishing session"),d("Verifying identity..."),!await ra()){K("kyc_error","Please verify your identity to continue."),u(Y);return}tt=await a(we),console.log("[attachKyc] retry attachKycInfo result:",JSON.stringify(tt,null,2));}if(tt?.error){if(tt.error.stripeErrorCode==="consumer_person_already_verified"){console.log("[attachKyc] already verified, resolving wallet before",$),await il(),d(""),u($);return}K("kyc_error",tt.error.message,tt.error.stripeErrorCode??tt.error.code),u(Y);return}if(!(tt&&Object.keys(tt).length>0&&!tt.error)){let lr=P?"l1":"l0";if(console.log(`[attachKyc] success (no verification needed), waiting for ${lr} verified...`),d("Verifying identity..."),!ye.current||!Ce.current){console.warn(`[attachKyc] \u274C cannot poll ${lr} \u2014 missing customerIdRef or accessTokenRef`),K("kyc_error","Unable to verify identity. Please try again."),u(Y);return}let Ar=ye.current,Mt=Ce.current,oa=10,wi=!1;for(let Xc=0;Xc<oa;Xc++){try{let dl=(await Hn(Ar,Mt)).kyc_tiers?.find(Uh=>Uh.tier===lr);if(console.log(`[attachKyc] ${lr} poll #${Xc+1}: verification_status=${dl?.verification_status}`),dl?.verification_status==="verified"){console.log(`[attachKyc] \u2705 ${lr} verified!`),wi=!0;break}if(dl?.verification_status==="rejected"){console.warn(`[attachKyc] \u274C ${lr} rejected:`,dl?.verification_errors),K("kyc_error","KYC verification was rejected. Please try again."),u(Y);return}}catch(cl){console.warn(`[attachKyc] ${lr} poll error:`,cl?.message);}await new Promise(cl=>setTimeout(cl,2e3));}if(!wi){console.warn(`[attachKyc] \u274C ${lr} verification timed out after`,oa,"attempts"),K("kyc_error","Identity verification is taking longer than expected. Please try again."),u(Y);return}await il(),d(""),u($);return}console.log("[attachKyc] calling presentKycInfoVerification..."),d("Please review your KYC information...");let Et=await l(null);if(console.log("[attachKyc] presentKycInfoVerification result:",JSON.stringify(Et,null,2)),Et?.error){K("kyc_error",Et.error.message,Et.error.stripeErrorCode??Et.error.code),u(Y);return}if(Et?.status==="UpdateAddress"){K("kyc_error","Please update your address and resubmit."),u(Y);return}await il(),d(""),console.log("[attachKyc] success, navigating to:",$),u($);}catch(ce){K("kyc_error",ce?.message??String(ce)),u(Y);}finally{p(false);}},[a,bt,K,l,il]),ra=ai.useCallback(async()=>{let _=Ke.current||e?.email;if(!_)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(Ke.current),"config.email:",e?.email),false;try{console.log("[reestablishLinkSession] re-establishing Link session for:",_);let P=await vd(_),$=await s(P);return $?.status==="Consented"&&$.customerId?(console.log("[reestablishLinkSession] success, customerId:",$.customerId),ye.current=$.customerId,Be($.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",$?.status),!1)}catch(P){return console.warn("[reestablishLinkSession] failed:",P?.message),false}},[s,e?.email]),dp=ai.useCallback(async()=>{if(!Ne.current){Ne.current=true,p(true),bt(),d("Launching identity verification...");try{let _=await m();if(_?.error?.message&&(/no active link consumer/i.test(_.error.message)||/not be verified/i.test(_.error.message))){if(console.log("[verifyIdentity] Link session invalid \u2014 re-establishing session"),d("Verifying identity..."),!await ra()){K("identity_error","Please verify your identity to continue.");return}_=await m();}if(_?.error){let $=_.error.message??"";if(/cancel/i.test($)){console.log("[verifyIdentity] cancelled by user, returning silently"),d("");return}K("identity_error",$,_.error.code);return}d(""),sl.current?(sl.current=!1,u("session_params")):u("wallet");}catch(_){K("identity_error",_?.message??String(_));}finally{Ne.current=false,p(false);}}},[bt,K,ra,m]),sl=ai.useRef(false);ai.useEffect(()=>{w==="identity"&&!T&&dp();},[w]);let up=ai.useCallback(async()=>{if(console.log("[registerWallet] called. walletAddress:",dt,"walletNetwork:",et),!dt){K("validation_error","Please enter a wallet address.");return}p(true),bt(),d("");try{let _=dt.toLowerCase();console.log("[registerWallet] registering wallet:",_,"network:",et);let P=await c(_,et);if(console.log("[registerWallet] result:",JSON.stringify(P,null,2)),P?.error){console.warn("[registerWallet] error:",P.error.message),K("wallet_error",P.error.message,P.error.code);return}console.log("[registerWallet] wallet registered successfully \u2192 kyc_offer"),d(""),u("kyc_offer");}catch(_){console.error("[registerWallet] exception:",_?.message??String(_)),K("wallet_error",_?.message??String(_));}finally{p(false);}},[bt,K,dt,et,c]);ai.useEffect(()=>{console.log("[auto-register] step:",w,"walletReady:",He,"walletAddress:",dt||"(empty)"),w==="wallet"&&He&&dt&&(console.log("[auto-register] triggering registerWallet() with address:",dt),up());},[w,He,dt]);let al=ai.useCallback(_=>{be.current=false,it.current=0;let P=0,$=async()=>{P+=1;let Y=Ce.current;try{let ce=await Gp(_,Y);if(console.log(`[pollSessionStatus] poll #${P} session=${_} status="${ce.status}"`),be.current)return;it.current=0,ce.status==="fulfillment_complete"?(Cr(ce),u("success")):ke.current=setTimeout($,3e3);}catch(ce){if(be.current)return;let _t=ce?.message??"";if((_t.includes("stripe_onramp_forbidden")||_t.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Ot()&&!be.current)){ke.current=setTimeout($,1e3);return}if(it.current+=1,console.error(`[pollSessionStatus] poll #${P} error:`,_t),it.current>=Sy){K("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}ke.current=setTimeout($,5e3);}};ke.current=setTimeout($,3e3);},[K,Ot]),Lh=ai.useCallback(()=>{if(yo.current==="processing"&&$e?.id){if(!Ce.current){K("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}bt(),it.current=0,ke.current&&(clearTimeout(ke.current),ke.current=null),al($e.id);}},[bt,K,al,$e?.id]),ll=ai.useCallback(async _=>{p(true),bt(),d("");try{d("Confirming purchase...");let P=await Dr($=>Qp(_,$));console.log("[finalizeOnrampSession] confirmed session:",P.id,"status:",P.status),Cr(P),u("processing"),d(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",P.id),al(P.id);}finally{p(false);}},[bt,al,Dr]),Jc=ai.useRef(false),Bh=ai.useCallback(async()=>{if(!(!$e||Jc.current)){Jc.current=true;try{p(!0),bt(),d("Refreshing quote...");let _=await Dr(P=>Pd($e.id,P));Cr(_),await ll(_.id);}catch(_){console.log("[confirmCheckout] error:",_?.message),K("session_error","Something went wrong. Please try again."),u("quote");}finally{p(false),Jc.current=false;}}},[bt,K,ll,$e,Dr]),Wh=ai.useCallback(async(_=false,P,$)=>{let Y=P??pe;if(console.log("[collectPaymentMethod] called:",{useApplePay:_,amt:Y,amountOverride:P,sourceAmount:pe,hasSavedToken:!!$}),!Y||isNaN(Number(Y))||Number(Y)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),K("validation_error","Please enter a valid amount.");return}P&&Me(P),p(true),bt(),d("");try{let ce=await Wr();if(ce.error){K("configuration_error",ce.error.message,ce.error.code);return}let _t;if($)console.log("[collectPaymentMethod] using saved payment token"),_t=$;else if(_){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),K("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),u("session_params");return}d("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let At={applePay:{merchantCountryCode:"US",currencyCode:Wt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${wr.toUpperCase()} purchase + fees`,amount:Y}]}},Tr=await g("PlatformPay",At);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!Tr?.error),Tr?.error){let lr=Tr.error.message??"",Ar=Tr.error.code??"",Mt=/cancel/i.test(lr)||/cancel/i.test(Ar);console.log("[collectPaymentMethod] pmResult error:",Tr.error,"isCancellation:",Mt),Mt||(K("payment_error",lr,Ar),u("session_params"));return}if(!Tr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}d("Creating payment token...");let Et=await C();if(console.log("[collectPaymentMethod] tokenResult ok:",!Et?.error),Et?.error){K("payment_error",Et.error.message,Et.error.code),u("session_params");return}_t=Et.cryptoPaymentToken;}else {d("Select a payment method...");let At=await g("Card");if(console.log("[collectPaymentMethod] Card result ok:",!At?.error),At?.error){let lr=At.error.message??"",Ar=At.error.code??"",Mt=/cancel/i.test(lr)||/cancel/i.test(Ar);console.log("[collectPaymentMethod] pmResult error:",At.error,"isCancellation:",Mt),Mt||(K("payment_error",lr,Ar),u("session_params"));return}if(!At?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let Tr=At.displayData;console.log("[collectPaymentMethod] displayData:",{type:Tr.type,label:Tr.label,sublabel:Tr.sublabel,hasIcon:!!Tr.icon}),d("Creating payment token...");let Et=await C();if(console.log("[collectPaymentMethod] tokenResult ok:",!Et?.error),Et?.error){K("payment_error",Et.error.message,Et.error.code),u("session_params");return}_t=Et.cryptoPaymentToken;}d("Creating onramp session...");let we=de.current||dt;if(console.log("[collectPaymentMethod] creating onramp session, sessionWalletAddress:",we),!we){K("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let tt=await Dr(At=>Kp({cryptoCustomerId:ye.current,paymentToken:_t,sourceAmount:Number(Y),sourceCurrency:Wt,destinationCurrency:wr,walletAddress:we,destinationNetwork:et},At));console.log("[collectPaymentMethod] session created:",tt?.id,"useApplePay:",_),Cr(tt),d(""),_?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await ll(tt.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):u("quote");}catch(ce){console.log("[collectPaymentMethod] error caught:",ce?.message),K("session_error","Something went wrong. Please try again."),u("session_params");}finally{p(false),d("");}},[bt,Wr,g,C,wr,K,ll,Me,pe,Wt,dt,et,Dr,e?.merchantIdentifier]),Ah=ai.useCallback(async()=>{p(true),bt(),d("Select a payment method...");try{let _=await Wr();if(_.error)return K("configuration_error",_.error.message,_.error.code),null;let P=await g("Card");if(console.log("[addPaymentMethod] Card result ok:",!P?.error),P?.error?.message&&(/no active link consumer/i.test(P.error.message)||/not be verified/i.test(P.error.message))){if(console.log("[addPaymentMethod] Link session invalid \u2014 re-establishing session"),!await ra())return K("authorization_error","Please verify your identity to add a payment method."),null;P=await g("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!P?.error);}if(P?.error){let _t=P.error.message??"",we=P.error.code??"",tt=/cancel/i.test(_t)||/cancel/i.test(we);return console.log("[addPaymentMethod] pmResult error:",P.error,"isCancellation:",tt),tt||K("payment_error",_t,we),null}if(!P?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let Y=P.displayData;console.log("[addPaymentMethod] displayData:",{type:Y.type,label:Y.label,sublabel:Y.sublabel,hasIcon:!!Y.icon}),d("Saving payment method...");let ce=await C();return console.log("[addPaymentMethod] tokenResult ok:",!ce?.error),ce?.error?(K("payment_error",ce.error.message,ce.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:ce.cryptoPaymentToken,sublabel:Y.sublabel??""})}catch(_){return console.log("[addPaymentMethod] error:",_?.message),K("session_error",_?.message??String(_)),null}finally{p(false),d("");}},[bt,Wr,g,C,K,ra]),Eh=ai.useCallback(async()=>{if($e){p(true),bt(),d("");try{let _=await Dr(P=>Pd($e.id,P));Cr(_);}catch(_){console.log("[refreshQuote] error:",_?.message),K("session_error","Something went wrong. Please try again.");}finally{p(false);}}},[bt,K,$e,Dr]),Zc=ai.useCallback(()=>{be.current=true,it.current=0,ke.current&&(clearTimeout(ke.current),ke.current=null),u(r),p(false),d(""),R(null),I(e?.email??""),Ke.current=e?.email??"",E(e?.phone??""),F(""),U("US"),Be(""),ye.current="",re(""),Ce.current="",Ae.current="",ae(false),Se(false),ne.current=null,Qt(_=>_+1),Fe(mm),fe(""),de.current="",gt.current=false,xt(stripeReactNative.Onramp.CryptoNetwork.ethereum),Me(e?.defaultSourceAmount??"100"),nt(e?.defaultSourceCurrency??"usd"),er(e?.defaultDestinationCurrency??"usdc"),_e(""),se(void 0),v(void 0),Cr(null),Bt.current+=1,Ie.current=false,Ne.current=false,Qe.current=false;},[e,r]),Mh=ai.useCallback(()=>{sl.current=true,u("kyc_offer");},[]),zh=ai.useCallback(async()=>{try{await S();}catch(_){console.warn("[logout] Stripe SDK logOut failed (non-fatal):",_?.message);}await gs(),Gn=null,ue.current=null,Ee.current=true,Zc();},[Zc,S]);return {step:w,restoring:h,loading:T,status:k,error:x,email:b,phone:A,fullName:O,country:z,customerId:he,accessToken:We,session:$e,kycData:yt,walletAddress:dt,resolvedRecipientAddress:ie,walletNetwork:et,sourceAmount:pe,sourceCurrency:Wt,destinationCurrency:wr,tokenIconUrl:q,networkIconUrl:D,applePaySupported:L,walletReady:He,walletLoading:J,setStep:u,setStatus:d,setEmail:I,setPhone:E,setFullName:F,setCountry:U,setWalletAddress:fe,setWalletNetwork:xt,setSourceAmount:Me,setSourceCurrency:nt,setDestinationCurrency:er,checkEmail:Fh,register:Dh,attachKyc:Vh,verifyIdentity:dp,requestKYCUpgrade:Mh,kycUpgradeMode:sl,logout:zh,registerWallet:up,collectPaymentMethod:Wh,addPaymentMethod:Ah,refreshQuote:Eh,confirmCheckout:Bh,reset:Zc,clearError:bt,emitComplete:Gc,resumeFulfillmentPolling:Lh,amountFirst:t}}function fm({initialData:e={},loading:t=false,onComplete:r,onCancel:o,onClose:n}){let i=Ho(),{colors:s,fonts:a,components:l}=V(),m=l.input.placeholderColor,[c,g]=ai.useState(e.dobMonth??""),[C,S]=ai.useState(e.dobDay??""),[w,u]=ai.useState(e.dobYear??""),[h,y]=ai.useState(e.idNumber??""),T=ai.useRef(null),p=ai.useRef(null),k=ai.useRef(null),d=c.length===2&&C.length===2&&w.length===4&&h.trim().length>0,x=()=>{console.log("[KYCL1Screen] handleSubmit \u2014 canSubmit:",d,"dobMonth:",c,"dobDay:",C,"dobYear:",w,"idNumber:",h?"set":"empty"),d&&r({dobMonth:c,dobDay:C,dobYear:w,idNumber:h});};return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(St,{onPress:t?n??o:o,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(at,{style:i.form.flex,contentContainerStyle:Ko.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:Ko.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:Ko.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:Ko.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,Ko.dobInput],placeholder:"MM",placeholderTextColor:m,value:c,onChangeText:R=>{let b=R.replace(/\D/g,"").slice(0,2);g(b),b.length===2&&T.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Ko.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:T,style:[i.form.input,Ko.dobInput],placeholder:"DD",placeholderTextColor:m,value:C,onChangeText:R=>{let b=R.replace(/\D/g,"").slice(0,2);S(b),b.length===2&&p.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Ko.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:p,style:[i.form.input,Ko.dobInput],placeholder:"YYYY",placeholderTextColor:m,value:w,onChangeText:R=>{let b=R.replace(/\D/g,"").slice(0,4);u(b),b.length===4&&k.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ko.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:k,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:m,value:h,onChangeText:y,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:x,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(ot,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!d&&i.form.continueBtnDisabled],onPress:x,disabled:!d,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!d&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Ko=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 Kd({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ai.useRef(new reactNative.Animated.Value(.3)).current;return ai.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:[ze.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n}],children:[jsxRuntime.jsx(reactNative.View,{style:ze.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[ze.skeletonLine,{width:"60%"}]})]})}function hm({onRefresh:e,colors:t,fonts:r}){let[o,n]=ai.useState(10),i=ai.useRef(null);ai.useEffect(()=>(i.current=setInterval(()=>{n(a=>a<=1?(i.current&&clearInterval(i.current),0):a-1);},1e3),()=>{i.current&&clearInterval(i.current);}),[]);let s=ai.useCallback(()=>{o>0||(e(),n(10),i.current=setInterval(()=>{n(a=>a<=1?(i.current&&clearInterval(i.current),0):a-1);},1e3));},[o,e]);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:s,disabled:o>0,style:[ze.refreshBtn,{opacity:o>0?.4:1}],activeOpacity:.7,children:[jsxRuntime.jsx(ns,{size:14,color:t.foregroundMuted,strokeWidth:2}),o>0?jsxRuntime.jsxs(reactNative.Text,{style:[ze.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]}):null]})}function wm({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:i=false,loadingTiers:s=false,error:a,l0Status:l="not_started",l1Status:m="not_started",l2Status:c="not_started",l1Completed:g=false,l2Completed:C=false,currentLimit:S}){let w=Ho(),{colors:u,fonts:h,components:y}=V(),T=[ze.card,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius??12,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],p=[...T,{opacity:.5}],k=l==="verified",d=m==="verified",x=c==="verified",R=g&&!d,b=C&&!x,I=x,A=k&&!d,E=k&&!x,O=d,F=!I,z=U=>`$${U.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:w.form.screen,children:[jsxRuntime.jsx(St,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:ze.content,children:[S!==void 0?jsxRuntime.jsxs(reactNative.View,{style:[ze.limitBadge,{backgroundColor:y.card.backgroundColor,borderColor:y.card.borderColor,borderWidth:y.card.borderWidth,borderRadius:y.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.limitLabel,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[ze.limitValue,{color:u.foreground,fontFamily:h.semibold}],children:[z(S)," USD"]})]}):jsxRuntime.jsx(Kd,{borderRadius:y.card.borderRadius??12,backgroundColor:y.card.backgroundColor,borderColor:y.card.borderColor,borderWidth:y.card.borderWidth}),jsxRuntime.jsx(reactNative.Text,{style:[ze.subtitle,{color:u.foregroundMuted,fontFamily:h.regular}],children:s?"Checking your verification status...":I?"All verification levels have been completed. Your limits are at the maximum available.":"Complete additional verification to increase your transaction limits."}),s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kd,{borderRadius:y.card.borderRadius??12,backgroundColor:y.card.backgroundColor,borderColor:y.card.borderColor,borderWidth:y.card.borderWidth}),jsxRuntime.jsx(Kd,{borderRadius:y.card.borderRadius??12,backgroundColor:y.card.backgroundColor,borderColor:y.card.borderColor,borderWidth:y.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[A&&(d?jsxRuntime.jsxs(reactNative.View,{style:p,children:[jsxRuntime.jsxs(reactNative.View,{style:ze.completedRow,children:[jsxRuntime.jsx(Qr,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foreground,fontFamily:h.semibold,flex:1}],children:"Date of Birth & SSN"}),jsxRuntime.jsx(De,{size:18,color:u.primary,strokeWidth:2.5})]}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular,marginLeft:28}],children:"Completed"})]}):R?jsxRuntime.jsxs(reactNative.View,{style:T,children:[jsxRuntime.jsxs(reactNative.View,{style:ze.pendingHeader,children:[jsxRuntime.jsx(Qr,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foreground,fontFamily:h.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(hm,{onRefresh:n,colors:u,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[ze.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(ot,{size:18,strokeWidth:2,gradientFrom:u.primary,gradientTo:u.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[T,ze.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(Qr,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:ze.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foreground,fontFamily:h.semibold}],children:"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Increases your per-transaction and weekly limits."})]}),jsxRuntime.jsx(xr,{size:18,color:u.foregroundMuted,strokeWidth:2})]})),E&&(x?jsxRuntime.jsxs(reactNative.View,{style:p,children:[jsxRuntime.jsxs(reactNative.View,{style:ze.completedRow,children:[jsxRuntime.jsx(la,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foreground,fontFamily:h.semibold,flex:1}],children:"Photo ID & Selfie"}),jsxRuntime.jsx(De,{size:18,color:u.primary,strokeWidth:2.5})]}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular,marginLeft:28}],children:"Completed"})]}):b?jsxRuntime.jsxs(reactNative.View,{style:T,children:[jsxRuntime.jsxs(reactNative.View,{style:ze.pendingHeader,children:[jsxRuntime.jsx(la,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foreground,fontFamily:h.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(hm,{onRefresh:n,colors:u,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[ze.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(ot,{size:18,strokeWidth:2,gradientFrom:u.primary,gradientTo:u.primary})]})]}):O?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[T,ze.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(la,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:ze.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foreground,fontFamily:h.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(xr,{size:18,color:u.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[p,ze.cardRow],children:[jsxRuntime.jsx(la,{size:20,color:u.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:ze.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.cardTitle,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[ze.cardBody,{color:u.foregroundMuted,fontFamily:h.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:ze.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[w.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,i?jsxRuntime.jsxs(reactNative.View,{style:ze.loaderRow,children:[jsxRuntime.jsx(ot,{size:24,strokeWidth:2,gradientFrom:u.primary,gradientTo:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[w.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):F?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:w.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:w.form.ghostBtnText,children:"Skip for now"})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:w.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:w.form.continueBtnText,children:"Done"})})]})]})}var ze=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},completedRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var $l={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 Sm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:i,components:s}=V(),a=[Vo.link,{color:n.primary,fontFamily:i.medium}],l=s.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:Vo.logoRow,children:jsxRuntime.jsx(wp,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:Vo.scroll,contentContainerStyle:Vo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[Vo.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vo.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vo.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Vo.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vo.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vo.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL($l.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL($l.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL($l.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL($l.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Vo.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var Vo=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function km({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:m}){let{colors:c}=V();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(ot,{size:56,strokeWidth:3}),jsxRuntime.jsx(Nr,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:m}),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(ot,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Nr,{error:n,progress:i,loading:o})]})]})})}function xm({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(ot,{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(Nr,{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 _m({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,onClose:m,onRetryStatusCheck:c}){let{colors:g}=V(),C=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[C?jsxRuntime.jsx(St,{onPress:m}):jsxRuntime.jsx(reactNative.View,{style:_l}),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(ot,{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.",`
|
|
6
|
+
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&i&&s&&jsxRuntime.jsx(Il,{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(Nr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function vm({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,tokenIconUrl:s,networkIconUrl:a,onClose:l,onBack:m}){let{colors:c}=V(),g=t.transaction_details,C=Rl(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:m??l,title:"Review your purchase",variant:m?"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(ps,{currency:g.destination_currency,tokenIconUrl:s,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(Po,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Po,{quote:e.quote,label:"You receive",value:`${C} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Po,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Po,{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(ot,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Nr,{error:o,progress:n,loading:r})]})]})}function Im({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:m}){let c=V(),{colors:g,fonts:C,components:S}=c,[w,u]=ai.useState("");ai.useEffect(()=>{if(t)return;let T=w?`+1${w}`:"";a(T);},[w,a,t]);let h=ai.useCallback(T=>{u(T.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(ot,{size:56,strokeWidth:3}),jsxRuntime.jsx(Nr,{error:o,progress:n,loading:r})]})]});let y=w.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:m}),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:Pa.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Pa.countryPrefix,{backgroundColor:S.card.backgroundColor,borderColor:S.input.borderColor,borderRadius:S.input.borderRadius,borderWidth:S.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Pa.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Pa.dialCode,{color:g.foreground,fontFamily:C.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Pa.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:w,onChangeText:h,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>y&&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(ot,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!y&&e.form.continueBtnDisabled],onPress:l,disabled:!y,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!y&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Nr,{error:o,progress:n,loading:r})]})]})})}var Pa=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 Gy({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=V(),n=e.toLowerCase(),i=vl[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:[Jo.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:i}],children:jsxRuntime.jsx(reactNative.Text,{style:[Jo.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Jo.checkBadge,{width:s,height:s,borderRadius:s/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(De,{size:s*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Pm({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:i,onDone:s}){let {colors:a,components:l,fonts:m}=V(),c=t.transaction_details,g=Rl(c.destination_amount,c.destination_currency),C=r||o||"";us(c.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:s,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(at,{style:e.form.flex,contentContainerStyle:Jo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Jo.iconSection,children:[jsxRuntime.jsx(Gy,{currency:c.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Jo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Jo.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.statusText,{color:a.foreground,fontFamily:m.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Il,{sourceCurrency:c.source_currency,destinationCurrency:c.destination_currency,destinationNetwork:c.destination_network,tokenIconUrl:n,networkIconUrl:i,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Jo.detailCard],children:[jsxRuntime.jsx(Po,{quote:e.quote,label:"You Paid",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Po,{quote:e.quote,label:"You Received",value:`${g} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Po,{quote:e.quote,label:"Network Fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Po,{quote:e.quote,label:"Transaction Fee",value:`$${c.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Rd,{quote:e.quote,label:"Intent Address",address:c.wallet_address,hideDivider:true}),C?jsxRuntime.jsx(Rd,{quote:e.quote,label:"Recipient Address",address:C,last:true}):jsxRuntime.jsx(Po,{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 Jo=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 Om({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:m,registerWallet:c,onClose:g}){let{colors:C,components:S}=V();if(t){let w=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!w&&jsxRuntime.jsx(ot,{size:56,strokeWidth:3}),jsxRuntime.jsx(Nr,{error:o,progress:n,loading:r})]}),w&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress: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:S.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:Tl.map(w=>{let u=s===w.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,u&&e.wallet.rowSelected],onPress:()=>{l(w.value),m(w.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(w.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,u&&e.wallet.rowTextSelected],children:w.label}),u&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(De,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},w.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(ot,{size:28,strokeWidth:2,gradientFrom:C.primaryForeground,gradientTo:C.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:c,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Nr,{error:o,progress:n,loading:r})]})]})})}var nb={step:"#4fc3f7",request:"#ffb74d",response:"#81c784",event:"#ce93d8",error:"#ef5350"};function Dm({maxHeight:e=200}){let[t,r]=ai.useState(Mp),[o,n]=ai.useState(false),[i,s]=ai.useState(new Set),a=ai.useRef(null);ai.useEffect(()=>zp(c=>r(c)),[]),ai.useEffect(()=>{o&&setTimeout(()=>a.current?.scrollToEnd({animated:true}),50);},[t.length,o]);let l=()=>{let c=t.map(g=>`[${g.timestamp}] [${g.type}] ${g.label}${g.detail?`
|
|
7
|
+
`+g.detail:""}`).join(`
|
|
8
|
+
|
|
9
|
+
`);reactNative.Clipboard.setString(c);},m=c=>{s(g=>{let C=new Set(g);return C.has(c)?C.delete(c):C.add(c),C});};return o?jsxRuntime.jsxs(reactNative.View,{style:[vr.container,{maxHeight:e}],children:[jsxRuntime.jsxs(reactNative.View,{style:vr.toolbar,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>n(false),style:vr.toggleBtn,children:jsxRuntime.jsx(reactNative.Text,{style:vr.toggleText,children:"\u25BC Hide"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:l,style:vr.actionBtn,children:jsxRuntime.jsx(reactNative.Text,{style:vr.actionText,children:"Copy All"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Ep,style:vr.actionBtn,children:jsxRuntime.jsx(reactNative.Text,{style:[vr.actionText,{color:"#ef5350"}],children:"Clear"})})]}),jsxRuntime.jsxs(reactNative.ScrollView,{ref:a,style:vr.scroll,showsVerticalScrollIndicator:true,children:[t.map(c=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>c.detail&&m(c.id),activeOpacity:.7,children:[jsxRuntime.jsxs(reactNative.View,{style:vr.entry,children:[jsxRuntime.jsx(reactNative.Text,{style:[vr.entryTime,{color:"#888"}],children:c.timestamp}),jsxRuntime.jsxs(reactNative.Text,{style:[vr.entryType,{color:nb[c.type]}],children:["[",c.type,"]"]}),jsxRuntime.jsx(reactNative.Text,{style:vr.entryLabel,numberOfLines:i.has(c.id)?void 0:1,children:c.label})]}),i.has(c.id)&&c.detail&&jsxRuntime.jsx(reactNative.Text,{style:vr.entryDetail,selectable:true,children:c.detail})]},c.id)),t.length===0&&jsxRuntime.jsx(reactNative.Text,{style:vr.emptyText,children:"No debug logs yet"})]})]}):jsxRuntime.jsx(reactNative.View,{style:vr.collapsedBar,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>n(true),style:vr.toggleBtn,children:jsxRuntime.jsxs(reactNative.Text,{style:vr.toggleText,children:["\u{1F41B} Debug (",t.length,")"]})})})}var vr=reactNative.StyleSheet.create({collapsedBar:{paddingHorizontal:12,paddingVertical:4},container:{backgroundColor:"#1a1a1a",borderTopWidth:1,borderTopColor:"#333"},toolbar:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,gap:12,borderBottomWidth:1,borderBottomColor:"#333"},toggleBtn:{paddingVertical:4,paddingHorizontal:8},toggleText:{color:"#aaa",fontSize:12,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},actionBtn:{paddingVertical:4,paddingHorizontal:8},actionText:{color:"#4fc3f7",fontSize:12,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},scroll:{flex:1,paddingHorizontal:8},entry:{flexDirection:"row",alignItems:"flex-start",paddingVertical:3,gap:6},entryTime:{fontSize:10,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace",minWidth:70},entryType:{fontSize:10,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace",minWidth:55},entryLabel:{fontSize:11,color:"#ddd",fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace",flex:1},entryDetail:{fontSize:10,color:"#999",fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace",paddingLeft:16,paddingBottom:6,paddingTop:2},emptyText:{color:"#666",fontSize:11,textAlign:"center",paddingVertical:20,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"}});function Vm({children:e}){return jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.View,{style:{flex:1},children:e}),jsxRuntime.jsx(Dm,{maxHeight:180})]})}function Jl({config:e,onClose:t}){let r=V(),o=Ho(),{step:n,restoring:i,loading:s,status:a,error:l,email:m,phone:c,session:g,kycData:C,walletAddress:S,resolvedRecipientAddress:w,walletNetwork:u,sourceAmount:h,sourceCurrency:y,destinationCurrency:T,tokenIconUrl:p,networkIconUrl:k,applePaySupported:d,setStep:x,setEmail:R,setPhone:b,setWalletAddress:I,setWalletNetwork:A,setSourceAmount:E,setDestinationCurrency:O,checkEmail:F,register:z,attachKyc:U,verifyIdentity:he,registerWallet:Be,collectPaymentMethod:We,addPaymentMethod:re,confirmCheckout:Ae,reset:Ce,emitComplete:ye,resumeFulfillmentPolling:He,amountFirst:ae,customerId:J,accessToken:Se,requestKYCUpgrade:Bt,kycUpgradeMode:Ie,logout:Ne}=zl(e),Qe=!!e?.email,Ee=!!e?.phone,Ke=!!e?.publishableKey&&!!e?.externalUserId,[gt,ne]=ai.useState(void 0),[de,Oe]=ai.useState(void 0),[ue,Ye]=ai.useState([]),[Qt,yt]=ai.useState(false),[Fe,dt]=ai.useState(false),[fe,ie]=ai.useState("not_started"),[_e,et]=ai.useState("not_started"),[xt,pe]=ai.useState("not_started"),[Me,Wt]=ai.useState(false);ai.useEffect(()=>{n!=="kyc_offer"||!J||!Se||(Wt(true),Hn(J,Se).then(q=>{let se=q.kyc_tiers??[],D=se.find(N=>N.tier==="l0"),v=se.find(N=>N.tier==="l1"),L=se.find(N=>N.tier==="l2");D?.verification_status&&ie(D.verification_status),v?.verification_status&&et(v.verification_status),L?.verification_status&&pe(L.verification_status),console.log("[OnrampScreen] kyc_tiers \u2014 l0:",D?.verification_status,"l1:",v?.verification_status,"l2:",L?.verification_status);}).catch(q=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",q?.message);}).finally(()=>Wt(false)),S&&Od({destinationNetwork:u||"ethereum",walletAddress:S,accessToken:Se,cryptoCustomerId:J}).then(q=>{let se=q.limits?.usd;if(se?.card?.length){let D=Math.max(...se.card.map(v=>v.limit));ne(D),console.log("[OnrampScreen] kyc_offer card max amount:",D);}}).catch(q=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",q?.message);}));},[n,J,Se,S,u]),ai.useEffect(()=>{if(i||n!=="session_params"||!J||!Se)return;console.log("[OnrampScreen] customerId:",J);let q=D=>{let v=D?.message??"";return v.includes("stripe_onramp_forbidden")||v.includes("403")},se=D=>{q(D)&&Ne();};Hn(J,Se).then(D=>{console.log("[OnrampScreen] customer:",JSON.stringify(D,null,2));let v=D.provided_fields??[],L=D.verifications??[],N=v.includes("date_of_birth")||v.includes("id_number"),be=L.find(it=>it.name==="id_document_verified")?.status==="verified";yt(N),dt(!!be);}).catch(D=>{console.warn("[OnrampScreen] customer fetch error:",D?.message),se(D);}),Fd(J,Se).then(D=>{console.log("[OnrampScreen] payment_tokens fetched, count:",D.data?.length??0),Ye(D.data??[]);}).catch(D=>{console.warn("[OnrampScreen] payment_tokens error:",D?.message),se(D);}),console.log("[OnrampScreen] walletAddress:",S,"walletNetwork:",u),S&&(console.log("[OnrampScreen] calling getTransactionLimits..."),Od({destinationNetwork:u||"ethereum",walletAddress:S,accessToken:Se,cryptoCustomerId:J}).then(D=>{console.log("[OnrampScreen] transaction_limits fetched");let v=D.limits?.usd;if(v?.card?.length){let L=Math.max(...v.card.map(N=>N.limit));ne(L),console.log("[OnrampScreen] card max amount:",L);}}).catch(D=>{console.warn("[OnrampScreen] transaction_limits error:",D?.message),se(D);})),ha(e?.publishableKey).then(D=>{let v=D.data?.find(L=>L.currency_code==="usd");v&&(Oe(v.minimum_amount),console.log("[OnrampScreen] fiat min amount:",v.minimum_amount));}).catch(D=>{console.warn("[OnrampScreen] fiat_currencies error:",D?.message);});},[i,n,J,Se,S,u,Ce]);let nt=async()=>{if(!(!J||!Se))try{let q=await Fd(J,Se);console.log("[OnrampScreen] payment_tokens refreshed, count:",q.data?.length??0),Ye(q.data??[]);}catch(q){console.warn("[OnrampScreen] payment_tokens refresh error:",q?.message);let se=q?.message??"";(se.includes("stripe_onramp_forbidden")||se.includes("403"))&&Ne();}},wr=async()=>{let q=await re();return q&&await nt(),q},er=e?.skipSuccessConfirmation===true;ai.useEffect(()=>{n==="success"&&er&&g&&(ye(g),Ce(),t?.());},[n,er,g,ye,Ce,t]),ai.useEffect(()=>{n==="register"&&Ee&&z();},[n,Ee,z]);let $e=()=>{Ce(),t?.();};if(i)return jsxRuntime.jsx(Vm,{children:jsxRuntime.jsx(reactNative.View,{style:[sb.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(ot,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})})});let Cr=(()=>{if(n==="disclaimer")return jsxRuntime.jsx(Sm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>x("register"),onClose:()=>x("email")});if(n==="email")return jsxRuntime.jsx(km,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Qe,loading:s,error:l,status:a,email:m,setEmail:R,checkEmail:F,onClose:$e});if(n==="register")return jsxRuntime.jsx(Im,{styles:o,hasPrefilledPhone:Ee,loading:s,error:l,status:a,email:m,phone:c,setPhone:b,register:z,onClose:$e});if(n==="kyc")return jsxRuntime.jsx(Ml,{initialData:C,loading:s,onComplete:U,onCancel:$e});if(n==="kyc_offer"){let q=()=>{Ie.current&&(Ie.current=false),x("session_params");};return jsxRuntime.jsx(wm,{onSelectL1:()=>x("kyc_l1"),onSelectL2:()=>{Ie.current=true,x("identity");},onSkip:q,onClose:()=>{Ie.current?(Ie.current=false,x("session_params")):q();},onRefresh:()=>{!J||!Se||(Wt(true),Hn(J,Se).then(v=>{let L=v.kyc_tiers??[],N=L.find(it=>it.tier==="l0"),ke=L.find(it=>it.tier==="l1"),be=L.find(it=>it.tier==="l2");N?.verification_status&&ie(N.verification_status),ke?.verification_status&&et(ke.verification_status),be?.verification_status&&pe(be.verification_status),console.log("[OnrampScreen] refresh kyc_tiers \u2014 l0:",N?.verification_status,"l1:",ke?.verification_status,"l2:",be?.verification_status);}).catch(v=>{console.warn("[OnrampScreen] refresh customer fetch error:",v?.message);}).finally(()=>Wt(false)));},loading:s,loadingTiers:Me,error:l?.message,l0Status:fe,l1Status:_e,l2Status:xt,l1Completed:Qt,l2Completed:Fe,currentLimit:gt})}if(n==="kyc_l1"){let q=Ie.current?"session_params":"wallet";return jsxRuntime.jsx(fm,{initialData:C,loading:s,onComplete:se=>{console.log("[KYCL1] onComplete called with:",JSON.stringify(se)),Ie.current&&(Ie.current=false),U(se,q);},onCancel:()=>x("kyc_offer"),onClose:$e})}return n==="identity"?jsxRuntime.jsx(xm,{styles:o,loading:s,status:a,error:l,verifyIdentity:he,onClose:()=>{Ie.current?(Ie.current=false,x("session_params")):$e();}}):n==="wallet"?jsxRuntime.jsx(Om,{styles:o,hasAutoWallet:Ke,loading:s,error:l,status:a,walletAddress:S,walletNetwork:u,setWalletAddress:I,setWalletNetwork:A,setDestinationCurrency:O,registerWallet:Be,onClose:$e}):n==="session_params"?jsxRuntime.jsx(El,{initialAmount:h,currency:y,applePaySupported:d,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:de,maxAmount:gt,paymentTokens:ue,onAddPaymentMethod:wr,onCollectPayment:(q,se)=>{We(q,se);},paymentLoading:s,paymentStatus:a,paymentError:l?.message??null,onConfirm:(q,se)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:q,selectedMethod:se,amountFirst:ae}),ae&&!J)E(q),x("email");else {let D=se==="apple_pay",v=!D&&se?se:void 0;console.log("[OnrampScreen] isApplePay:",D,"hasSavedToken:",!!v),We(D,q,v);}},onCancel:$e,accessToken:Se,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:Ne,onRequestKYC:Bt}):n==="quote"&&g?jsxRuntime.jsx(vm,{styles:o,session:g,loading:s,error:l,status:a,confirmCheckout:Ae,tokenIconUrl:p,networkIconUrl:k,onClose:$e,onBack:()=>x("session_params")}):n==="processing"?jsxRuntime.jsx(_m,{styles:o,error:l,status:a,loading:s,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??T,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:p,networkIconUrl:k,onClose:$e,onRetryStatusCheck:He}):n==="success"&&g&&!er?jsxRuntime.jsx(Pm,{styles:o,session:g,resolvedRecipientAddress:w,recipientFromConfig:e?.recipientAddress,tokenIconUrl:p,networkIconUrl:k,onDone:()=>{ye(g),Ce(),t?.();}}):null})();return jsxRuntime.jsx(Vm,{children:Cr})}var sb=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function Lm(){try{let e=lb__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}}catch{}}function Zl({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:m,onError:c,onStepChange:g,onClose:C,merchantIdentifier:S="",urlScheme:w="unifoldOnramp",paymentSelectorPosition:u,skipSuccessConfirmation:h=false,appName:y}){let{colors:T,fonts:p,components:k}=V(),d=e||yl(),x=ai.useMemo(()=>{let O=S.trim();return O.length>0?O:Lm()??""},[S]),[R,b]=ai.useState("loading"),[I,A]=ai.useState(null);ai.useEffect(()=>{let O=false;async function F(){try{d&&(Fl(d),Dl(fa()));let z=await Vl();if(O)return;let U=x.trim();if(await stripeReactNative.initStripe({publishableKey:z,urlScheme:w,...U?{merchantIdentifier:U}:{}}),O)return;b("ready");}catch(z){if(O)return;console.error("[StripeOnramp] Init failed:",z),A(z?.message??"Failed to load Stripe configuration"),b("error");}}return F(),()=>{O=true;}},[d,x,w]);let E=ai.useMemo(()=>{let O={publishableKey:d,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:m,onError:c,onStepChange:g};return a&&(O.destinationTokenAddress=a),l&&(O.recipientAddress=l),t&&(O.email=t),r&&(O.phone=r),n&&(O.flowOrder=n),u&&(O.paymentSelectorPosition=u),O.skipSuccessConfirmation=h,O.merchantIdentifier=x,y&&(O.merchantDisplayName=y),O},[d,o,i,s,a,l,t,r,n,u,h,x,y,m,c,g]);return R==="error"?jsxRuntime.jsxs(reactNative.View,{style:[Ts.centered,{backgroundColor:T.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ts.errorText,{color:T.error,fontFamily:p.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[Ts.errorDetail,{color:T.foregroundMuted,fontFamily:p.regular}],children:I}),C&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ts.retryBtn,{backgroundColor:k.button.primaryBackground,borderRadius:k.button.borderRadius}],onPress:C,children:jsxRuntime.jsx(reactNative.Text,{style:[Ts.retryBtnText,{color:k.button.primaryText,fontFamily:p.medium}],children:"Go Back"})})]}):R==="loading"?jsxRuntime.jsx(reactNative.View,{style:[Ts.centered,{backgroundColor:T.background}],children:jsxRuntime.jsx(ot,{size:56,strokeWidth:3,gradientFrom:T.primary,gradientTo:T.primary})}):jsxRuntime.jsx(Jl,{config:E,onClose:C})}var Ts=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function Em(){let{configure:e}=stripeReactNative.useOnramp(),t=ai.useRef(false);return ai.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 Mm="__unifold_stripe_onramp__";function Xl(e){globalThis[Mm]=e;}function zm(){return globalThis[Mm]}Xl(Zl);var Zo=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 Fi,Xn,xs,Um,yb=(Um=class extends Zo{constructor(){super();X(this,Fi);X(this,Xn);X(this,xs);W(this,xs,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){f(this,Xn)||this.setEventListener(f(this,xs));}onUnsubscribe(){var t;this.hasListeners()||((t=f(this,Xn))==null||t.call(this),W(this,Xn,void 0));}setEventListener(t){var r;W(this,xs,t),(r=f(this,Xn))==null||r.call(this),W(this,Xn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){f(this,Fi)!==t&&(W(this,Fi,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof f(this,Fi)=="boolean"?f(this,Fi):globalThis.document?.visibilityState!=="hidden"}},Fi=new WeakMap,Xn=new WeakMap,xs=new WeakMap,Um),Rs=new yb;var bb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Xo,Di,Hm,wb=(Hm=class{constructor(){X(this,Xo,bb);X(this,Di,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&f(this,Di)&&e!==f(this,Xo)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:f(this,Xo),provider:e}),W(this,Xo,e),process.env.NODE_ENV!=="production"&&W(this,Di,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&W(this,Di,true),f(this,Xo).setTimeout(e,t)}clearTimeout(e){f(this,Xo).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&W(this,Di,true),f(this,Xo).setInterval(e,t)}clearInterval(e){f(this,Xo).clearInterval(e);}},Xo=new WeakMap,Di=new WeakMap,Hm),en=new wb;function Nm(e){setTimeout(e,0);}var Xd=typeof window>"u"||"Deno"in globalThis;function yr(){}function qm(e,t){return typeof e=="function"?e(t):e}function Fa(e){return typeof e=="number"&&e>=0&&e!==1/0}function tc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Lo(e,t){return typeof e=="function"?e(t):e}function Xr(e,t){return typeof e=="function"?e(t):e}function rc(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==Da(s,t.options))return false}else if(!Bi(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 oc(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(Vi(t.options.mutationKey)!==Vi(i))return false}else if(!Bi(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Da(e,t){return (t?.queryKeyHashFn||Vi)(e)}function Vi(e){return JSON.stringify(e,(t,r)=>Zd(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Bi(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Bi(e[r],t[r])):false}var Cb=Object.prototype.hasOwnProperty;function ec(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=$m(e)&&$m(t);if(!o&&!(Zd(e)&&Zd(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):{},m=0;for(let c=0;c<a;c++){let g=o?c:s[c],C=e[g],S=t[g];if(C===S){l[g]=C,(o?c<i:Cb.call(e,g))&&m++;continue}if(C===null||S===null||typeof C!="object"||typeof S!="object"){l[g]=S;continue}let w=ec(C,S,r+1);l[g]=w,w===C&&m++;}return i===a&&m===i?e:l}function nc(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 $m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zd(e){if(!jm(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!jm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function jm(e){return Object.prototype.toString.call(e)==="[object Object]"}function Km(e){return new Promise(t=>{en.setTimeout(t,e);})}function Va(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 ec(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 ec(e,t)}return t}function Qm(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Ym(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Li=Symbol();function ic(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Li&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Li?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function sc(e,t){return typeof e=="function"?e(...t):!!e}function Gm(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 tn=(()=>{let e=()=>Xd;return {isServer(){return e()},setIsServer(t){e=t;}}})();function La(){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 Jm=Nm;function Sb(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Jm,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 Nt=Sb();var _s,ei,vs,Zm,kb=(Zm=class extends Zo{constructor(){super();X(this,_s,true);X(this,ei);X(this,vs);W(this,vs,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){f(this,ei)||this.setEventListener(f(this,vs));}onUnsubscribe(){var t;this.hasListeners()||((t=f(this,ei))==null||t.call(this),W(this,ei,void 0));}setEventListener(t){var r;W(this,vs,t),(r=f(this,ei))==null||r.call(this),W(this,ei,t(this.setOnline.bind(this)));}setOnline(t){f(this,_s)!==t&&(W(this,_s,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return f(this,_s)}},_s=new WeakMap,ei=new WeakMap,vs=new WeakMap,Zm),Is=new kb;function Tb(e){return Math.min(1e3*2**e,3e4)}function eu(e){return (e??"online")==="online"?Is.isOnline():true}var ac=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function lc(e){let t=false,r=0,o,n=La(),i=()=>n.status!=="pending",s=u=>{if(!i()){let h=new ac(u);C(h),e.onCancel?.(h);}},a=()=>{t=true;},l=()=>{t=false;},m=()=>Rs.isFocused()&&(e.networkMode==="always"||Is.isOnline())&&e.canRun(),c=()=>eu(e.networkMode)&&e.canRun(),g=u=>{i()||(o?.(),n.resolve(u));},C=u=>{i()||(o?.(),n.reject(u));},S=()=>new Promise(u=>{o=h=>{(i()||m())&&u(h);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),w=()=>{if(i())return;let u,h=r===0?e.initialPromise:void 0;try{u=h??e.fn();}catch(y){u=Promise.reject(y);}Promise.resolve(u).then(g).catch(y=>{if(i())return;let T=e.retry??(tn.isServer()?0:3),p=e.retryDelay??Tb,k=typeof p=="function"?p(r,y):p,d=T===true||typeof T=="number"&&r<T||typeof T=="function"&&T(r,y);if(t||!d){C(y);return}r++,e.onFail?.(r,y),Km(k).then(()=>m()?void 0:S()).then(()=>{t?C(y):w();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?w():S().then(w),n)}}var Wi,Xm,cc=(Xm=class{constructor(){X(this,Wi);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Fa(this.gcTime)&&W(this,Wi,en.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tn.isServer()?1/0:300*1e3));}clearGcTimeout(){f(this,Wi)!==void 0&&(en.clearTimeout(f(this,Wi)),W(this,Wi,void 0));}},Wi=new WeakMap,Xm);var Ai,Ps,Ro,Ei,Pr,Ba,Mi,mo,nf,Tn,rf,of=(rf=class extends cc{constructor(t){super();X(this,mo);X(this,Ai);X(this,Ps);X(this,Ro);X(this,Ei);X(this,Pr);X(this,Ba);X(this,Mi);W(this,Mi,false),W(this,Ba,t.defaultOptions),this.setOptions(t.options),this.observers=[],W(this,Ei,t.client),W(this,Ro,f(this,Ei).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,W(this,Ai,tf(this.options)),this.state=t.state??f(this,Ai),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return f(this,Pr)?.promise}setOptions(t){if(this.options={...f(this,Ba),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=tf(this.options);r.data!==void 0&&(this.setState(ef(r.data,r.dataUpdatedAt)),W(this,Ai,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&f(this,Ro).remove(this);}setData(t,r){let o=Va(this.state.data,t,this.options);return je(this,mo,Tn).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){je(this,mo,Tn).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=f(this,Pr)?.promise;return f(this,Pr)?.cancel(t),r?r.then(yr).catch(yr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return f(this,Ai)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Xr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Li||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Lo(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:!tc(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),f(this,Pr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),f(this,Pr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),f(this,Ro).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(f(this,Pr)&&(f(this,Mi)||je(this,mo,nf).call(this)?f(this,Pr).cancel({revert:true}):f(this,Pr).cancelRetry()),this.scheduleGc()),f(this,Ro).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||je(this,mo,Tn).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&f(this,Pr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(f(this,Pr))return f(this,Pr).continueRetry(),f(this,Pr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(m=>m.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(W(this,Mi,true),o.signal)});},i=()=>{let l=ic(this.options,r),c=(()=>{let g={client:f(this,Ei),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return W(this,Mi,false),this.options.persister?this.options.persister(l,c,this):l(c)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:f(this,Ei),state:this.state,fetchFn:i};return n(l),l})();this.options.behavior?.onFetch(a,this),W(this,Ps,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&je(this,mo,Tn).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),W(this,Pr,lc({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof ac&&l.revert&&this.setState({...f(this,Ps),fetchStatus:"idle"}),o.abort();},onFail:(l,m)=>{je(this,mo,Tn).call(this,{type:"failed",failureCount:l,error:m});},onPause:()=>{je(this,mo,Tn).call(this,{type:"pause"});},onContinue:()=>{je(this,mo,Tn).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await f(this,Pr).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),f(this,Ro).config.onSuccess?.(l,this),f(this,Ro).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof ac){if(l.silent)return f(this,Pr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw je(this,mo,Tn).call(this,{type:"error",error:l}),f(this,Ro).config.onError?.(l,this),f(this,Ro).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Ai=new WeakMap,Ps=new WeakMap,Ro=new WeakMap,Ei=new WeakMap,Pr=new WeakMap,Ba=new WeakMap,Mi=new WeakMap,mo=new WeakSet,nf=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Tn=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,...tu(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...ef(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return W(this,Ps,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),Nt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),f(this,Ro).notify({query:this,type:"updated",action:t});});},rf);function tu(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ef(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function tf(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 eo,Je,Aa,$r,zi,Os,xn,ti,Ea,Fs,Ds,Ui,Hi,ri,Vs,mt,Wa,ru,ou,nu,iu,su,au,lu,cf,lf,du=(lf=class extends Zo{constructor(t,r){super();X(this,mt);X(this,eo);X(this,Je);X(this,Aa);X(this,$r);X(this,zi);X(this,Os);X(this,xn);X(this,ti);X(this,Ea);X(this,Fs);X(this,Ds);X(this,Ui);X(this,Hi);X(this,ri);X(this,Vs,new Set);this.options=r,W(this,eo,t),W(this,ti,null),W(this,xn,La()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(f(this,Je).addObserver(this),sf(f(this,Je),this.options)?je(this,mt,Wa).call(this):this.updateResult(),je(this,mt,iu).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return cu(f(this,Je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cu(f(this,Je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,je(this,mt,su).call(this),je(this,mt,au).call(this),f(this,Je).removeObserver(this);}setOptions(t){let r=this.options,o=f(this,Je);if(this.options=f(this,eo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xr(this.options.enabled,f(this,Je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");je(this,mt,lu).call(this),f(this,Je).setOptions(this.options),r._defaulted&&!nc(this.options,r)&&f(this,eo).getQueryCache().notify({type:"observerOptionsUpdated",query:f(this,Je),observer:this});let n=this.hasListeners();n&&af(f(this,Je),o,this.options,r)&&je(this,mt,Wa).call(this),this.updateResult(),n&&(f(this,Je)!==o||Xr(this.options.enabled,f(this,Je))!==Xr(r.enabled,f(this,Je))||Lo(this.options.staleTime,f(this,Je))!==Lo(r.staleTime,f(this,Je)))&&je(this,mt,ru).call(this);let i=je(this,mt,ou).call(this);n&&(f(this,Je)!==o||Xr(this.options.enabled,f(this,Je))!==Xr(r.enabled,f(this,Je))||i!==f(this,ri))&&je(this,mt,nu).call(this,i);}getOptimisticResult(t){let r=f(this,eo).getQueryCache().build(f(this,eo),t),o=this.createResult(r,t);return Rb(this,o)&&(W(this,$r,o),W(this,Os,this.options),W(this,zi,f(this,Je).state)),o}getCurrentResult(){return f(this,$r)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&f(this,xn).status==="pending"&&f(this,xn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){f(this,Vs).add(t);}getCurrentQuery(){return f(this,Je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=f(this,eo).defaultQueryOptions(t),o=f(this,eo).getQueryCache().build(f(this,eo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return je(this,mt,Wa).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),f(this,$r)))}createResult(t,r){let o=f(this,Je),n=this.options,i=f(this,$r),s=f(this,zi),a=f(this,Os),m=t!==o?t.state:f(this,Aa),{state:c}=t,g={...c},C=false,S;if(r._optimisticResults){let I=this.hasListeners(),A=!I&&sf(t,r),E=I&&af(t,o,r,n);(A||E)&&(g={...g,...tu(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:w,errorUpdatedAt:u,status:h}=g;S=g.data;let y=false;if(r.placeholderData!==void 0&&S===void 0&&h==="pending"){let I;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(I=i.data,y=true):I=typeof r.placeholderData=="function"?r.placeholderData(f(this,Ds)?.state.data,f(this,Ds)):r.placeholderData,I!==void 0&&(h="success",S=Va(i?.data,I,r),C=true);}if(r.select&&S!==void 0&&!y)if(i&&S===s?.data&&r.select===f(this,Ea))S=f(this,Fs);else try{W(this,Ea,r.select),S=r.select(S),S=Va(i?.data,S,r),W(this,Fs,S),W(this,ti,null);}catch(I){W(this,ti,I);}f(this,ti)&&(w=f(this,ti),S=f(this,Fs),u=Date.now(),h="error");let T=g.fetchStatus==="fetching",p=h==="pending",k=h==="error",d=p&&T,x=S!==void 0,b={status:h,fetchStatus:g.fetchStatus,isPending:p,isSuccess:h==="success",isError:k,isInitialLoading:d,isLoading:d,data:S,dataUpdatedAt:g.dataUpdatedAt,error:w,errorUpdatedAt:u,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:T,isRefetching:T&&!p,isLoadingError:k&&!x,isPaused:g.fetchStatus==="paused",isPlaceholderData:C,isRefetchError:k&&x,isStale:uu(t,r),refetch:this.refetch,promise:f(this,xn),isEnabled:Xr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let I=b.data!==void 0,A=b.status==="error"&&!I,E=z=>{A?z.reject(b.error):I&&z.resolve(b.data);},O=()=>{let z=W(this,xn,b.promise=La());E(z);},F=f(this,xn);switch(F.status){case "pending":t.queryHash===o.queryHash&&E(F);break;case "fulfilled":(A||b.data!==F.value)&&O();break;case "rejected":(!A||b.error!==F.reason)&&O();break}}return b}updateResult(){let t=f(this,$r),r=this.createResult(f(this,Je),this.options);if(W(this,zi,f(this,Je).state),W(this,Os,this.options),f(this,zi).data!==void 0&&W(this,Ds,f(this,Je)),nc(r,t))return;W(this,$r,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!f(this,Vs).size)return true;let s=new Set(i??f(this,Vs));return this.options.throwOnError&&s.add("error"),Object.keys(f(this,$r)).some(a=>{let l=a;return f(this,$r)[l]!==t[l]&&s.has(l)})};je(this,mt,cf).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&je(this,mt,iu).call(this);}},eo=new WeakMap,Je=new WeakMap,Aa=new WeakMap,$r=new WeakMap,zi=new WeakMap,Os=new WeakMap,xn=new WeakMap,ti=new WeakMap,Ea=new WeakMap,Fs=new WeakMap,Ds=new WeakMap,Ui=new WeakMap,Hi=new WeakMap,ri=new WeakMap,Vs=new WeakMap,mt=new WeakSet,Wa=function(t){je(this,mt,lu).call(this);let r=f(this,Je).fetch(this.options,t);return t?.throwOnError||(r=r.catch(yr)),r},ru=function(){je(this,mt,su).call(this);let t=Lo(this.options.staleTime,f(this,Je));if(tn.isServer()||f(this,$r).isStale||!Fa(t))return;let o=tc(f(this,$r).dataUpdatedAt,t)+1;W(this,Ui,en.setTimeout(()=>{f(this,$r).isStale||this.updateResult();},o));},ou=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(f(this,Je)):this.options.refetchInterval)??false},nu=function(t){je(this,mt,au).call(this),W(this,ri,t),!(tn.isServer()||Xr(this.options.enabled,f(this,Je))===false||!Fa(f(this,ri))||f(this,ri)===0)&&W(this,Hi,en.setInterval(()=>{(this.options.refetchIntervalInBackground||Rs.isFocused())&&je(this,mt,Wa).call(this);},f(this,ri)));},iu=function(){je(this,mt,ru).call(this),je(this,mt,nu).call(this,je(this,mt,ou).call(this));},su=function(){f(this,Ui)!==void 0&&(en.clearTimeout(f(this,Ui)),W(this,Ui,void 0));},au=function(){f(this,Hi)!==void 0&&(en.clearInterval(f(this,Hi)),W(this,Hi,void 0));},lu=function(){let t=f(this,eo).getQueryCache().build(f(this,eo),this.options);if(t===f(this,Je))return;let r=f(this,Je);W(this,Je,t),W(this,Aa,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},cf=function(t){Nt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(f(this,$r));}),f(this,eo).getQueryCache().notify({query:f(this,Je),type:"observerResultsUpdated"});});},lf);function xb(e,t){return Xr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function sf(e,t){return xb(e,t)||e.state.data!==void 0&&cu(e,t,t.refetchOnMount)}function cu(e,t,r){if(Xr(t.enabled,e)!==false&&Lo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&uu(e,t)}return false}function af(e,t,r,o){return (e!==t||Xr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&uu(e,r)}function uu(e,t){return Xr(t.enabled,e)!==false&&e.isStaleByTime(Lo(t.staleTime,e))}function Rb(e,t){return !nc(e.getCurrentResult(),t)}function pu(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,m=async()=>{let c=false,g=w=>{Gm(w,()=>t.signal,()=>c=true);},C=ic(t.options,t.fetchOptions),S=async(w,u,h)=>{if(c)return Promise.reject();if(u==null&&w.pages.length)return Promise.resolve(w);let T=(()=>{let x={client:t.client,queryKey:t.queryKey,pageParam:u,direction:h?"backward":"forward",meta:t.options.meta};return g(x),x})(),p=await C(T),{maxPages:k}=t.options,d=h?Ym:Qm;return {pages:d(w.pages,p,k),pageParams:d(w.pageParams,u,k)}};if(n&&i.length){let w=n==="backward",u=w?_b:df,h={pages:i,pageParams:s},y=u(o,h);a=await S(h,y,w);}else {let w=e??i.length;do{let u=l===0?s[0]??o.initialPageParam:df(o,a);if(l>0&&u==null)break;a=await S(a,u),l++;}while(l<w)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=m;}}}function df(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 _b(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ma,rn,Er,Ni,on,oi,uf,pf=(uf=class extends cc{constructor(t){super();X(this,on);X(this,Ma);X(this,rn);X(this,Er);X(this,Ni);W(this,Ma,t.client),this.mutationId=t.mutationId,W(this,Er,t.mutationCache),W(this,rn,[]),this.state=t.state||vb(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){f(this,rn).includes(t)||(f(this,rn).push(t),this.clearGcTimeout(),f(this,Er).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){W(this,rn,f(this,rn).filter(r=>r!==t)),this.scheduleGc(),f(this,Er).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){f(this,rn).length||(this.state.status==="pending"?this.scheduleGc():f(this,Er).remove(this));}continue(){return f(this,Ni)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{je(this,on,oi).call(this,{type:"continue"});},o={client:f(this,Ma),meta:this.options.meta,mutationKey:this.options.mutationKey};W(this,Ni,lc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{je(this,on,oi).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{je(this,on,oi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>f(this,Er).canRun(this)}));let n=this.state.status==="pending",i=!f(this,Ni).canStart();try{if(n)r();else {je(this,on,oi).call(this,{type:"pending",variables:t,isPaused:i}),f(this,Er).config.onMutate&&await f(this,Er).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&je(this,on,oi).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await f(this,Ni).start();return await f(this,Er).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await f(this,Er).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),je(this,on,oi).call(this,{type:"success",data:s}),s}catch(s){try{await f(this,Er).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await f(this,Er).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 je(this,on,oi).call(this,{type:"error",error:s}),s}finally{f(this,Er).runNext(this);}}},Ma=new WeakMap,rn=new WeakMap,Er=new WeakMap,Ni=new WeakMap,on=new WeakSet,oi=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),Nt.batch(()=>{f(this,rn).forEach(o=>{o.onMutationUpdate(t);}),f(this,Er).notify({mutation:this,type:"updated",action:t});});},uf);function vb(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Rn,Bo,za,mf,ff=(mf=class extends Zo{constructor(t={}){super();X(this,Rn);X(this,Bo);X(this,za);this.config=t,W(this,Rn,new Set),W(this,Bo,new Map),W(this,za,0);}build(t,r,o){let n=new pf({client:t,mutationCache:this,mutationId:++na(this,za)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){f(this,Rn).add(t);let r=dc(t);if(typeof r=="string"){let o=f(this,Bo).get(r);o?o.push(t):f(this,Bo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(f(this,Rn).delete(t)){let r=dc(t);if(typeof r=="string"){let o=f(this,Bo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&f(this,Bo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=dc(t);if(typeof r=="string"){let n=f(this,Bo).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=dc(t);return typeof r=="string"?f(this,Bo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Nt.batch(()=>{f(this,Rn).forEach(t=>{this.notify({type:"removed",mutation:t});}),f(this,Rn).clear(),f(this,Bo).clear();});}getAll(){return Array.from(f(this,Rn))}find(t){let r={exact:true,...t};return this.getAll().find(o=>oc(r,o))}findAll(t={}){return this.getAll().filter(r=>oc(t,r))}notify(t){Nt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Nt.batch(()=>Promise.all(t.map(r=>r.continue().catch(yr))))}},Rn=new WeakMap,Bo=new WeakMap,za=new WeakMap,mf);function dc(e){return e.options.scope?.id}var nn,hf,gf=(hf=class extends Zo{constructor(t={}){super();X(this,nn);this.config=t,W(this,nn,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??Da(n,r),s=this.get(i);return s||(s=new of({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){f(this,nn).has(t.queryHash)||(f(this,nn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=f(this,nn).get(t.queryHash);r&&(t.destroy(),r===t&&f(this,nn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Nt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return f(this,nn).get(t)}getAll(){return [...f(this,nn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>rc(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>rc(t,o)):r}notify(t){Nt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Nt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Nt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},nn=new WeakMap,hf);var sr,ni,ii,Ls,Bs,si,Ws,As,yf,mu=(yf=class{constructor(e={}){X(this,sr);X(this,ni);X(this,ii);X(this,Ls);X(this,Bs);X(this,si);X(this,Ws);X(this,As);W(this,sr,e.queryCache||new gf),W(this,ni,e.mutationCache||new ff),W(this,ii,e.defaultOptions||{}),W(this,Ls,new Map),W(this,Bs,new Map),W(this,si,0);}mount(){na(this,si)._++,f(this,si)===1&&(W(this,Ws,Rs.subscribe(async e=>{e&&(await this.resumePausedMutations(),f(this,sr).onFocus());})),W(this,As,Is.subscribe(async e=>{e&&(await this.resumePausedMutations(),f(this,sr).onOnline());})));}unmount(){var e,t;na(this,si)._--,f(this,si)===0&&((e=f(this,Ws))==null||e.call(this),W(this,Ws,void 0),(t=f(this,As))==null||t.call(this),W(this,As,void 0));}isFetching(e){return f(this,sr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return f(this,ni).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return f(this,sr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=f(this,sr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Lo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return f(this,sr).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=f(this,sr).get(o.queryHash)?.state.data,s=qm(t,i);if(s!==void 0)return f(this,sr).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return Nt.batch(()=>f(this,sr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return f(this,sr).get(t.queryHash)?.state}removeQueries(e){let t=f(this,sr);Nt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=f(this,sr);return Nt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Nt.batch(()=>f(this,sr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(yr).catch(yr)}invalidateQueries(e,t={}){return Nt.batch(()=>(f(this,sr).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=Nt.batch(()=>f(this,sr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(yr)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(yr)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=f(this,sr).build(this,t);return r.isStaleByTime(Lo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(yr).catch(yr)}fetchInfiniteQuery(e){return e.behavior=pu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(yr).catch(yr)}ensureInfiniteQueryData(e){return e.behavior=pu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Is.isOnline()?f(this,ni).resumePausedMutations():Promise.resolve()}getQueryCache(){return f(this,sr)}getMutationCache(){return f(this,ni)}getDefaultOptions(){return f(this,ii)}setDefaultOptions(e){W(this,ii,e);}setQueryDefaults(e,t){f(this,Ls).set(Vi(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...f(this,Ls).values()],r={};return t.forEach(o=>{Bi(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){f(this,Bs).set(Vi(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...f(this,Bs).values()],r={};return t.forEach(o=>{Bi(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...f(this,ii).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Da(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Li&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...f(this,ii).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){f(this,sr).clear(),f(this,ni).clear();}},sr=new WeakMap,ni=new WeakMap,ii=new WeakMap,Ls=new WeakMap,Bs=new WeakMap,si=new WeakMap,Ws=new WeakMap,As=new WeakMap,yf);var fu=ai__namespace.createContext(void 0),hu=e=>{let t=ai__namespace.useContext(fu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},gu=({client:e,children:t})=>(ai__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(fu.Provider,{value:e,children:t}));var bf=ai__namespace.createContext(false),wf=()=>ai__namespace.useContext(bf);bf.Provider;function Pb(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Ob=ai__namespace.createContext(Pb()),Cf=()=>ai__namespace.useContext(Ob);var kf=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?sc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Tf=e=>{ai__namespace.useEffect(()=>{e.clearReset();},[e]);},xf=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||sc(r,[e.error,o]));var Rf=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));}},_f=(e,t)=>e.isLoading&&e.isFetching&&!t,vf=(e,t)=>e?.suspense&&t.isPending,yu=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function If(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=wf(),n=Cf(),i=hu(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",Rf(s),kf(s,n,a),Tf(n);let l=!i.getQueryCache().get(s.queryHash),[m]=ai__namespace.useState(()=>new t(i,s)),c=m.getOptimisticResult(s),g=!o&&e.subscribed!==false;if(ai__namespace.useSyncExternalStore(ai__namespace.useCallback(C=>{let S=g?m.subscribe(Nt.batchCalls(C)):yr;return m.updateResult(),S},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),ai__namespace.useEffect(()=>{m.setOptions(s);},[s,m]),vf(s,c))throw yu(s,m,n);if(xf({result:c,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!tn.isServer()&&_f(c,o)&&(l?yu(s,m,n):a?.promise)?.catch(yr).finally(()=>{m.updateResult();}),s.notifyOnChangeProps?c:m.trackResult(c)}function _n(e,t){return If(e,du)}var zs=new Map;function Pf({width:e,height:t,borderRadius:r,color:o}){let n=ai.useRef(new reactNative.Animated.Value(.3)).current;return ai.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 ci({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=V(),[m,c]=ai.useState(false),[g,C]=ai.useState(false),[S,w]=ai.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let d=zs.get(e);return d?{uri:e,xml:d}:null}),u=e?.toLowerCase().endsWith(".svg"),h=u&&e&&S?.uri===e?S.xml:null;ai.useEffect(()=>{c(false),C(false);},[e]),ai.useEffect(()=>{if(!u||!e)return;if(zs.has(e)){w({uri:e,xml:zs.get(e)});return}let d=false;return fetch(e).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.text()}).then(x=>{d||(zs.set(e,x),w({uri:e,xml:x}));}).catch(()=>{d||c(true);}),()=>{d=true;}},[e,u]);let y=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:y},a]});let T={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},p=t-n*2,k=r-n*2;return m?jsxRuntime.jsx(reactNative.View,{style:[T,{backgroundColor:s||y}]}):u?jsxRuntime.jsxs(reactNative.View,{style:T,children:[!!!h&&jsxRuntime.jsx(Pf,{width:p,height:k,borderRadius:o,color:y}),h?jsxRuntime.jsx(Ft.SvgXml,{xml:h,width:p,height:k,onError:()=>c(true)}):jsxRuntime.jsx(Ft.SvgUri,{uri:e,width:p,height:k,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:T,children:[!g&&jsxRuntime.jsx(Pf,{width:p,height:k,borderRadius:o,color:y}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:p,height:k},resizeMode:"contain",onLoad:()=>C(true),onError:()=>c(true)})]})}function Cu(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(zs.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{zs.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function jr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:m,balanceChainId:c,balanceTokenAddress:g,publishableKey:C,projectName:S,leftIcon:w,onLeftAction:u}){let{colors:h,fonts:y,components:T}=V(),[p,k]=ai.useState(null),[d,x]=ai.useState(false),R=ai.useState(()=>new reactNative.Animated.Value(0))[0];ai.useEffect(()=>{if(!d)return;let I=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(R,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(R,{toValue:0,duration:700,useNativeDriver:true})]));return I.start(),()=>I.stop()},[d,R]),ai.useEffect(()=>{if(!a||!l||!m||!c||!g||!C){k(null),x(false);return}let I=false;return x(true),kl(l,m,c,g,C).then(A=>{if(I)return;let E=A.balance,O=null;E&&(E.amount_usd!=null&&E.amount_usd!==""?O=`$${E.amount_usd}`:O="$0.00"),k(O);}).catch(()=>{I||k(null);}).finally(()=>{I||x(false);}),()=>{I=true;}},[a,l,m,c,g,C]);let b=R.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Mr.header,children:[jsxRuntime.jsx(reactNative.View,{style:Mr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Mr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(sa,{size:20,color:T.header.buttonColor,strokeWidth:2})}):w&&u?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:u,style:[Mr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:w}):jsxRuntime.jsx(reactNative.View,{style:Mr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Mr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Mr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.title,{color:T.header.titleColor,fontFamily:y.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Mr.titleBadge,{backgroundColor:h.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Mr.titleBadgeText,{color:h.foregroundMuted,fontFamily:y.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[Mr.balanceText,{color:h.foregroundMuted,fontFamily:y.regular}],children:t}):null,a&&(d?jsxRuntime.jsx(reactNative.Animated.View,{style:[Mr.balanceSkeleton,{backgroundColor:h.cardHover,opacity:b}]}):p!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Mr.balanceText,{color:h.foregroundMuted,fontFamily:y.regular}],children:[S?`${S} `:"","Balance: ",p]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Mr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[Mr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:T.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Mr.spacer})})]})}var Mr=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function br({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=V(),a=i??s.card,l=a.backShadowColor!=="transparent",m={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},c=[Vf.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[m,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Vf.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 Vf=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ha({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=V(),s=i.depositMenu.card,a=o?[...o].sort((l,m)=>l.position-m.position):[];return jsxRuntime.jsxs(br,{cardTokens:s,onPress:e,style:sn.wrapper,contentStyle:sn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:sn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[sn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(sd,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:sn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[sn.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[sn.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:sn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:sn.networkIcons,children:a.map((l,m)=>{let c=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[sn.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:a.length-m}],children:jsxRuntime.jsx(ci,{uri:te(c),width:20,height:20})},l.name)})})})]})}var sn=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 $a({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=V(),s=i.depositMenu.card;return jsxRuntime.jsxs(br,{cardTokens:s,onPress:e,style:vn.wrapper,contentStyle:vn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:vn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[vn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(rs,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:vn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[vn.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[vn.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:vn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:vn.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(m=>m.format==="png")?.url||a.icon_urls.find(m=>m.format==="svg")?.url;return jsxRuntime.jsx(ci,{uri:te(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var vn=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 ja({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=V(),s=i.depositMenu.card;return jsxRuntime.jsx(br,{cardTokens:s,onPress:e,style:In.wrapper,contentStyle:In.container,children:jsxRuntime.jsxs(reactNative.View,{style:In.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[In.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx(Kr,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[In.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[In.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:In.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[In.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[In.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var In=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",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 Ka({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=V(),i=n.depositMenu.card;return jsxRuntime.jsxs(br,{cardTokens:i,onPress:e,style:an.wrapper,contentStyle:an.container,children:[jsxRuntime.jsxs(reactNative.View,{style:an.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[an.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(fl,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:an.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[an.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[an.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:an.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:an.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[an.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var an=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var Af=1e4,Ef=2500,Mf=3e3,zf=6e4;function Qa(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:i,modalOpenedAt:s,depositWalletId:a,depositExecutions:l,trackedExecutions:m,setDepositExecutions:c,setTrackedExecutions:g,setLatestExecution:C,setShowStatusSheet:S,onDepositSuccess:w,onExecutionsChange:u,onDepositError:h}=e,[y,T]=ai.useState(false),[p,k]=ai.useState(false);return ai.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;T(false),t==="auto_ui"&&k(false);let x=setTimeout(()=>{T(true),t==="auto_ui"&&k(true);},Af);return ()=>clearTimeout(x)},[t,r,o]),ai.useEffect(()=>{if(!n||!s)return;let x=new Date(s.getTime()-zf),R=setInterval(async()=>{try{let A=[...(await yn(n,i)).data??[]].sort((O,F)=>{let z=O.created_at?new Date(O.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-z}),E=null;for(let O of A){let F=O.created_at?new Date(O.created_at):null;if(!F||F<=x)continue;let z=m.get(O.id);if(!z){E=O;break}if(["pending","waiting","delayed"].includes(z)&&O.status==="succeeded"){E=O;break}}if(E){let O=E;c(F=>{let z=F.findIndex(U=>U.id===O.id);if(z>=0){let U=[...F];return U[z]=O,U}return [...F,O]}),g(F=>{let z=new Map(F);return z.set(O.id,O.status),z}),C(O),S(!0),O.status==="succeeded"&&w?.({message:"Deposit completed successfully",executionId:O.id}),u?.([...l,O]);}}catch(b){h?.({message:"Failed to check deposit status",error:b});}},Ef);return ()=>clearInterval(R)},[n,i,s,m,l,u,w,h]),ai.useEffect(()=>{if(!y||!a)return;let x=async()=>{try{await bl(a,i);}catch{}};x();let R=setInterval(x,Mf);return ()=>clearInterval(R)},[y,a,i]),{pollingEnabled:y,showWaitingUi:p,handleIveDeposited:()=>{T(true),k(true);}}}function $s({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:i,isDark:s}=V(),a=s?"#1a1a1a":"#ffffff",l=s?"#ffffff":"#000000",m=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[Hf.container,{width:t,height:t}],children:[jsxRuntime.jsx(Nb__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[Hf.logoContainer,{width:o+12,height:o+12,backgroundColor:m,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(ci,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var Hf=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function jf(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Kb(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),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 js({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:m}){let{colors:c,fonts:g,components:C}=V(),[S,w]=ai.useState(false),u=t==="pending"||t==="waiting"||t==="delayed",h=t==="succeeded",y=()=>{o&&reactNative.Linking.openURL(o);},T=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(wt,{visible:e,onClose:a,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:m,children:jsxRuntime.jsxs(reactNative.View,{style:Jt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Jt.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:C.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Jt.iconContainer,children:u?jsxRuntime.jsx(ot,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(r)},style:Jt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Jt.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(r)},style:Jt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Jt.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Jt.statusBadge,{backgroundColor:C.container.iconBackgroundColor}],children:jsxRuntime.jsx(De,{size:16,color:C.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.title,{color:C.container.titleColor,fontFamily:g.semibold}],children:u?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Jt.amount,{color:C.container.titleColor,fontFamily:g.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsxRuntime.jsx(reactNative.Text,{style:[Jt.date,{color:C.container.subtitleColor,fontFamily:g.regular}],children:Kb(i)}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.subtitle,{color:C.container.subtitleColor,fontFamily:g.regular}],children:u?"This usually takes less than a minute.":"Your account has been credited successfully!"}),h&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Jt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Jt.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Jt.detailsToggle,onPress:()=>w(!S),children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.detailsToggleText,{color:C.container.actionTitle,fontFamily:g.medium}],children:S?"See less":"See more details"}),S?jsxRuntime.jsx(Mo,{size:18,color:C.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Yt,{size:18,color:C.container.actionColor,strokeWidth:2})]}),S&&jsxRuntime.jsxs(reactNative.View,{style:Jt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Jt.txButton,{backgroundColor:C.card.backgroundColor,borderColor:c.border}],onPress:y,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.txLabel,{color:C.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.txHash,{color:C.card.subtitleColor,fontFamily:g.regular}],children:jf(o)}),jsxRuntime.jsx(Eo,{size:16,color:C.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Jt.txButton,{backgroundColor:C.card.backgroundColor,borderColor:c.border}],onPress:T,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jt.txLabel,{color:C.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Jt.txHash,{color:C.card.subtitleColor,fontFamily:g.regular}],children:jf(n)}),jsxRuntime.jsx(Eo,{size:16,color:C.card.actionColor,strokeWidth:2})]})]})]})]})})}var Jt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function yc({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:i,fonts:s,components:a}=V();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[qi.iveDepositedButton,{backgroundColor:i.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[qi.iveDepositedButtonText,{color:i.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[qi.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[qi.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ad,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qi.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[qi.processingCardTitle,{color:a.card.titleColor,fontFamily:s.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[qi.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:s.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var qi=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var Ya=(e,t)=>`${t}:${e}`,rw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function wc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:C,onDepositError:S,borderTopLeftRadius:w,borderTopRightRadius:u,sheetBorderRadius:h}){let{colors:y,fonts:T,components:p}=V(),k=a&&l?`${a}:${l}`:"solana:mainnet",[d,x]=ai.useState("USDC"),[R,b]=ai.useState(k),[I,A]=ai.useState([]),[E,O]=ai.useState(true),[F,z]=ai.useState([]),[U,he]=ai.useState(true),[Be,We]=ai.useState(false),[re,Ae]=ai.useState(false),[Ce,ye]=ai.useState(false),[He,ae]=ai.useState(false),[J,Se]=ai.useState([]),[Bt,Ie]=ai.useState(new Map),[Ne]=ai.useState(()=>new Date),[Qe,Ee]=ai.useState(null),[Ke,gt]=ai.useState(false),[ne,de]=ai.useState(null),[Oe,ue]=ai.useState(false),Ye=new Map;F.forEach(D=>{D.chains.forEach(v=>{let L=`${v.chain_type}:${v.chain_id}`;Ye.has(L)||Ye.set(L,v);});});let Qt=Array.from(Ye.values()),yt=rw(R),dt=Qt.find(D=>D.chain_type===yt.chainType&&D.chain_id===yt.chainId)?.chain_type||"ethereum",fe=gn(I,dt),ie=fe?.address||"",_e=ai.useRef(false);ai.useEffect(()=>{async function D(){try{he(!0),Ee(null);let L=await ki(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(z(L.data),L.data.length>0&&!_e.current){_e.current=!0;let N,ke;if(a&&l)if(m)for(let be of L.data){let it=be.chains.find(le=>le.chain_type===a&&le.chain_id===l&&le.token_address.toLowerCase()===m.toLowerCase());if(it){N=be,ke=it;break}}else for(let be of L.data){let it=be.chains.find(le=>le.chain_type===a&&le.chain_id===l);if(it){N=be,ke=it;break}}if(!N&&i)for(let be of L.data){let it=be.chains.find(le=>le.token_address.toLowerCase()===i.toLowerCase());if(it){N=be,ke=it;break}}N||(N=L.data.find(be=>be.symbol==="USDC"),N&&N.chains.length>0&&(ke=N.chains[0])),N||(N=L.data.find(be=>be.symbol==="USDT"),N&&N.chains.length>0&&(ke=N.chains[0])),N||(N=L.data[0],N.chains.length>0&&(ke=N.chains[0])),N&&x(N.symbol),ke&&b(Ya(ke.chain_id,ke.chain_type));}}catch(v){console.error("Error fetching supported tokens:",v),Ee("Failed to load supported tokens"),S?.({message:"Failed to load supported tokens",error:v});}finally{he(false);}}D();},[t,S,a,l,m,i,n,o]),ai.useEffect(()=>{async function D(){try{O(!0),Ee(null);let v=await hn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);A(v.data);}catch(v){console.error("Error fetching wallets:",v),Ee("Failed to load wallets"),S?.({message:"Failed to load wallets",error:v});}finally{O(false);}}D();},[e,r,o,n,i,t,S]);let et=fe?.id??"",{showWaitingUi:xt,handleIveDeposited:pe}=Qa({depositConfirmationMode:c,depositAddress:ie,chain:R,externalUserId:e,publishableKey:t,modalOpenedAt:Ne,depositWalletId:et,depositExecutions:J,trackedExecutions:Bt,setDepositExecutions:Se,setTrackedExecutions:Ie,setLatestExecution:de,setShowStatusSheet:gt,onDepositSuccess:C,onExecutionsChange:g,onDepositError:S});ai.useEffect(()=>{if(!F.length)return;let D=F.find(L=>L.symbol===d);if(!D||D.chains.length===0)return;if(!D.chains.some(L=>Ya(L.chain_id,L.chain_type)===R)){let L=D.chains[0];b(Ya(L.chain_id,L.chain_type));}},[d,F,R]);let Me=F.find(D=>D.symbol===d),Wt=Me?.chains||[],nt=Wt.find(D=>Ya(D.chain_id,D.chain_type)===R),wr=async()=>{if(ie)try{reactNative.Clipboard.setString(ie),We(!0),setTimeout(()=>We(!1),2e3);}catch(D){console.error("Failed to copy:",D);}},er=nt?.estimated_price_impact_percent??0,$e=nt?.max_slippage_percent??.25,Cr=nt?.minimum_deposit_amount_usd??3;if(U)return jsxRuntime.jsxs(reactNative.View,{style:B.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[B.loadingText,{color:y.foregroundMuted,fontFamily:T.regular}],children:"Loading currencies..."})]});if(Qe&&F.length===0)return jsxRuntime.jsxs(reactNative.View,{style:B.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.errorText,{color:y.error,fontFamily:T.regular}],children:Qe}),jsxRuntime.jsx(reactNative.Text,{style:[B.errorHint,{color:y.foregroundMuted,fontFamily:T.regular}],children:"Please check your network connection and try again."})]});let q=()=>jsxRuntime.jsxs(wt,{visible:Ce,onClose:()=>ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:h?.tokenSelector?.borderTopRightRadius??u,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:y.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:p.header.titleColor,fontFamily:T.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(at,{style:B.sheetList,contentContainerStyle:B.sheetListContent,showsVerticalScrollIndicator:false,children:F.map(D=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{x(D.symbol),ye(false);},activeOpacity:.7,style:[B.sheetItem,{backgroundColor:d===D.symbol?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(D,"png"))},style:B.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:B.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.sheetItemTitle,{color:p.card.titleColor,fontFamily:T.medium}],children:D.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[B.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:T.regular}],children:[D.chains.length," network",D.chains.length!==1?"s":""," available"]})]}),d===D.symbol&&jsxRuntime.jsx(De,{size:20,color:y.primary,strokeWidth:2})]},D.symbol))})]}),se=()=>jsxRuntime.jsxs(wt,{visible:He,onClose:()=>ae(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:h?.chainSelector?.borderTopRightRadius??u,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:y.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:p.header.titleColor,fontFamily:T.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ae(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(at,{style:B.sheetList,contentContainerStyle:B.sheetListContent,showsVerticalScrollIndicator:false,children:Wt.map(D=>{let v=Ya(D.chain_id,D.chain_type),L=R===v;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{b(v),ae(false);},activeOpacity:.7,style:[B.sheetItem,{backgroundColor:L?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(D,"png"))},style:B.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:B.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.sheetItemTitle,{color:p.card.titleColor,fontFamily:T.medium}],children:D.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[B.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:T.regular}],children:["Min deposit: $",D.minimum_deposit_amount_usd]})]}),L&&jsxRuntime.jsx(De,{size:20,color:y.primary,strokeWidth:2})]},v)})})]});return jsxRuntime.jsxs(reactNative.View,{style:B.container,children:[jsxRuntime.jsxs(reactNative.View,{style:B.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.selectorLabel,{color:p.card.labelColor,fontFamily:T.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(true),style:[B.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[Me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(Me,"png"))},style:B.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[B.selectorText,{color:p.card.titleColor,fontFamily:T.medium}],children:d}),jsxRuntime.jsx(Yt,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:B.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[B.selectorLabel,{color:p.card.labelColor,fontFamily:T.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[B.minDeposit,{fontFamily:T.regular}],children:["($",Cr," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ae(true),style:[B.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[nt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(nt,"png"))},style:B.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[B.selectorText,{color:p.card.titleColor,fontFamily:T.medium}],numberOfLines:1,children:nt?.chain_name||"Select network"}),jsxRuntime.jsx(Yt,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:B.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[B.qrWrapper,{backgroundColor:y.background,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth>0?p.card.borderWidth:1,borderColor:p.card.borderColor}],children:E?jsxRuntime.jsxs(reactNative.View,{style:B.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[B.loadingText,{color:y.foregroundMuted,fontFamily:T.regular}],children:"Loading..."})]}):ie?jsxRuntime.jsx($s,{value:ie,size:160,logoUri:te(xe(nt,"png")||cr("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:B.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[B.errorText,{color:y.error,fontFamily:T.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:B.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:B.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.addressLabel,{color:p.card.labelColor,fontFamily:T.medium}],children:"Deposit Address"}),Be&&jsxRuntime.jsxs(reactNative.View,{style:B.copiedIndicator,children:[jsxRuntime.jsx(De,{size:14,color:y.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[B.copiedText,{color:y.success,fontFamily:T.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(br,{cardTokens:p.transferCrypto.depositAddress.card,onPress:!E&&ie?wr:void 0,contentStyle:B.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.addressText,{color:p.card.titleColor,fontFamily:T.regular}],numberOfLines:2,children:E?"Loading...":ie||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:B.addressCopyIcon,children:jsxRuntime.jsx(mn,{size:16,color:p.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[B.detailsCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(!re),style:B.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Kr,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:T.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:B.chevronContainer,children:re?jsxRuntime.jsx(Mo,{size:16,color:p.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Yt,{size:16,color:p.card.actionColor,strokeWidth:2})})]}),re&&jsxRuntime.jsxs(reactNative.View,{style:B.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zn,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:T.regular}],children:["Price impact: ",er.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(is,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qr,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:T.regular}],children:["Slippage: Auto \u2022 ",$e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(is,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ml,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:T.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(yc,{depositConfirmationMode:c,depositAddress:ie,showWaitingUi:xt,latestExecution:ne,onIveDeposited:pe}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:B.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[B.termsText,{color:y.primary,fontFamily:T.regular}],children:"Terms apply"})}),q(),se(),jsxRuntime.jsxs(wt,{visible:Oe,onClose:()=>ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:h?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:h?.infoSheet?.borderTopRightRadius??u,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:y.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:p.header.titleColor,fontFamily:T.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:B.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[B.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zn,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardTitle,{color:p.card.titleColor,fontFamily:T.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[B.infoCardValue,{color:p.card.titleColor,fontFamily:T.medium}],children:[er.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardDescription,{color:p.card.descriptionColor,fontFamily:T.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[B.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:B.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[B.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qr,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardTitle,{color:p.card.titleColor,fontFamily:T.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[B.infoCardValue,{color:p.card.titleColor,fontFamily:T.medium}],children:[$e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardDescription,{color:p.card.descriptionColor,fontFamily:T.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."})]})]})]}),ne&&jsxRuntime.jsx(js,{visible:Ke,status:ne.status,tokenIconUrl:ne.destination_token_metadata?.icon_urls?.find(D=>D.format==="png")?.url||ne.destination_token_metadata?.icon_url||xe(Me,"png"),explorerUrl:ne.explorer_url,completionExplorerUrl:ne.destination_explorer_url,date:ne.created_at?new Date(ne.created_at):void 0,amountUsd:ne.source_amount_usd?parseFloat(ne.source_amount_usd):void 0,onClose:()=>gt(false),borderTopLeftRadius:h?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:h?.depositStatus?.borderTopRightRadius??u})]})}var B=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function Cc({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=V();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ki.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ki.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ki.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(e,"png"))},style:Ki.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ki.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ki.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ki.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(De,{size:16,color:o.primary,strokeWidth:2})]})}var Ki=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function Ja({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=V();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Yf.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Yf.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(Cc,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var Yf=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function kc({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:m,components:c}=V(),[g,C]=ai.useState(""),S=o.map(k=>r.find(d=>d.currency_code.toLowerCase()===k.toLowerCase())).filter(k=>k!==void 0),w=r.filter(k=>!o.includes(k.currency_code.toLowerCase())),u=k=>{if(!g)return k;let d=g.toLowerCase();return k.filter(x=>x.name.toLowerCase().includes(d)||x.currency_code.toLowerCase().includes(d))},h=u(S),y=u(w),T=k=>{i(k),t(false),C("");},p=()=>{t(false),C("");};return jsxRuntime.jsxs(wt,{visible:e,onClose:p,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(jr,{title:"Currency",showBack:false,onClose:p}),jsxRuntime.jsx(reactNative.View,{style:Qi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Qi.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:m.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:g,onChangeText:C,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(at,{style:Qi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Qi.listContent,children:[jsxRuntime.jsx(Ja,{title:"Popular currencies",currencies:h,selectedCurrency:n,onSelect:T}),h.length>0&&y.length>0&&jsxRuntime.jsx(reactNative.View,{style:Qi.sectionSpacer}),jsxRuntime.jsx(Ja,{title:"All currencies",currencies:y,selectedCurrency:n,onSelect:T}),h.length===0&&y.length===0&&jsxRuntime.jsx(reactNative.View,{style:Qi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Qi.noResultsText,{color:c.container.subtitleColor,fontFamily:m.regular}],children:"No currencies found"})})]})})]})}var Qi=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Uu(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 Rc({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:m,onDepositError:c,borderTopLeftRadius:g,borderTopRightRadius:C,sheetBorderRadius:S}){let{colors:w,fonts:u,components:h}=V(),[y,T]=ai.useState(""),[p,k]=ai.useState("usd"),[d,x]=ai.useState(false),[R,b]=ai.useState(false),[I,A]=ai.useState([]),[E,O]=ai.useState(false),[F,z]=ai.useState(null),[U,he]=ai.useState(null),[Be,We]=ai.useState("amount"),[re,Ae]=ai.useState(null),[Ce,ye]=ai.useState(true),[He,ae]=ai.useState(null),[J,Se]=ai.useState(false),Bt=ai.useRef(null),Ie=ai.useRef(false);ai.useEffect(()=>{Bt.current=re;},[re]),ai.useEffect(()=>{Ie.current=J;},[J]);let[Ne,Qe]=ai.useState([]),[Ee,Ke]=ai.useState(true),[gt,ne]=ai.useState(60),[de,Oe]=ai.useState([]),[ue,Ye]=ai.useState([]),[Qt,yt]=ai.useState(null),[Fe,dt]=ai.useState(null),[fe,ie]=ai.useState(true),[_e,et]=ai.useState(null),[xt,pe]=ai.useState(false),[Me,Wt]=ai.useState(null),[nt,wr]=ai.useState(false),[er,$e]=ai.useState(false),[Cr,q]=ai.useState(false),[se,D]=ai.useState(null),v=r??Be,L=ai.useRef(null),N=de.find(G=>G.currency_code.toLowerCase()===p.toLowerCase()),ke=ai.useCallback(G=>{We(G),G==="quotes"?o?.(G,I.length):o?.(G);},[I.length,o]);ai.useEffect(()=>{async function G(){try{let me=await ya();dt(me);}catch(me){console.error("Error fetching user IP:",me);}finally{ie(false);}}G();},[]),ai.useEffect(()=>{async function G(){try{let me=await hn({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);Qe(me.data);}catch(me){console.error("Error fetching wallets:",me),z("Failed to load wallet addresses");}finally{Ke(false);}}G();},[e,i,s,a,l,t]);let be=n||Qt?.symbol.toUpperCase()||"USDC",it=ls(Qt?.icon_urls,"png")||Qt?.icon_url,le=ls(Qt?.chain_icon_urls,"png")||Qt?.chain_icon_url;ai.useEffect(()=>{async function G(){try{let me=await ha(t);Oe(me.data),Ye(me.preferred||[]);}catch(me){console.error("Error fetching fiat currencies:",me);}}G();},[t]),ai.useEffect(()=>{if(d||de.length===0||!Fe?.alpha2)return;let G=Fe.alpha2.toUpperCase(),me=de.find(Ot=>Ot.country_codes.includes(G));if(me)k(me.currency_code.toLowerCase()),!y&&!R&&T(String(me.default_amount??100));else if(!y&&!R){let Ot=de.find(Dr=>Dr.currency_code.toLowerCase()==="usd");Ot&&T(String(Ot.default_amount??100));}},[de,Fe,d,y,R]),ai.useEffect(()=>{if(de.length!==0){if(L.current!==null&&L.current!==p){let G=de.find(me=>me.currency_code.toLowerCase()===p.toLowerCase());G&&T(String(G.default_amount??100));}L.current=p;}},[p,de]),ai.useEffect(()=>{async function G(){try{let me=await md({chain_type:s||"",chain_id:a||"",token_address:l||""},t);yt(me);}catch(me){console.error("Error fetching supported tokens:",me);}}G();},[s,a,l,t]),ai.useEffect(()=>{async function G(){if(!(!l||!a||!s)&&!fe){pe(true);try{let me=await gd({country_code:Fe?.alpha2?.toUpperCase()||"US",subdivision_code:Fe?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);et(me);}catch(me){console.error("Error fetching default onramp token:",me);}finally{pe(false);}}}G();},[l,a,s,Fe,fe,t]),ai.useEffect(()=>{let G=parseFloat(y);if(isNaN(G)||G<=0){A([]),he(null);return}if(!_e||xt){A([]),Ae(null);return}let me=de.find(Dr=>Dr.currency_code.toLowerCase()===p.toLowerCase());if(me){if(G<me.minimum_amount){A([]),Ae(null),he(`Minimum amount is ${Uu(p)}${me.minimum_amount.toLocaleString()}`);return}if(G>me.maximum_amount){A([]),Ae(null),he(`Maximum amount is ${Uu(p)}${me.maximum_amount.toLocaleString()}`);return}}he(null);let Ot=setTimeout(()=>{Pt(G);},500);return ()=>clearTimeout(Ot)},[y,p,t,_e,xt,de]);let Pt=async G=>{if(!_e){z("Loading token information...");return}O(true),z(null);try{let me={country_code:Fe?.alpha2?.toUpperCase()||"US",source_amount:G.toString(),source_currency:p.toLowerCase(),destination_currency:_e.destination_currency,destination_network:_e.destination_network,subdivision_code:Fe?.state||void 0},Ot=await fd(me,t);A(Ot.data);let Dr=Ie.current,ta=Bt.current;if(Dr&&ta){let Wr=Ot.data.find(oo=>oo.service_provider===ta.service_provider);if(Wr){if(Ae(Wr),Ot.data.length>0){let oo=Ot.data[0];He||ae(oo.service_provider),ye(Wr.service_provider===He);}}else if(Ot.data.length>0){let oo=Ot.data[0];Ae(oo),ae(oo.service_provider),ye(!0),Se(!1);}}else if(Ot.data.length>0){let Wr=Ot.data[0];Ae(Wr),ae(Wr.service_provider),ye(!0);}ne(60);}catch(me){console.error("Failed to fetch quotes:",me),z("Failed to fetch quotes. Please try again."),A([]);}finally{O(false);}};ai.useEffect(()=>{if(I.length===0)return;let G=setInterval(()=>{ne(me=>{if(me<=1){let Ot=parseFloat(y);return !isNaN(Ot)&&Ot>0&&Pt(Ot),60}return me-1});},1e3);return ()=>clearInterval(G)},[I.length,y]);let Rt=G=>{(/^\d*\.?\d{0,2}$/.test(G)||G==="")&&(T(G),b(true));},yo=G=>{T(G.toString()),b(true);},Br=async()=>{if(re&&_e)try{let G=_e.destination_token_metadata.chain_type,me=gn(Ne,G);if(!me?.address){z("Wallet address not available");return}let Ot={service_provider:re.service_provider,country_code:re.country_code?.toUpperCase()||Fe?.alpha2?.toUpperCase()||"US",source_currency:re.source_currency,source_amount:y,destination_currency:re.destination_currency,destination_network:re.destination_network,wallet_address:me.address,subdivision_code:Fe?.state||void 0},Dr=await hd(Ot,t);Wt({provider:re,sourceCurrency:p,sourceAmount:y,sessionUrl:Dr.url}),D(Dr.url),q(!0);}catch(G){console.error("Failed to create session:",G),z("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:G});}},K=Uu(p),Gc=()=>{q(false),ke("onramp"),m?.({message:"Payment flow completed"});},bt=()=>jsxRuntime.jsx(gw,{visible:Cr,onClose:Gc,url:se,providerName:re?.service_provider_display_name||"Complete Payment",colors:w,fonts:u,borderTopLeftRadius:S?.webView?.borderTopLeftRadius??g,borderTopRightRadius:S?.webView?.borderTopRightRadius??C});return v==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Q.amountViewContainer,children:[jsxRuntime.jsxs(at,{style:Q.scrollContainer,contentContainerStyle:Q.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:Q.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>wr(true),style:[Q.currencyButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.input.borderRadius,borderWidth:h.input.borderWidth,borderColor:h.input.borderColor}],children:[N&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(N,"png"))},style:Q.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Q.currencyText,{color:h.card.titleColor,fontFamily:u.medium}],children:p.toUpperCase()}),jsxRuntime.jsx(Yt,{size:16,color:h.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(kc,{open:nt,onOpenChange:wr,currencies:de,preferredCurrencyCodes:ue,selectedCurrency:p,onSelectCurrency:G=>{k(G.toLowerCase()),x(true);},borderTopLeftRadius:S?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:S?.currencyModal?.borderTopRightRadius??C}),jsxRuntime.jsx(reactNative.View,{style:Q.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:Q.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.currencySymbol,{color:h.container.titleColor,fontFamily:u.medium}],children:K}),jsxRuntime.jsx(reactNative.TextInput,{style:[Q.amountInput,{color:h.container.titleColor,fontFamily:u.medium}],value:y,onChangeText:Rt,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:w.foregroundMuted})]})}),N?.suggested_amounts&&N.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:Q.quickAmounts,children:N.suggested_amounts.map(G=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>yo(G),style:[Q.quickAmountButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.button.borderRadius,borderWidth:parseFloat(y)===G?2:h.button.borderWidth,borderColor:parseFloat(y)===G?w.primary:h.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Q.quickAmountText,{color:h.card.titleColor,fontFamily:u.medium}],children:[K,G.toLocaleString()]})},G))}),U&&jsxRuntime.jsx(reactNative.Text,{style:[Q.validationError,{color:w.error,fontFamily:u.regular}],children:U}),jsxRuntime.jsxs(reactNative.View,{style:Q.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.providerLabel,{color:h.card.labelColor,fontFamily:u.medium}],children:"Provider"}),I.length>0&&!E&&jsxRuntime.jsxs(reactNative.Text,{style:[Q.refreshText,{color:h.card.labelRightColor,fontFamily:u.regular}],children:["Refreshing in ",gt,"s"]})]}),jsxRuntime.jsx(br,{cardTokens:h.depositCard.quoteProvider.card,onPress:E||I.length===0?void 0:()=>$e(true),contentStyle:reactNative.StyleSheet.flatten([Q.providerButton,(E||I.length===0)&&Q.disabled]),children:E?jsxRuntime.jsxs(reactNative.View,{style:Q.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Q.loadingText,{color:h.container.subtitleColor,fontFamily:u.regular}],children:"Finding best rates..."})]}):re?jsxRuntime.jsxs(reactNative.View,{style:Q.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.providerInfo,children:[Ce&&jsxRuntime.jsx(reactNative.Text,{style:[Q.autoPickedText,{color:h.container.subtitleColor,fontFamily:u.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:Q.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(wl(re.icon_urls,"png",re.icon_url))},style:Q.providerIconImage},`provider-${re.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.providerName,{color:h.card.titleColor,fontFamily:u.medium}],children:re.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.bestPriceText,{color:h.container.subtitleColor,fontFamily:u.regular}],children:[re.destination_amount.toFixed(2)," ",be]})]})]})]}),jsxRuntime.jsx(xr,{size:20,color:h.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[Q.noProviderText,{color:h.container.subtitleColor,fontFamily:u.regular}],children:parseFloat(y)>0?"No providers available":"Enter an amount to see providers"})}),F&&jsxRuntime.jsx(reactNative.Text,{style:[Q.errorText,{color:w.error,fontFamily:u.regular}],children:F})]}),jsxRuntime.jsxs(wt,{visible:er,onClose:()=>$e(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:S?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:S?.providerModal?.borderTopRightRadius??C,children:[jsxRuntime.jsx(jr,{title:"Select Provider",showBack:false,onClose:()=>$e(false)}),jsxRuntime.jsx(at,{style:Q.providerModalList,contentContainerStyle:Q.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:Q.quotesList,children:I.map(G=>{let me=re?.service_provider===G.service_provider;return jsxRuntime.jsxs(br,{cardTokens:h.depositCard.quoteProvider.card,onPress:()=>{Ae(G),Se(true),ye(G.service_provider===He),$e(false);},contentStyle:reactNative.StyleSheet.flatten([Q.quoteItem,me&&{borderWidth:2,borderColor:w.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:Q.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(wl(G.icon_urls,"png",G.icon_url))},style:Q.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[Q.quoteName,{color:h.card.titleColor,fontFamily:u.medium}],children:G.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Q.quoteAmount,{color:h.card.textRightColor,fontFamily:u.medium}],children:[G.destination_amount.toFixed(2)," ",be]}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.quoteSource,{color:h.card.subtextRightColor,fontFamily:u.regular}],children:["Fee: ",K,G.total_fee.toFixed(2)]})]})]},G.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Q.continueButtonContainer,{backgroundColor:w.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:E||Ee||!re||parseFloat(y)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Br,disabled:E||Ee||!re||parseFloat(y)<=0,style:[Q.continueButton,{backgroundColor:h.container.buttonColor,borderRadius:h.button.borderRadius,borderWidth:h.button.borderWidth,borderColor:h.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Q.continueButtonText,{color:h.container.buttonTitleColor,fontFamily:u.medium}],children:Ee?"Loading...":"Continue"})})})})]}),bt()]}):v==="onramp"&&Me?jsxRuntime.jsxs(reactNative.View,{style:Q.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(wl(Me.provider.icon_urls,"png",Me.provider.icon_url))},style:Q.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.onrampTitle,{color:h.container.titleColor,fontFamily:u.medium}],children:["Complete transaction with ",Me.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.onrampSubtitle,{color:h.container.subtitleColor,fontFamily:u.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[Q.flowDiagram,{backgroundColor:h.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Q.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:cr(`/icons/currencies/png/${Me.sourceCurrency.toLowerCase()}.png`)},style:Q.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowLabel,{color:h.card.subtitleColor,fontFamily:u.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowValue,{color:h.card.titleColor,fontFamily:u.medium}],children:Me.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(xr,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Q.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ls(_e?.destination_token_metadata?.icon_urls,"png")||_e?.destination_token_metadata?.icon_url||cr("/icons/tokens/png/usdc.png")},style:Q.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ls(_e?.destination_token_metadata?.chain?.icon_urls,"png")||_e?.destination_token_metadata?.chain?.icon_url||cr("/icons/networks/png/polygon.png")},style:[Q.flowNetworkBadge,{borderColor:w.background,borderRadius:h.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowLabel,{color:h.card.subtitleColor,fontFamily:u.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowValue,{color:h.card.titleColor,fontFamily:u.medium}],children:"USDC"})]}),jsxRuntime.jsx(xr,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Q.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:it||cr("/icons/tokens/png/usdc.png")},style:Q.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:le||cr("/icons/networks/png/polygon.png")},style:[Q.flowNetworkBadge,{borderColor:w.background,borderRadius:h.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowLabel,{color:h.card.subtitleColor,fontFamily:u.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowValue,{color:h.card.titleColor,fontFamily:u.medium}],children:be})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Q.onrampInfoBox,{backgroundColor:h.card.backgroundColor,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth,borderColor:h.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Q.onrampInfoText,{color:h.card.descriptionColor,fontFamily:u.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 gw({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(wt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Yi.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Yi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(De,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Yi.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Yi.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Yi.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Yi.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Yi.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Yi=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),Q=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Cw(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 Sw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Ic({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=V(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=te(xe(e.destination_token_metadata,"png")||cr("/icons/tokens/png/usdc.png")),m=s?"Deposit Processing":"Deposit Completed",c=Cw(e.created_at||new Date().toISOString()),g=Sw(e.source_amount_usd);return jsxRuntime.jsxs(br,{cardTokens:i,onPress:t,contentStyle:Dn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Dn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Dn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Dn.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(ns,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(De,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Dn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dn.title,{color:i.titleColor,fontFamily:o.medium}],children:m}),jsxRuntime.jsx(reactNative.Text,{style:[Dn.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:Dn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dn.amount,{color:i.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(xr,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var Dn=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Xf(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function eh(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 Tw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var th=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function rh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function xw(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 Rw({count:e=4}){let{colors:t,components:r}=V(),o=ai.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,i=t.cardHover;return ai.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:Gi.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Gi.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.icon,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Gi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.titleBar,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.subtitleBar,{backgroundColor:i,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.amountBar,{backgroundColor:i,opacity:o}]})]},a))})}var Gi=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function $u({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:i,fonts:s,components:a}=V(),[l,m]=ai.useState(r),[c,g]=ai.useState(false),[C,S]=ai.useState(null),[w,u]=ai.useState(false),h=ai.useRef(null);ai.useEffect(()=>{if(!e||!o)return;let R=async()=>{g(true);try{let A=[...(await yn(o,n)).data].sort((E,O)=>{let F=E.created_at?new Date(E.created_at).getTime():0;return (O.created_at?new Date(O.created_at).getTime():0)-F});m(A);}catch(I){console.error("Failed to fetch executions:",I),m(r);}finally{g(false);}};R();let b=setInterval(R,1e4);return ()=>clearInterval(b)},[e,o,n,r]),ai.useEffect(()=>{r.length>0&&m(R=>{let b=new Set(R.map(A=>A.id)),I=r.filter(A=>!b.has(A.id));return I.length>0?[...I,...R]:R});},[r]),ai.useEffect(()=>{e||S(null);},[e]);let y=R=>{S(R);},T=()=>{S(null),u(false);},p=()=>{S(null),t();},k=()=>{if(!C)return null;let R=C,b=R.status==="pending"||R.status==="waiting"||R.status==="delayed",I=R.status==="succeeded",A=te(xe(R.destination_token_metadata,"png")||cr("/icons/tokens/png/usdc.png")),E=R.provider_metadata?.details,O=E?.currencyIn,F=E?.currencyOut;O?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let he=eh(R.source_amount_base_unit,R.source_token_metadata?.decimals),Be=eh(R.destination_amount_base_unit,R.destination_token_metadata?.decimals),We=Tw(R.source_amount_usd),re=Xf(R.source_chain_type,R.source_chain_id),Ae=Xf(R.destination_chain_type,R.destination_chain_id),Ce=()=>{R.explorer_url&&reactNative.Linking.openURL(R.explorer_url);},ye=()=>{R.destination_explorer_url&&reactNative.Linking.openURL(R.destination_explorer_url);};return jsxRuntime.jsxs(at,{ref:h,style:ge.scrollContainer,contentContainerStyle:ge.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ge.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ge.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:A},style:ge.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ge.statusBadge,{backgroundColor:b?i.warning:i.success,borderColor:i.background}],children:b?jsxRuntime.jsx(Yt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(De,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ge.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ge.statusDot,{backgroundColor:b?i.warning:i.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ge.statusText,{color:a.container.titleColor,fontFamily:s.semibold}],children:b?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[ge.dateText,{color:a.container.subtitleColor,fontFamily:s.regular}],children:xw(R.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[ge.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[he," ",rh(R.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[Be," ",rh(R.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:We})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:re})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:Ae})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let He=!w;u(He),He?setTimeout(()=>{h.current?.scrollToEnd({animated:true});},100):h.current?.scrollTo({y:0,animated:true});},style:ge.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.toggleText,{color:a.container.actionTitle,fontFamily:s.regular}],children:w?"See less":"See more details"}),w?jsxRuntime.jsx(Mo,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Yt,{size:14,color:a.container.actionColor,strokeWidth:2})]}),w&&jsxRuntime.jsxs(reactNative.View,{style:[ge.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[R.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ce,style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:th(R.transaction_hash)}),jsxRuntime.jsx(Eo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]})]}),R.destination_explorer_url&&I&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ye,style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:th(R.destination_transaction_hashes[0])}),jsxRuntime.jsx(Eo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},d=c&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{title:C?"Deposit Details":"Deposit Tracker",onClose:p,showClose:!C,showBack:!!C,onBack:T}),C?k():d?jsxRuntime.jsx(Rw,{}):jsxRuntime.jsx(at,{style:ge.scrollContainer,contentContainerStyle:ge.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:ge.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.emptyText,{color:a.container.titleColor,fontFamily:s.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.emptySubtext,{color:a.container.subtitleColor,fontFamily:s.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:ge.executionsList,children:l.map(R=>jsxRuntime.jsx(Ic,{execution:R,onPress:()=>y(R)},R.id))})})]})}var ge=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function Za(e,t=true){let[r,o]=ai.useState(null),[n,i]=ai.useState(null),[s,a]=ai.useState(false),[l,m]=ai.useState(false),[c,g]=ai.useState(null),[C,S]=ai.useState(null);ai.useEffect(()=>{!t||r||(a(true),ya().then(y=>{o(y),g(null);}).catch(y=>{g(y instanceof Error?y:new Error(String(y)));}).finally(()=>{a(false);}));},[t,r]),ai.useEffect(()=>{!t||!e||n||(m(true),ga(e).then(y=>{i(y),S(null);}).catch(y=>{S(y instanceof Error?y:new Error(String(y)));}).finally(()=>{m(false);}));},[t,e,n]);let w=s||l,u=c||C||null,h=null;if(r&&n){let y=n.blocked_country_codes||[],T=r.alpha2.toUpperCase();h=!y.some(p=>p.toUpperCase()===T);}return {isAllowed:h,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:w,error:u}}var Ku="unifold_recent_tokens",Ow=5,lh=[{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 Vc(){try{let e=await Nd__default.default.getItem(Ku);return e?JSON.parse(e):[]}catch{return []}}async function Fw(e){try{let r=(await Vc()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Ow);await Nd__default.default.setItem(Ku,JSON.stringify(o));}catch{}}async function Dw(e){try{let r=(await Vc()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Nd__default.default.setItem(Ku,JSON.stringify(r)),r}catch{return []}}function Qu({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:m,components:c}=V(),[g,C]=ai.useState(""),[S,w]=ai.useState([]);ai.useEffect(()=>{e&&Vc().then(w);},[e]),ai.useEffect(()=>{e||C("");},[e]);let u=ai.useMemo(()=>{let d=[];return r.forEach(x=>{x.chains.forEach(R=>{d.push({token:x,chain:R});});}),d},[r]),h=ai.useMemo(()=>{let d=[],x=new Set,R=(b,I,A,E)=>{let O=`${b}-${I}:${A}`;if(x.has(O))return;let F=r.find(U=>U.symbol===b);if(!F)return;let z=F.chains.find(U=>U.chain_type===I&&U.chain_id===A);z&&(x.add(O),d.push({token:F,chain:z,isRecent:E}));};return S.forEach(b=>{R(b.symbol,b.chainType,b.chainId,true);}),lh.forEach(b=>{R(b.symbol,b.chainType,b.chainId,false);}),d},[r,S]),y=ai.useMemo(()=>{if(!g.trim())return u;let d=g.toLowerCase();return u.filter(({token:x,chain:R})=>x.symbol.toLowerCase().includes(d)||x.name.toLowerCase().includes(d)||R.chain_name.toLowerCase().includes(d))},[u,g]),T=(d,x,R)=>lh.some(b=>b.symbol===d&&b.chainType===x&&b.chainId===R),p=async(d,x)=>{let R=`${x.chain_type}:${x.chain_id}`;if(!T(d.symbol,x.chain_type,x.chain_id)){await Fw({symbol:d.symbol,chainType:x.chain_type,chainId:x.chain_id});let b=await Vc();w(b);}C(""),i(d.symbol,R),t();},k=async(d,x)=>{let R=await Dw({symbol:d.symbol,chainType:x.chain_type,chainId:x.chain_id});w(R);};return jsxRuntime.jsxs(wt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:ht.header,children:[jsxRuntime.jsx(reactNative.View,{style:ht.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ht.headerTitle,{color:c.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:ht.closeButton,children:jsxRuntime.jsx(st,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ht.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ht.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:m.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:g,onChangeText:C,autoCapitalize:"none",autoCorrect:false})}),h.length>0&&!g&&jsxRuntime.jsxs(reactNative.View,{style:ht.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.sectionLabel,{color:c.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ht.quickSelectScroll,children:h.map(({token:d,chain:x,isRecent:R})=>{let b=`${x.chain_type}:${x.chain_id}`;d.symbol===o&&b===n;return jsxRuntime.jsxs(reactNative.View,{children:[R&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>k(d,x),style:ht.removeButton,children:jsxRuntime.jsx(st,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(d,x),activeOpacity:.7,style:[ht.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ht.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(d,"png"))},style:ht.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(x,"png"))},style:[ht.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ht.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.quickSelectSymbol,{color:c.card.titleColor,fontFamily:m.medium}],children:d.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ht.quickSelectChain,{color:c.card.subtitleColor,fontFamily:m.regular}],children:x.chain_name})]})]})]},`quick-${d.symbol}-${b}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[ht.sectionLabel,{color:c.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsxRuntime.jsx(at,{style:ht.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ht.tokenListContent,children:y.length===0?jsxRuntime.jsx(reactNative.View,{style:ht.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ht.emptyText,{color:l.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):y.map(({token:d,chain:x})=>{let R=`${x.chain_type}:${x.chain_id}`,b=d.symbol===o&&R===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(d,x),activeOpacity:.7,style:[ht.tokenItem,{backgroundColor:b?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:ht.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(d,"png"))},style:ht.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(x,"png"))},style:[ht.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ht.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.tokenSymbol,{color:c.card.titleColor,fontFamily:m.medium}],children:d.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ht.tokenChainName,{color:c.card.subtitleColor,fontFamily:m.regular}],children:x.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[ht.minDeposit,{color:c.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",x.minimum_deposit_amount_usd]})]})]},`${d.symbol}-${R}`)})})]})}var ht=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Bc=(e,t)=>`${t}:${e}`,Aw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Yu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:C,onDepositError:S,wallets:w,borderTopLeftRadius:u,borderTopRightRadius:h,sheetBorderRadius:y}){let{colors:T,fonts:p,components:k}=V(),d=a&&l?`${a}:${l}`:"solana:mainnet",[x,R]=ai.useState("USDC"),[b,I]=ai.useState(d),[A,E]=ai.useState([]),[O,F]=ai.useState(!w?.length),z=w?.length?w:A,[U,he]=ai.useState([]),[Be,We]=ai.useState(true),[re,Ae]=ai.useState(false),[Ce,ye]=ai.useState(false),[He,ae]=ai.useState(false),[J,Se]=ai.useState([]),[Bt,Ie]=ai.useState(new Map),[Ne]=ai.useState(()=>new Date),[Qe,Ee]=ai.useState(null),[Ke,gt]=ai.useState(false),[ne,de]=ai.useState(null),[Oe,ue]=ai.useState(false),Ye=new Map;U.forEach(q=>{q.chains.forEach(se=>{let D=`${se.chain_type}:${se.chain_id}`;Ye.has(D)||Ye.set(D,se);});});let Qt=Array.from(Ye.values()),yt=Aw(b),Fe=Qt.find(q=>q.chain_type===yt.chainType&&q.chain_id===yt.chainId),dt=Fe?.chain_type||"ethereum",fe=gn(z,dt),ie=fe?.address||"",_e=ai.useRef(false);ai.useEffect(()=>{async function q(){try{We(!0),Ee(null);let D=await ki(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(he(D.data),D.data.length>0&&!_e.current){_e.current=!0;let v,L;if(a&&l)if(m)for(let N of D.data){let ke=N.chains.find(be=>be.chain_type===a&&be.chain_id===l&&be.token_address.toLowerCase()===m.toLowerCase());if(ke){v=N,L=ke;break}}else for(let N of D.data){let ke=N.chains.find(be=>be.chain_type===a&&be.chain_id===l);if(ke){v=N,L=ke;break}}if(!v&&i)for(let N of D.data){let ke=N.chains.find(be=>be.token_address.toLowerCase()===i.toLowerCase());if(ke){v=N,L=ke;break}}v||(v=D.data.find(N=>N.symbol==="USDC"),v&&v.chains.length>0&&(L=v.chains[0])),v||(v=D.data.find(N=>N.symbol==="USDT"),v&&v.chains.length>0&&(L=v.chains[0])),v||(v=D.data[0],v.chains.length>0&&(L=v.chains[0])),v&&R(v.symbol),L&&I(Bc(L.chain_id,L.chain_type));}}catch(se){console.error("Error fetching supported tokens:",se),Ee("Failed to load supported tokens"),S?.({message:"Failed to load supported tokens",error:se});}finally{We(false);}}q();},[t,i,n,o,a,l,m,S]),ai.useEffect(()=>{g&&g(J);},[J,g]),ai.useEffect(()=>{if(w?.length){F(false);return}if(A.length>0){F(false);return}let q=null,se=false,D=async()=>{if(!se){F(true);try{let v=await hn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);se||(E(v.data),Ee(null),F(!1));}catch(v){console.error("Error fetching wallets, retrying in 5s:",v),se||(Ee(v instanceof Error?v.message:"Failed to load wallets"),F(false),q=setTimeout(D,5e3));}}};return D(),()=>{se=true,q&&clearTimeout(q);}},[e,r,o,n,i,t,w,A.length]);let et=fe?.id??"",{showWaitingUi:xt,handleIveDeposited:pe}=Qa({depositConfirmationMode:c,depositAddress:ie,chain:b,externalUserId:e,publishableKey:t,modalOpenedAt:Ne,depositWalletId:et,depositExecutions:J,trackedExecutions:Bt,setDepositExecutions:Se,setTrackedExecutions:Ie,setLatestExecution:de,setShowStatusSheet:gt,onDepositSuccess:C,onExecutionsChange:g,onDepositError:S});ai.useEffect(()=>{if(!U.length)return;let q=U.find(D=>D.symbol===x);if(!q||q.chains.length===0)return;if(!q.chains.some(D=>Bc(D.chain_id,D.chain_type)===b)){let D=q.chains[0];I(Bc(D.chain_id,D.chain_type));}},[x,U,b]);let Me=U.find(q=>q.symbol===x),nt=(Me?.chains||[]).find(q=>Bc(q.chain_id,q.chain_type)===b),wr=async()=>{if(ie)try{reactNative.Clipboard.setString(ie),Ae(!0),setTimeout(()=>Ae(!1),2e3);}catch(q){console.error("Failed to copy:",q);}},er=nt?.estimated_price_impact_percent??0,$e=nt?.max_slippage_percent??.25,Cr=nt?.minimum_deposit_amount_usd??3;return Be?jsxRuntime.jsxs(reactNative.View,{style:j.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[j.loadingText,{color:T.foregroundMuted,fontFamily:p.regular}],children:"Loading currencies..."})]}):Qe&&U.length===0?jsxRuntime.jsxs(reactNative.View,{style:j.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.errorText,{color:T.error,fontFamily:p.regular}],children:Qe}),jsxRuntime.jsx(reactNative.Text,{style:[j.errorHint,{color:T.foregroundMuted,fontFamily:p.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:j.container,children:[jsxRuntime.jsxs(reactNative.View,{style:j.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.selectorLabel,{color:k.card.labelColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ae(true),disabled:Be||U.length===0,style:[j.tokenSelectorButton,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],activeOpacity:.7,children:Be?jsxRuntime.jsxs(reactNative.View,{style:j.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[j.loadingIcon,{backgroundColor:T.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:j.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[j.loadingLine,{backgroundColor:T.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[j.loadingLine,{backgroundColor:T.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:j.tokenIconWrapper,children:[Me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(Me,"png"))},style:j.tokenMainIcon}),(nt||Fe)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(nt||Fe,"png"))},style:[j.tokenChainBadge,{borderColor:k.card.backgroundColor,borderRadius:k.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:j.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.tokenSelectorSymbol,{color:k.card.titleColor,fontFamily:p.semibold}],children:Me?.symbol||x}),jsxRuntime.jsx(reactNative.Text,{style:[j.tokenSelectorNetwork,{color:k.card.subtitleColor,fontFamily:p.regular}],numberOfLines:1,children:nt?.chain_name||Fe?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:j.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[j.minDepositText,{color:k.card.labelHighlightRightColor,fontFamily:p.medium}],children:["$",Cr," min"]}),jsxRuntime.jsx(xr,{size:16,color:k.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Qu,{visible:He,onClose:()=>ae(false),tokens:U,selectedToken:x,selectedChainKey:b,onSelect:(q,se)=>{R(q),I(se);},borderTopLeftRadius:y?.tokenSelector?.borderTopLeftRadius??u,borderTopRightRadius:y?.tokenSelector?.borderTopRightRadius??h}),jsxRuntime.jsx(reactNative.View,{style:j.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[j.qrWrapper,{backgroundColor:T.background,borderRadius:k.card.borderRadius,borderWidth:k.card.borderWidth>0?k.card.borderWidth:1,borderColor:k.card.borderColor}],children:O?jsxRuntime.jsxs(reactNative.View,{style:j.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[j.loadingText,{color:T.foregroundMuted,fontFamily:p.regular}],children:"Loading..."})]}):ie?jsxRuntime.jsx($s,{value:ie,size:180,logoUri:te(xe(nt,"png")||cr("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:j.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[j.errorText,{color:T.error,fontFamily:p.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:j.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:j.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.addressLabel,{color:k.card.labelColor,fontFamily:p.medium}],children:"Deposit Address"}),re&&jsxRuntime.jsxs(reactNative.View,{style:j.copiedIndicator,children:[jsxRuntime.jsx(De,{size:14,color:T.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[j.copiedText,{color:T.success,fontFamily:p.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(br,{cardTokens:k.transferCrypto.depositAddress.card,onPress:!O&&ie?wr:void 0,contentStyle:j.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.addressText,{color:k.card.titleColor,fontFamily:p.regular}],numberOfLines:2,children:O?"Loading...":ie||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:j.addressCopyIcon,children:jsxRuntime.jsx(mn,{size:16,color:k.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[j.detailsCard,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(!Ce),style:j.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:j.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[j.detailIcon,{backgroundColor:k.card.iconBackgroundColor,borderRadius:k.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Kr,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[j.detailsLabel,{color:k.card.titleColor,fontFamily:p.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:j.chevronContainer,children:Ce?jsxRuntime.jsx(Mo,{size:16,color:k.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Yt,{size:16,color:k.card.actionColor,strokeWidth:2})})]}),Ce&&jsxRuntime.jsxs(reactNative.View,{style:j.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:j.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[j.detailIcon,{backgroundColor:k.card.iconBackgroundColor,borderRadius:k.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zn,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[j.detailsLabel,{color:k.card.titleColor,fontFamily:p.regular}],children:["Price impact: ",er.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(is,{size:14,color:k.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:j.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[j.detailIcon,{backgroundColor:k.card.iconBackgroundColor,borderRadius:k.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qr,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[j.detailsLabel,{color:k.card.titleColor,fontFamily:p.regular}],children:["Slippage: Auto \u2022 ",$e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(is,{size:14,color:k.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:j.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[j.detailIcon,{backgroundColor:k.card.iconBackgroundColor,borderRadius:k.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ml,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[j.detailsLabel,{color:k.card.titleColor,fontFamily:p.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(yc,{depositConfirmationMode:c,depositAddress:ie,showWaitingUi:xt,latestExecution:ne,onIveDeposited:pe}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:j.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[j.termsText,{color:T.primary,fontFamily:p.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(wt,{visible:Oe,onClose:()=>ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:y?.infoSheet?.borderTopLeftRadius??u,borderTopRightRadius:y?.infoSheet?.borderTopRightRadius??h,children:[jsxRuntime.jsxs(reactNative.View,{style:[j.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:j.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[j.sheetTitle,{color:k.header.titleColor,fontFamily:p.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(false),style:j.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:k.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:j.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[j.infoCard,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:j.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[j.infoCardIcon,{backgroundColor:k.card.iconBackgroundColor,borderRadius:k.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zn,{size:16,color:k.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[j.infoCardTitle,{color:k.card.titleColor,fontFamily:p.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[j.infoCardValue,{color:k.card.titleColor,fontFamily:p.medium}],children:[er.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[j.infoCardDescription,{color:k.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:[j.infoCard,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:j.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[j.infoCardIcon,{backgroundColor:k.card.iconBackgroundColor,borderRadius:k.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qr,{size:16,color:k.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[j.infoCardTitle,{color:k.card.titleColor,fontFamily:p.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[j.infoCardValue,{color:k.card.titleColor,fontFamily:p.medium}],children:[$e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[j.infoCardDescription,{color:k.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."})]})]})]}),ne&&jsxRuntime.jsx(js,{visible:Ke,status:ne.status,tokenIconUrl:ne.destination_token_metadata?.icon_urls?.find(q=>q.format==="png")?.url||ne.destination_token_metadata?.icon_url||xe(Me,"png"),explorerUrl:ne.explorer_url,completionExplorerUrl:ne.destination_explorer_url,date:ne.created_at?new Date(ne.created_at):void 0,amountUsd:ne.source_amount_usd?parseFloat(ne.source_amount_usd):void 0,onClose:()=>gt(false),borderTopLeftRadius:y?.depositStatus?.borderTopLeftRadius??u,borderTopRightRadius:y?.depositStatus?.borderTopRightRadius??h})]})}var j=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 Bn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Hw(){let{colors:e,components:t}=V(),r=ai.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ai.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:[gi.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[gi.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:gi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[gi.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[gi.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:gi.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[gi.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:gi.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var gi=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 Nw({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:m,defaultChainType:c,defaultChainId:g,defaultTokenAddress:C,showBalance:S=false,hideDepositTracker:w=false,enableStripeLinkPay:u=false,StripeOnrampComponent:h,stripeOnrampEmail:y,stripeOnrampPhone:T,stripeMerchantIdentifier:p,stripePaymentSelectorPosition:k,stripeSkipSuccessConfirmation:d,stripeTheme:x,depositConfirmationMode:R="auto_ui",transferInputVariant:b="double_input",initialScreen:I="main",onDepositSuccess:A,onDepositError:E,sheetBorderRadius:O}){let F=O?.globalBorderTopLeftRadius,z=O?.globalBorderTopRightRadius,{colors:U,fonts:he}=V(),[Be,We]=ai.useState([]),[re,Ae]=ai.useState(null),[Ce,ye]=ai.useState("amount"),He=I==="tracker"&&!w?"tracker":I==="transfer"?"transfer":I==="card"?"card":"main",ae=He==="main",[J,Se]=ai.useState(He),{isAllowed:Bt,isLoading:Ie}=Za(o,e);ai.useEffect(()=>{if(!e||re)return;let fe=false;return ga(o).then(async ie=>{if(fe)return;let _e=[];for(let et of ie?.transfer_crypto?.networks??[]){let xt=et.icon_urls.find(pe=>pe.format==="png")?.url||et.icon_urls.find(pe=>pe.format==="svg")?.url;xt&&_e.push(te(xt));}for(let et of ie?.payment_networks?.networks??[]){let xt=et.icon_urls.find(pe=>pe.format==="png")?.url||et.icon_urls.find(pe=>pe.format==="svg")?.url;xt&&_e.push(te(xt));}_e.length>0&&await Cu(_e),fe||Ae(ie);}).catch(console.error),()=>{fe=true;}},[e,re,o]);let Ne=()=>{t();};ai.useEffect(()=>{e&&(Se(He),ye("amount"));},[e,He]);let Qe=ai.useCallback(()=>{ae?(Se("main"),ye("amount")):Ne();},[ae,Ne]),Ee=Be.filter(fe=>fe.status==="pending"||fe.status==="waiting").length,gt=!!(s&&a&&l&&m&&o)&&S!==false&&!!re,ne=Ie||e&&!re,de=Bt===false,Oe=null;if(J==="stripe"&&h){let fe=jsxRuntime.jsx(h,{publishableKey:o,email:y,phone:T,externalUserId:r,recipientAddress:s??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:m,merchantIdentifier:p,paymentSelectorPosition:k,skipSuccessConfirmation:d,appName:re?.project_name??"",onClose:Qe});Oe=x?jsxRuntime.jsx(ss,{...x,children:fe}):fe;}let ue=J==="stripe"?.9:J==="transfer"||J==="card"?.94:J==="tracker"?.6:J==="main"?.5:void 0,Ye=J==="tracker"||J==="main"?.9:void 0,yt={main:O?.main,transfer:O?.transferCrypto,card:O?.buyWithCard,stripe:O?.stripeLinkPay,tracker:O?.depositsTracker}[J],Fe=yt?.borderTopLeftRadius??F,dt=yt?.borderTopRightRadius??z;return jsxRuntime.jsxs(wt,{visible:e,onClose:J==="main"?Ne:Qe,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:ue,maxHeightPercent:Ye,borderTopLeftRadius:Fe,borderTopRightRadius:dt,children:[J==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{title:n,showBack:false,onClose:Ne,showBalance:gt,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:re?.project_name}),ne&&jsxRuntime.jsx(Hw,{}),!ne&&de&&jsxRuntime.jsxs(reactNative.View,{style:Ur.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Ur.iconContainer,{backgroundColor:U.cardHover}],children:jsxRuntime.jsx(ca,{size:32,color:U.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.blockedTitle,{color:U.foreground,fontFamily:he.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.blockedDescription,{color:U.foreground,opacity:.7,fontFamily:he.regular}],children:"There are no supported tokens available from your current location."})]}),!ne&&!de&&jsxRuntime.jsxs(reactNative.View,{style:Ur.optionsContainer,children:[jsxRuntime.jsx(Ha,{onPress:()=>Se("transfer"),title:Bn.transferCrypto.title,subtitle:Bn.transferCrypto.subtitle,featuredTokens:re?.transfer_crypto?.networks}),jsxRuntime.jsx($a,{onPress:()=>Se("card"),title:Bn.depositWithCard.title,subtitle:Bn.depositWithCard.subtitle,paymentNetworks:re?.payment_networks?.networks}),u&&h&&jsxRuntime.jsx(Ka,{onPress:()=>Se("stripe"),title:Bn.stripeLinkPay.title,subtitle:Bn.stripeLinkPay.subtitle}),!w&&jsxRuntime.jsx(ja,{onPress:()=>Se("tracker"),title:Bn.depositTracker.title,subtitle:Bn.depositTracker.subtitle,badge:Ee>0?Ee:void 0})]})]}),J==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{title:Bn.transferCrypto.title,showBack:false,onClose:Qe,showBalance:gt,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:re?.project_name}),Ie&&jsxRuntime.jsx(reactNative.View,{style:[Ur.centeredContainer,Ur.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:U.primary})}),!Ie&&de&&jsxRuntime.jsxs(reactNative.View,{style:[Ur.centeredContainer,Ur.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Ur.iconContainer,{backgroundColor:U.cardHover}],children:jsxRuntime.jsx(ca,{size:32,color:U.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.blockedTitle,{color:U.foreground,fontFamily:he.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.blockedDescription,{color:U.foreground,opacity:.7,fontFamily:he.regular}],children:"There are no supported tokens available from your current location."})]}),!Ie&&!de&&jsxRuntime.jsx(at,{style:Ur.transferScrollContainer,contentContainerStyle:Ur.scrollContent,showsVerticalScrollIndicator:false,children:b==="single_input"?jsxRuntime.jsx(Yu,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:g,defaultTokenAddress:C,depositConfirmationMode:R,onExecutionsChange:We,onDepositSuccess:A,onDepositError:E,borderTopLeftRadius:F,borderTopRightRadius:z,sheetBorderRadius:{tokenSelector:O?.tokenSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}}):jsxRuntime.jsx(wc,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:g,defaultTokenAddress:C,depositConfirmationMode:R,onExecutionsChange:We,onDepositSuccess:A,onDepositError:E,borderTopLeftRadius:F,borderTopRightRadius:z,sheetBorderRadius:{tokenSelector:O?.tokenSelector,chainSelector:O?.chainSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}})})]}),J==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{title:`Deposit ${i||"USDC"}`,showBack:Ce==="onramp",onBack:()=>ye("amount"),onClose:Qe,showBalance:gt,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:re?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Ur.buyWithCardContainer,children:jsxRuntime.jsx(Rc,{externalUserId:r,publishableKey:o,destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:m,onDepositSuccess:A,onDepositError:E,view:Ce,onViewChange:fe=>ye(fe),borderTopLeftRadius:F,borderTopRightRadius:z,sheetBorderRadius:{providerModal:O?.providerModal,webView:O?.webView,currencyModal:O?.currencyModal}})})]}),J==="stripe"&&Oe&&jsxRuntime.jsx(reactNative.View,{style:Ur.stripeLinkPayContainer,children:Oe}),J==="tracker"&&jsxRuntime.jsx($u,{active:J==="tracker",onClose:Qe,executions:Be,externalUserId:r,publishableKey:o})]})}function Ec({theme:e="auto",...t}){return jsxRuntime.jsx(Nw,{...t})}var Ur=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Mc(e,t=true){return _n({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Sl(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Zu(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return _n({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await ki(i),m=null,c=null,g=null,C=null,S,w,u,h=l.data.some(y=>y.chains.some(T=>{let p=T.chain_type===t&&T.chain_id===r&&T.token_address.toLowerCase()===o.toLowerCase();return p&&(m=T.minimum_deposit_amount_usd,c=T.estimated_processing_time,g=T.max_slippage_percent,C=T.estimated_price_impact_percent,u=T.chain_name,w=y),p}));if(w){let y=xe(w,"png");y&&(S=te(y));}return {isSupported:h,minimumAmountUsd:m,estimatedProcessingTime:c,maxSlippagePercent:g,priceImpactPercent:C,errorMessage:h?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:S,chainName:u}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Xu(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return _n({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await kl(t,r,o,n,i);if(l.balance){let m=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",g=l.balance.amount,C=BigInt(g),S=BigInt(10**m),w=C/S,h=(C%S).toString().padStart(m,"0").replace(/0+$/,""),y=h?`${w}.${h}`:w.toString();return {balanceBaseUnit:g,balanceHuman:y,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:m,symbol:c}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var jw=2500,qw=3e3,Kw=6e4;function ep({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=ai.useState([]),[l,m]=ai.useState(false),c=ai.useRef(new Date),g=ai.useRef(new Map),C=ai.useRef(false),S=ai.useRef(n),w=ai.useRef(i);return ai.useEffect(()=>{S.current=n;},[n]),ai.useEffect(()=>{w.current=i;},[i]),ai.useEffect(()=>{o&&!C.current&&(c.current=new Date,g.current.clear()),o||g.current.clear(),C.current=o;},[o]),ai.useEffect(()=>{if(!e||!o)return;let u=c.current,h=async()=>{try{let T=await yn(e,t,"withdraw"),p=new Date(u.getTime()-Kw),k=[...T.data].sort((b,I)=>{let A=b.created_at?new Date(b.created_at).getTime():0;return (I.created_at?new Date(I.created_at).getTime():0)-A}),d=["pending","waiting","delayed"],x=["succeeded","failed"],R=null;for(let b of k){let I=b.created_at?new Date(b.created_at):null;if(!I||I<p)continue;let A=g.current.get(b.id);if(!A){R=b;break}if(d.includes(A)&&x.includes(b.status)){R=b;break}}if(R){let b=R,I=b.created_at?new Date(b.created_at):null;if(!I||I<c.current)return;let A=g.current.get(b.id);g.current.set(b.id,b.status),a(E=>{let O=E.findIndex(F=>F.id===b.id);if(O>=0){let F=[...E];return F[O]=b,F}return [...E,b]}),b.status==="succeeded"&&(!A||d.includes(A))?S.current?.({message:"Withdrawal completed successfully",transaction:b}):b.status==="failed"&&A!=="failed"&&w.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:b});}}catch(T){console.error("Failed to fetch withdraw executions:",T),w.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:T});}};h();let y=setInterval(h,jw);return m(true),()=>{clearInterval(y),m(false);}},[e,t,o]),ai.useEffect(()=>{if(!o||!r)return;let u=async()=>{try{await wd({deposit_wallet_id:r},t);}catch{}};u();let h=setInterval(u,qw);return ()=>clearInterval(h)},[o,r,t]),{executions:s,isPolling:l}}var tp=(e,t)=>`${t}:${e}`;function tl({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:m,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:g}){let{colors:C,fonts:S,components:w}=V(),[u,h]=ai.useState(false),[y,T]=ai.useState(false),p=w.card,k=t?e.find(b=>b.symbol===t):void 0,d=k?.chains||[],x=r?d.find(b=>tp(b.chain_id,b.chain_type)===r):void 0,R={backgroundColor:p.backgroundColor,borderRadius:p.borderRadius,borderWidth:p.borderWidth||1,borderColor:p.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:rt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:rt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[rt.label,{color:p.labelColor,fontFamily:S.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.selectButton,R],onPress:()=>!i&&e.length>0&&h(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[rt.placeholder,{color:p.subtitleColor,fontFamily:S.regular}],children:"Loading..."}):k?jsxRuntime.jsxs(reactNative.View,{style:rt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(k,"png"))},style:rt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.selectedText,{color:p.titleColor,fontFamily:S.medium}],numberOfLines:1,children:k.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[rt.placeholder,{color:p.subtitleColor,fontFamily:S.regular}],children:"Select receive token"}),jsxRuntime.jsx(Yt,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:rt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[rt.label,{color:p.labelColor,fontFamily:S.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.selectButton,R,(!k||d.length===0)&&rt.disabled],onPress:()=>!i&&k&&d.length>0&&T(true),activeOpacity:.7,disabled:i||!k||d.length===0,children:[x?jsxRuntime.jsxs(reactNative.View,{style:rt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(x,"png"))},style:rt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.selectedText,{color:p.titleColor,fontFamily:S.medium}],numberOfLines:1,children:x.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[rt.placeholder,{color:p.subtitleColor,fontFamily:S.regular}],children:"Chain"}),jsxRuntime.jsx(Yt,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(wt,{visible:u,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:m,children:[jsxRuntime.jsxs(reactNative.View,{style:rt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:rt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerTitle,{color:C.foreground,fontFamily:S.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:rt.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:C.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(as,{data:e,keyExtractor:b=>b.symbol,contentContainerStyle:rt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:b})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.pickerItem,{backgroundColor:b.symbol===t?C.cardHover:"transparent"}],onPress:()=>{o(b.symbol),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(b,"png"))},style:rt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerItemText,{color:C.foreground,fontFamily:S.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerItemSub,{color:C.foregroundMuted,fontFamily:S.regular}],children:b.name}),b.symbol===t&&jsxRuntime.jsx(De,{size:18,color:C.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(wt,{visible:y,onClose:()=>T(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:rt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:rt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerTitle,{color:C.foreground,fontFamily:S.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:rt.pickerHeaderClose,onPress:()=>T(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:C.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(as,{data:d,keyExtractor:b=>tp(b.chain_id,b.chain_type),contentContainerStyle:rt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:b})=>{let I=tp(b.chain_id,b.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.pickerItem,{backgroundColor:I===r?C.cardHover:"transparent"}],onPress:()=>{n(I),T(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(xe(b,"png"))},style:rt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerItemText,{color:C.foreground,fontFamily:S.medium}],children:b.chain_name}),I===r&&jsxRuntime.jsx(De,{size:18,color:C.primary,strokeWidth:2.5})]})}})]})]})}var rt=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function rp(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 _n({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>bd({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 Jw(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function Zw(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 Xw(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Uc({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:m,balanceData:c,isLoadingBalance:g,minimumWithdrawAmountUsd:C,estimatedProcessingTime:S,maxSlippagePercent:w,priceImpactPercent:u,canWithdraw:h,onDepositWalletCreation:y,onWithdraw:T,onWithdrawError:p,onWithdrawSubmitted:k,onViewTracker:d}){let x="https://unifold.io/terms",R="https://unifold.io/support",{colors:b,fonts:I,components:A}=V(),[E,O]=ai.useState(a||""),[F,z]=ai.useState(""),[U,he]=ai.useState(false),[Be,We]=ai.useState(null),[re,Ae]=ai.useState(false),[Ce,ye]=ai.useState(""),He=ai.useRef(null);ai.useEffect(()=>{O(a||""),z(""),We(null);},[a]);let ae=E.trim();ai.useEffect(()=>{let pe=setTimeout(()=>ye(ae),500);return ()=>clearTimeout(pe)},[ae]);let{data:J,isLoading:Se,error:Bt}=rp({chainType:m?.chain_type,chainId:m?.chain_id,tokenAddress:m?.token_address,recipientAddress:Ce,publishableKey:e,enabled:Ce.length>5&&!!m}),Ie=ae!==Ce,Ne=ai.useMemo(()=>!ae||ae.length<=5||Ie||Se?null:Bt?"Invalid address":J&&!J.valid?J.failure_code==="account_not_found"?`Account not found on ${m?.chain_name}`:J.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${m?.chain_name}`:"Invalid address":null,[ae,Ie,Se,Bt,J,m,l]),Qe=!Ie&&!!J?.valid&&!Ne,Ee=ai.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),Ke=ai.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),gt=n||c?.symbol||"TOKEN",ne=c?.decimals??6,de=ai.useMemo(()=>{let pe=parseFloat(F);return !pe||pe<=0?0:pe},[F]),Oe=ai.useMemo(()=>{let pe=parseFloat(F);return !pe||pe<=0?0:pe*Ee},[F,Ee]),ue=ai.useCallback(async()=>{try{let Me=await Hh("expo-clipboard").getStringAsync();Me&&(O(Me.trim()),We(null));}catch{}},[]),Ye=ai.useCallback(()=>{Ke<=0||z(c?.balanceHuman??"0");},[Ke,c]),Qt=C!==null&&Oe>0&&Oe<C,yt=de>0&&Ke>0&&de>Ke,Fe=ae.length>0&&F.trim().length>0&&de>0&&Qe&&!Qt&&!yt&&!!c,dt=ai.useCallback(async()=>{if(!(!l||!m||!Fe||!h)){he(true),We(null);try{let pe=await y({destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,recipientAddress:ae}),Me=Zw(de,ne),Wt=Xw(de,ne),nt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:gt,sourceTokenIconUrl:s,destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,destinationTokenSymbol:l.symbol,destinationChainName:m.chain_name,destinationTokenIconUrl:l?te(xe(l,"png")):void 0,amount:Wt,amountBaseUnit:Me,submittedAt:new Date,withdrawIntentAddress:pe.address,recipientAddress:ae};await T(nt),k(nt);}catch(pe){let Me=pe instanceof Error?pe.message:"Withdrawal failed. Please try again.",Wt=Me.length>120?"Withdrawal failed. Please try again.":Me;We(Wt),p?.({message:Me,error:pe,code:"WITHDRAW_FAILED"});}finally{he(false);}}},[l,m,Fe,h,ae,t,r,o,gt,s,F,Ke,c,de,ne,Oe,y,T,p,k]),fe=A.input,ie=A.card,_e=A.button,et=Ne?b.error:fe.borderColor,xt=ai.useMemo(()=>U?"Processing...":yt?"Insufficient balance":Qt?`Minimum $${C?.toFixed(2)}`:Be?"Withdrawal failed \u2014 try again":"Withdraw",[U,yt,Qt,C,Be]);return jsxRuntime.jsxs(reactNative.View,{style:Xe.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.label,{color:ie.labelColor,fontFamily:I.medium}],children:"Recipient address"}),(Ie||Se)&&ae.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:ue,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(gp,{size:16,color:b.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Xe.inputRow,{backgroundColor:fe.backgroundColor,borderRadius:fe.borderRadius,borderWidth:fe.borderWidth,borderColor:et}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Xe.textInput,{color:fe.textColor,fontFamily:I.regular}],placeholder:"Enter wallet address",placeholderTextColor:fe.placeholderColor,value:E,onChangeText:pe=>{O(pe),We(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>He.current?.focus()})}),Ne?jsxRuntime.jsx(reactNative.Text,{style:[Xe.errorText,{color:b.error,fontFamily:I.regular}],children:Ne}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Xe.label,{color:ie.labelColor,fontFamily:I.medium,paddingBottom:8}],children:["Amount",C!=null&&C>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:b.warning,fontFamily:I.regular},children:` ($${C.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xe.amountRow,{backgroundColor:fe.backgroundColor,borderRadius:fe.borderRadius,borderWidth:fe.borderWidth,borderColor:fe.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:He,style:[Xe.amountInput,{color:fe.textColor,fontFamily:I.regular}],placeholder:"0.00",placeholderTextColor:fe.placeholderColor,value:F,onChangeText:pe=>{(pe===""||/^\d*\.?\d*$/.test(pe))&&(z(pe),We(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.unitLabel,{color:b.foregroundMuted,fontFamily:I.medium}],children:gt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xe.maxButton,{backgroundColor:`${b.primary}20`}],onPress:Ye,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.maxText,{color:b.primary,fontFamily:I.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xe.detailsCard,{marginTop:24,backgroundColor:ie.backgroundColor,borderRadius:ie.borderRadius,borderWidth:ie.borderWidth||1,borderColor:ie.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Xe.detailsToggle,onPress:()=>Ae(!re),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.detailIcon,{backgroundColor:ie.iconBackgroundColor,borderRadius:ie.iconContainerBorderRadius}],children:jsxRuntime.jsx(Kr,{size:12,color:ie.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xe.detailsLabel,{color:ie.titleColor,fontFamily:I.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:I.medium},children:Jw(S)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:re?"180deg":"0deg"}]},children:jsxRuntime.jsx(Yt,{size:16,color:ie.actionColor,strokeWidth:2})})]})}),re&&jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.detailIcon,{backgroundColor:ie.iconBackgroundColor,borderRadius:ie.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qr,{size:12,color:ie.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xe.detailsLabel,{color:ie.titleColor,fontFamily:I.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:["Auto \u2022 ",(w??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.detailIcon,{backgroundColor:ie.iconBackgroundColor,borderRadius:ie.iconContainerBorderRadius}],children:jsxRuntime.jsx(zn,{size:12,color:ie.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xe.detailsLabel,{color:ie.titleColor,fontFamily:I.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:[(u??0).toFixed(2),"%"]})]})]})]})]}),Be&&jsxRuntime.jsx(reactNative.Text,{style:[Xe.errorText,{color:b.error,fontFamily:I.regular,textAlign:"center"}],children:Be}),jsxRuntime.jsxs(reactNative.View,{style:Xe.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xe.withdrawButton,{backgroundColor:_e.primaryBackground,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth,borderColor:_e.borderColor,opacity:!Fe||!h||U?.5:1}],onPress:dt,disabled:!Fe||!h||U,activeOpacity:.8,children:[U&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:_e.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.withdrawButtonText,{color:_e.primaryText,fontFamily:I.medium}],children:xt})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.historyLink,onPress:d,activeOpacity:.7,children:[jsxRuntime.jsx(Kr,{size:14,color:b.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.historyText,{color:b.foregroundMuted,fontFamily:I.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(x),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.legalText,{color:b.foregroundMuted,fontFamily:I.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.legalSeparator,{color:b.foregroundMuted,fontFamily:I.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(R),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.legalText,{color:b.foregroundMuted,fontFamily:I.regular}],children:"Help"})})]})]})]})]})}var Xe=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function rC(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 oC(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function $c({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=V(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,m=te(xe(e.destination_token_metadata,"png")||cr("/icons/tokens/png/usdc.png")),c=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",g=rC(e.created_at||new Date().toISOString()),C=oC(e.source_amount_usd);return jsxRuntime.jsxs(br,{cardTokens:i,onPress:t,contentStyle:An.container,children:[jsxRuntime.jsxs(reactNative.View,{style:An.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:m},style:An.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[An.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(aa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(ns,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(De,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:An.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[An.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[An.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:An.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[An.amount,{color:i.textRightColor,fontFamily:o.medium}],children:C}),jsxRuntime.jsx(xr,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var An=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 ip(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 m=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${m} ${l}`}catch{return e}}function Th(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function iC(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 xh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Rh(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function rl({label:e,value:t,isLast:r}){let{fonts:o,components:n}=V(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:qe.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qe.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[qe.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[qe.divider,{backgroundColor:i.borderColor}]})]})}function ap({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=V(),[m,c]=ai.useState([]),[g,C]=ai.useState(!!n),S=l.card,w=l.button,u=l.header,h=l.container;ai.useEffect(()=>{yd().then(he=>c(he.data)).catch(()=>{});},[]),ai.useEffect(()=>{C(!!n);},[e?.id]);let y=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,T=e?e.status==="failed"||e.status==="refunded":false,p=T?s.error:y?s.warning:s.success,k=T?"Failed":y?"Processing":"Completed",d=e?.destination_token_metadata?te(xe(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?te(t.destinationTokenIconUrl):te(cr("/icons/tokens/png/usdc.png")),x=e?.created_at?ip(e.created_at):t.submittedAt?ip(t.submittedAt.toISOString()):ip(new Date().toISOString()),R=e?`${Th(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${xh(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,b=e?`${Th(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${xh(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,I=e?iC(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?Cl(m,e.source_chain_type,e.source_chain_id):t.sourceChainId,E=e?Cl(m,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,O=e?.transaction_hash,F=e?.explorer_url,z=e?.destination_transaction_hashes?.[0],U=e?.destination_explorer_url;return jsxRuntime.jsxs(at,{style:qe.scroll,contentContainerStyle:qe.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:qe.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(os,{size:22,color:u.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:qe.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[qe.headerTitle,{color:u.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:qe.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:u.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:qe.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:qe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[qe.statusBadge,{backgroundColor:p}],children:T?jsxRuntime.jsx(aa,{size:10,color:"#FFFFFF",strokeWidth:3}):y?jsxRuntime.jsx(reactNative.View,{style:qe.spinnerDot}):jsxRuntime.jsx(De,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:qe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[qe.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[qe.statusText,{color:p,fontFamily:a.medium}],children:k})]}),jsxRuntime.jsx(reactNative.Text,{style:[qe.dateText,{color:h.subtitleColor,fontFamily:a.regular}],children:x}),jsxRuntime.jsxs(reactNative.View,{style:[qe.detailsCard,{backgroundColor:S.backgroundColor,borderRadius:S.borderRadius,borderWidth:S.borderWidth??1,borderColor:S.borderColor}],children:[jsxRuntime.jsx(rl,{label:"Amount Sent",value:R}),jsxRuntime.jsx(rl,{label:"Amount Received",value:b}),jsxRuntime.jsx(rl,{label:"USD Value",value:I}),jsxRuntime.jsx(rl,{label:"Source Network",value:A}),jsxRuntime.jsx(rl,{label:"Destination Network",value:E,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:qe.moreDetailsRow,onPress:()=>C(he=>!he),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[qe.moreDetailsText,{color:h.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(Mo,{size:16,color:h.actionColor,strokeWidth:2}):jsxRuntime.jsx(Yt,{size:16,color:h.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[qe.detailsCard,{backgroundColor:S.backgroundColor,borderRadius:S.borderRadius,borderWidth:S.borderWidth??1,borderColor:S.borderColor}],children:O&&F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:qe.txRow,onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[qe.txLabel,{color:S.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[qe.txHash,{color:S.titleColor,fontFamily:a.regular}],children:Rh(O)}),jsxRuntime.jsx(Eo,{size:14,color:S.actionColor,strokeWidth:2})]}),!y&&z&&U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[qe.divider,{backgroundColor:S.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:qe.txRow,onPress:()=>reactNative.Linking.openURL(U),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[qe.txLabel,{color:S.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[qe.txHash,{color:S.titleColor,fontFamily:a.regular}],children:Rh(z)}),jsxRuntime.jsx(Eo,{size:14,color:S.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:qe.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[qe.detailLabel,{color:S.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:qe.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[qe.button,qe.halfButton,{backgroundColor:w.secondaryBackground,borderRadius:w.borderRadius,borderWidth:w.borderWidth,borderColor:w.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[qe.buttonText,{color:w.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[qe.button,qe.halfButton,{backgroundColor:w.primaryBackground,borderRadius:w.borderRadius,borderWidth:w.borderWidth,borderColor:w.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[qe.buttonText,{color:w.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var qe=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 _h(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function jc({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=V(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",m=a?.status==="failed",c={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Lt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Lt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Lt.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(De,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Lt.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",_h(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Lt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Lt.button,Lt.halfButton,c,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Lt.button,Lt.halfButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):m?jsxRuntime.jsxs(reactNative.View,{style:Lt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Lt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Lt.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(st,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Lt.button,Lt.fullButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Lt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Lt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(ot,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(e.sourceTokenIconUrl)},style:Lt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Lt.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Lt.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",_h(e.recipientAddress)]})]})}var Lt=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 uC(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:te(xe(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:te(xe(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var vh=(e,t)=>`${t}:${e}`;function pC(){let{colors:e}=V(),t=ai.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ai.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 Qc({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,defaultDestinationChainType:s,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:m="Withdraw Crypto",onWithdraw:c,onWithdrawSuccess:g,onWithdrawError:C,heightPercent:S=.94,sheetBorderRadius:w,sourceChainType:u,sourceChainId:h,sourceTokenAddress:y,sourceTokenSymbol:T,sourceChainName:p,sourceTokenIconUrl:k}){let{colors:d,fonts:x}=V(),[R,b]=ai.useState("form"),[I,A]=ai.useState(u),[E,O]=ai.useState(h),[F,z]=ai.useState(y),[U,he]=ai.useState(T),[Be,We]=ai.useState(p),[re,Ae]=ai.useState(k),[Ce,ye]=ai.useState(null),[He,ae]=ai.useState(null),[J,Se]=ai.useState(null),[Bt,Ie]=ai.useState(),[Ne,Qe]=ai.useState([]),[Ee,Ke]=ai.useState(null),[gt,ne]=ai.useState("form"),de=ai.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Oe=ai.useRef(null),ue=!!I&&!!E&&!!F,{data:Ye,isLoading:Qt}=Mc(r,e&&R==="form"),yt=Ye?.data??[],{data:Fe,isLoading:dt}=Zu({sourceChainType:I,sourceChainId:E,sourceTokenAddress:F,sourceTokenSymbol:U,publishableKey:r,enabled:e&&ue&&R==="form"}),{data:fe,isLoading:ie}=Xu({address:n,chainType:I,chainId:E,tokenAddress:F,publishableKey:r,enabled:e&&ue}),{executions:_e}=ep({userId:o,publishableKey:r,depositWalletId:Bt,enabled:!!Bt&&e,onWithdrawSuccess:g,onWithdrawError:C});ai.useEffect(()=>{if(!e||R!=="tracker")return;let le=false;return yn(o,r,"withdraw").then(Pt=>{le||Qe(Pt.data);}).catch(console.error),()=>{le=true;}},[e,R,o,r]),ai.useEffect(()=>{e&&(Oe.current&&(clearTimeout(Oe.current),Oe.current=null),b("form"),A(u),O(h),z(y),he(T),We(p),Ae(k),ye(null),ae(null),Se(null),Ie(void 0),Qe([]),Ke(null),ne("form"),de.setValue(reactNative.Dimensions.get("window").width));},[e]),ai.useEffect(()=>()=>{Oe.current&&clearTimeout(Oe.current);},[]),ai.useEffect(()=>{re||Fe?.iconUrl&&Ae(Fe.iconUrl);},[Fe?.iconUrl,re]),ai.useEffect(()=>{Be||Fe?.chainName&&We(Fe.chainName);},[Fe?.chainName,Be]),ai.useEffect(()=>{if(!yt.length||Ce)return;let le,Pt;if(s&&a)if(l)for(let Rt of yt){let yo=Rt.chains.find(Br=>Br.chain_type===s&&Br.chain_id===a&&Br.token_address.toLowerCase()===l.toLowerCase());if(yo){le=Rt,Pt=yo;break}}else for(let Rt of yt){let yo=Rt.chains.find(Br=>Br.chain_type===s&&Br.chain_id===a);if(yo){le=Rt,Pt=yo;break}}le||(le=yt[0]),le&&(ye(le),ae(Pt??le.chains[0]??null));},[yt,Ce,s,a,l]),ai.useEffect(()=>{R==="confirming"&&_e.length>0&&b("details");},[R,_e]);let et=ai.useCallback(()=>{t(),Oe.current=setTimeout(()=>{b("form"),A(u),O(h),z(y),he(T),We(p),Ae(k),ye(null),ae(null),Se(null),Ie(void 0),Qe([]),Ke(null),ne("form"),Oe.current=null;},300);},[t,u,h,y,T,p,k]),xt=ai.useCallback(le=>{let Pt=yt.find(Rt=>Rt.symbol===le);Pt&&(ye(Pt),Pt.chains.length>0&&ae(Pt.chains[0]));},[yt]),pe=ai.useCallback(le=>{if(!Ce)return;let Pt=Ce.chains.find(Rt=>vh(Rt.chain_id,Rt.chain_type)===le);Pt&&ae(Pt);},[Ce]),Me=ai.useCallback(async le=>{let Pt=await hn({external_user_id:o,destination_chain_type:le.destinationChainType,destination_chain_id:le.destinationChainId,destination_token_address:le.destinationTokenAddress,recipient_address:le.recipientAddress,action_type:"withdraw"},r),Rt=gn(Pt.data,I??"");if(!Rt)throw new Error(`No deposit wallet found for chain type: ${I}`);return Ie(Rt.id),{id:Rt.id,address:Rt.address}},[o,r,I]),Wt=ai.useCallback(le=>{Se(le),b("confirming");},[]),nt=ai.useCallback(le=>{Ke(le),de.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(de,{toValue:0,duration:280,useNativeDriver:true}).start();},[de]),wr=ai.useCallback(()=>{reactNative.Animated.timing(de,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ke(null));},[de]),er=Qt||dt,$e=Fe?.isSupported??null,Cr=R==="confirming"?"Withdrawal Status":m,q=w?.globalBorderTopLeftRadius,se=w?.globalBorderTopRightRadius,D=w?.main?.borderTopLeftRadius??q,v=w?.main?.borderTopRightRadius??se,L=w?.tokenSelector?.borderTopLeftRadius??q,N=w?.tokenSelector?.borderTopRightRadius??se,ke=w?.chainSelector?.borderTopLeftRadius??q,be=w?.chainSelector?.borderTopRightRadius??se,it=(()=>{if(R!=="form"||!ue||ie||!fe)return;let le=U||fe.symbol,Pt=fe.balanceUsd;if(Pt!=null){let Br=`$${parseFloat(Pt).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return le?`Balance: ${Br} ${le}`:`Balance: ${Br}`}let Rt=fe.balanceHuman;if(!(!Rt||Rt==="0"))return le?`Balance: ${Rt} ${le}`:`Balance: ${Rt}`})();return jsxRuntime.jsx(wt,{visible:e,onClose:et,closeOnBackdropPress:false,enablePanDownToClose:R==="tracker"||R==="form",showHandle:R==="tracker"||R==="form",heightPercent:R==="confirming"?.3:R==="details"?.7:R==="tracker"?.6:S,maxHeightPercent:R==="tracker"?.9:void 0,borderTopLeftRadius:D,borderTopRightRadius:v,children:R==="confirming"&&J?jsxRuntime.jsx(jc,{txInfo:J,executions:_e,onClose:et,onViewTracker:()=>{ne("confirming"),b("tracker");}}):R==="details"&&J?jsxRuntime.jsx(ap,{execution:_e.length>0?_e[_e.length-1]:null,txInfo:J,onClose:et,onViewHistory:()=>{ne("details"),b("tracker");},onHeaderClose:()=>b("form")}):R==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:un.trackerContainer,children:[jsxRuntime.jsx(jr,{title:"Withdrawal History",onClose:()=>b(gt)}),Ne.length===0?jsxRuntime.jsx(reactNative.View,{style:un.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[un.emptyText,{color:d.foregroundMuted,fontFamily:x.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(as,{data:Ne,keyExtractor:le=>le.id,contentContainerStyle:un.listContent,showsVerticalScrollIndicator:false,renderItem:({item:le})=>jsxRuntime.jsx($c,{execution:le,onPress:()=>nt(le)})}),Ee&&jsxRuntime.jsx(reactNative.Animated.View,{style:[un.historyDetailOverlay,{backgroundColor:d.background,transform:[{translateX:de}]}],children:jsxRuntime.jsx(ap,{execution:Ee,txInfo:uC(Ee),onClose:et,onBack:wr,onViewHistory:wr})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{title:Cr,subtitle:it,onClose:et}),er?jsxRuntime.jsx(pC,{}):$e===false?jsxRuntime.jsxs(reactNative.View,{style:un.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[un.unsupportedTitle,{color:d.foreground,fontFamily:x.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[un.unsupportedMessage,{color:d.foregroundMuted,fontFamily:x.regular}],children:Fe?.errorMessage})]}):jsxRuntime.jsx(mC,{publishableKey:r,sourceChainType:I??"",sourceChainId:E??"",sourceTokenAddress:F??"",sourceTokenSymbol:U,sourceChainName:Be,sourceTokenIconUrl:re,recipientAddressProp:i,destinationTokens:yt,selectedToken:Ce,selectedChain:He,selectedChainKey:He?vh(He.chain_id,He.chain_type):null,onTokenChange:xt,onChainChange:pe,tokensLoading:Qt,balanceData:fe??null,isLoadingBalance:ie,sourceValidation:Fe??null,onDepositWalletCreation:Me,onWithdraw:c,onWithdrawError:C,onWithdrawSubmitted:Wt,onViewTracker:()=>{ne("form"),b("tracker");},tokenSelectorLeft:L,tokenSelectorRight:N,chainSelectorLeft:ke,chainSelectorRight:be})]})})}function mC({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:m,selectedChain:c,selectedChainKey:g,onTokenChange:C,onChainChange:S,tokensLoading:w,balanceData:u,isLoadingBalance:h,sourceValidation:y,onDepositWalletCreation:T,onWithdraw:p,onWithdrawError:k,onWithdrawSubmitted:d,onViewTracker:x,tokenSelectorLeft:R,tokenSelectorRight:b,chainSelectorLeft:I,chainSelectorRight:A}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(at,{style:{flex:1,paddingTop:16},contentContainerStyle:un.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:un.doubleInputWrapper,children:jsxRuntime.jsx(tl,{tokens:l,selectedTokenSymbol:m?.symbol??null,selectedChainKey:g,onTokenChange:C,onChainChange:S,isLoading:w,tokenPickerBorderTopLeftRadius:R,tokenPickerBorderTopRightRadius:b,chainPickerBorderTopLeftRadius:I,chainPickerBorderTopRightRadius:A})}),jsxRuntime.jsx(Uc,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:m,selectedChain:c,balanceData:u,isLoadingBalance:h,minimumWithdrawAmountUsd:y?.minimumAmountUsd??null,estimatedProcessingTime:y?.estimatedProcessingTime??null,maxSlippagePercent:y?.maxSlippagePercent??null,priceImpactPercent:y?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:T,onWithdraw:p,onWithdrawError:k,onWithdrawSubmitted:d,onViewTracker:x})]})})}var un=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 Oh=ai.createContext(null);function TC({children:e,publishableKey:t,config:r}){let[o]=ai.useState(()=>new mu({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=ai.useState(false),[s,a]=ai.useState(null),[l,m]=ai.useState(false),[c,g]=ai.useState(null),C=reactNative.useColorScheme(),S=ai.useRef(false);S.current||(gl({publishableKey:t}),S.current=true);let w=ai.useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?C==="dark"?"dark":"light":F},[r?.appearance,C]);ai.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.'),gl({publishableKey:t});},[t]),ai.useEffect(()=>()=>{h.current&&clearTimeout(h.current),x.current&&clearTimeout(x.current);},[]);let u=ai.useRef(null),h=ai.useRef(null),y=ai.useCallback(F=>{h.current&&(clearTimeout(h.current),h.current=null),u.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),u.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),u.current=null);let z=new Promise((U,he)=>{u.current={resolve:U,reject:he};});return a(F),i(true),z},[]),T=ai.useCallback(()=>{u.current&&(u.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),u.current=null),i(false),h.current=setTimeout(()=>{a(null),h.current=null;},200);},[]),p=ai.useCallback(F=>{s?.onSuccess&&s.onSuccess(F),u.current&&(u.current.resolve(F),u.current=null);},[s]),k=ai.useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),s?.onError&&s.onError(F),u.current&&(u.current.reject(F),u.current=null);},[s]),d=ai.useRef(null),x=ai.useRef(null),R=ai.useRef(void 0),b=ai.useCallback(F=>{x.current&&(clearTimeout(x.current),x.current=null),d.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),d.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),d.current=null);let z=new Promise((U,he)=>{d.current={resolve:U,reject:he};});return R.current=F.onClose,g(F),m(true),z},[]),I=ai.useCallback(()=>{d.current&&(d.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),d.current=null),R.current?.(),R.current=void 0,m(false),x.current=setTimeout(()=>{g(null),x.current=null;},200);},[]),A=ai.useCallback(F=>{c?.onSuccess&&c.onSuccess(F),d.current&&(d.current.resolve(F),d.current=null);},[c]),E=ai.useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),c?.onError&&c.onError(F),d.current&&(d.current.reject(F),d.current=null);},[c]),O=ai.useMemo(()=>({publishableKey:t,beginDeposit:y,closeDeposit:T,beginWithdraw:b,closeWithdraw:I}),[t,y,T,b,I]);return jsxRuntime.jsx(gu,{client:o,children:jsxRuntime.jsx(Oh.Provider,{value:O,children:jsxRuntime.jsxs(ss,{mode:w,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(Ec,{visible:n,onClose:T,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:s.externalUserId,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeOnrampEmail:s.stripeOnrampEmail,stripeOnrampPhone:s.stripeOnrampPhone,stripeTheme:{mode:w,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",initialScreen:s.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?zm():void 0,onDepositSuccess:p,onDepositError:k,theme:w,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(Qc,{visible:l,onClose:I,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,defaultDestinationChainType:c.defaultDestinationChainType,defaultDestinationChainId:c.defaultDestinationChainId,defaultDestinationTokenAddress:c.defaultDestinationTokenAddress,onWithdraw:c.withdraw,onWithdrawSuccess:A,onWithdrawError:E,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function xC(){let e=ai.useContext(Oh);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
10
|
+
exports.AmountScreen=El;exports.BottomSheet=wt;exports.KYCWizardScreen=Ml;exports.OnrampScreen=Jl;exports.StripeOnramp=Zl;exports.StripeOnrampPreconfigure=Em;exports.UnifoldProvider=TC;exports.getPreferredIcon=xe;exports.getStripePublishableKey=Vl;exports.getSupportedDestinationTokens=Sl;exports.normalizeIconUrl=te;exports.registerStripeOnramp=Xl;exports.setDevApiUrl=Tp;exports.setStripeOnrampApiUrl=Dl;exports.setStripeOnrampPublishableKey=Fl;exports.useAllowedCountry=Za;exports.useStripeOnramp=zl;exports.useTheme=V;exports.useUnifold=xC;
|