@unifold/connect-react-native 0.1.47-beta.1 → 0.1.47
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 +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';var qi=require('react'),reactNative=require('react-native'),Gt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),fm=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Mu=require('@react-native-async-storage/async-storage'),Nb=require('expo-constants'),NC=require('react-native-qrcode-svg/src/genMatrix'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var qi__namespace=/*#__PURE__*/_interopNamespace(qi);var Gt__default=/*#__PURE__*/_interopDefault(Gt);var fm__default=/*#__PURE__*/_interopDefault(fm);var Mu__default=/*#__PURE__*/_interopDefault(Mu);var Nb__default=/*#__PURE__*/_interopDefault(Nb);var NC__default=/*#__PURE__*/_interopDefault(NC);var nm=e=>{throw TypeError(e)};var Pg=(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 Jd=(e,t,r)=>t.has(e)||nm("Cannot "+r);var y=(e,t,r)=>(Jd(e,t,"read from private field"),r?r.call(e):t.get(e)),pe=(e,t,r)=>t.has(e)?nm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),j=(e,t,r,o)=>(Jd(e,t,"write to private field"),t.set(e,r),r),pt=(e,t,r)=>(Jd(e,t,"access private method"),r);var qa=(e,t,r,o)=>({set _(n){j(e,t,n);},get _(){return y(e,t,o)}});var Zd={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)"}},Xd=Zd;function tc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Ka(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,w)=>{let m=o?.[p]?.[g];if(m!==void 0)return m;let f=t?.[p]?.[g];return f!==void 0?f:w},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,u=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:tc(s,i)},transferCrypto:{depositAddress:{card:tc(s,a)}},depositCard:{quoteProvider:{card:tc(s,l)}},depositTracker:{executionRow:{card:tc(s,u)}}}}function eu(e,t,r){let n={...Zd[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var tu=qi.createContext(null);function A(){let e=qi.useContext(tu);if(!e){let t=Xd.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Ka(t,void 0,"dark"),isDark:true}}return e}function St({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=A(),l=s??a.primary,u=i??a.primary,p=qi.useRef(new reactNative.Animated.Value(0)).current,g=qi.useId(),w=qi.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),m=(e-t)/2,f=2*Math.PI*m,T=e/2,I=o??Math.max(0,Math.round(e-t*2-8)),k=(e-I)/2;qi.useEffect(()=>{let v=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),S=requestAnimationFrame(()=>v.start());return ()=>{cancelAnimationFrame(S),v.stop();}},[p]);let _=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:_}]},children:jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Gt.Defs,{children:jsxRuntime.jsxs(Gt.LinearGradient,{id:w,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Gt.Stop,{offset:"100%",stopColor:u})]})}),jsxRuntime.jsx(Gt.Circle,{cx:T,cy:T,r:m,stroke:`url(#${w})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${T}, ${T}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:k+1.5,left:k,width:I,height:I},children:r}):null]})}function ou({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function qs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ht({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Hr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ks({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Jt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Go({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.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 Qs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ys({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.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 hn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function uo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.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 Ja({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.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(Gt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Gt.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Gt.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function dm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function um({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Gt__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Gt.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 Gs({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=qi.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),u=qi.useMemo(()=>{let m=o?.[l];return eu(l,m,r)},[l,o,r]),p=qi.useMemo(()=>Ka(u,i,l),[u,i,l]),g=qi.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),w=qi.useMemo(()=>({mode:l,colors:u,fonts:g,components:p,isDark:l==="dark"}),[l,u,g,p]);return jsxRuntime.jsx(tu.Provider,{value:w,children:e})}var tl={damping:28,stiffness:300,mass:.8},ny=80,iy=500;function _t({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:u=false,borderTopLeftRadius:p=24,borderTopRightRadius:g=24,marginHorizontal:w,marginBottom:m,overlay:f,useModal:T=true}){let{colors:I}=A(),{height:k}=reactNative.useWindowDimensions(),[_,v]=qi.useState(false),S=qi.useRef(e);S.current=e;let x=qi.useRef(0),d=i!=null&&i>=1,c=d||u?0:reactNative.Platform.OS==="ios"?34:24,C=a!=null&&i!=null&&a>i,h=i!=null?(C?a:i)*k:void 0,D=C?(a-i)*k:0,L=l?0:D,V=fm.useSharedValue(k),R=qi.useRef(null),E=qi.useCallback(()=>{R.current&&(clearTimeout(R.current),R.current=null),S.current||v(false);},[]);qi.useEffect(()=>{e?(R.current&&(clearTimeout(R.current),R.current=null),v(true),V.value=fm.withSpring(L,tl)):_&&(V.value=fm.withTiming(k,{duration:250},$=>{$&&fm.runOnJS(E)();}),R.current=setTimeout(()=>{R.current=null,E();},350));},[e]),qi.useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]),qi.useEffect(()=>{_&&e&&(V.value=fm.withSpring(L,tl));},[L,C]);let U=qi.useCallback(()=>{o&&t();},[o,t]),q=qi.useMemo(()=>{if(!(!n&&!C))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{x.current=V.value;},onPanResponderMove:($,ae)=>{if(Math.abs(ae.dy)<4)return;let Q=x.current+ae.dy;V.value=Math.max(0,Q);},onPanResponderRelease:($,ae)=>{if(!(Math.abs(ae.dy)<4)){if(n&&(ae.dy>ny||ae.vy>iy)){t();return}if(C){let Q=D/2,Y=V.value<Q?0:D;V.value=fm.withSpring(Y,tl);}else V.value=fm.withSpring(L,tl);}},onPanResponderTerminate:()=>{V.value=fm.withSpring(L,tl);}}).panHandlers},[n,C,D,L,V,t]),Qe=fm.useAnimatedStyle(()=>({transform:[{translateY:V.value}]})),ne=fm.useAnimatedStyle(()=>({opacity:fm.interpolate(V.value,[0,k*.5,k],[.5,.25,0],fm.Extrapolation.CLAMP)}));if(!_)return null;let Je=jsxRuntime.jsxs(reactNative.View,{style:[jn.root,!T&&jn.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(fm__default.default.View,{style:[jn.backdrop,ne],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:U})}),jsxRuntime.jsxs(fm__default.default.View,{style:[jn.sheet,Qe,{height:h,backgroundColor:I.background,borderTopLeftRadius:d?0:p,borderTopRightRadius:d?0:g,...w?{marginHorizontal:w,marginBottom:m??w+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:p,borderBottomRightRadius:g}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:h!=null?jn.gestureRoot:jn.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:jn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[jn.handle,{backgroundColor:I.foreground+"33"}]})}),r,c>0&&jsxRuntime.jsx(reactNative.View,{style:{height:c}})]}),q&&jsxRuntime.jsx(reactNative.View,{...q,style:jn.dragOverlay})]})]});return T?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[Je,f]}):Je}var jn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...reactNative.StyleSheet.absoluteFillObject,zIndex:9999},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),Tt=qi__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Tt.displayName="BottomSheetScrollView";function Js(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var sy="https://api.unifold.io",su="__UnifoldDevApiBaseUrl__",Nr="pk_test_123",ac={};function ay(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[su];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function hr(){return ay()??sy}function lc(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.'),Nr=e.publishableKey;}e.defaultConfig&&(ac=e.defaultConfig);}function gm(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[su]=t:delete globalThis[su];}function rl(){return hr()}function cc(){return Nr}function no(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function jt(e){let t=e.startsWith("/")?e:`/${e}`;return `${hr()}/api/public${t}`}function re(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,hr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${hr()}${e}`:`${hr()}/api/public${e}`:""}async function Zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||ac.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||ac.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ac.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Nr;no(n);let s=await fetch(`${hr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Eo(e,t){return e.find(r=>r.chain_type===t)}async function Xo(e,t,r){let o=t||Nr;no(o);let n=await fetch(`${hr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function dc(e,t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function 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 qn(e,t){let r=e||Nr;no(r);let o=`${hr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function au(e,t){let r=t||Nr;no(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${hr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function uc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function lu(e,t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function cu(e,t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function du(e,t){let r=t||Nr;no(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${hr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function ol(e){let t=e||Nr;no(t);let r=await fetch(`${hr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function _i(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function nl(e){let t=e||Nr;no(t);let r=await fetch(`${hr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function uu(){let e=await fetch(`${hr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function pc(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function il(){let e=await fetch(`${hr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function mc(e){let t=e||Nr;no(t);let r=await fetch(`${hr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function pu(e,t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function mu(e,t){return dc(e.deposit_wallet_id,t)}async function fc(e,t,r,o,n){let s=n||Nr;no(s);let i=await fetch(`${hr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function fu(e,t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function hu(e="usd",t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function gu(e,t){let r=t||Nr;no(r);let o=await fetch(`${hr()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}function bm({size:e=28}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Gt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Gt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Gt.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 wm({size:e=28}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Gt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Gt.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(Gt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Gt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Gt.Defs,{children:jsxRuntime.jsx(Gt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Gt.Rect,{width:28,height:28,fill:"white"})})})]})}function km({size:e=28}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Gt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.Defs,{children:jsxRuntime.jsx(Gt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Gt.Rect,{width:28,height:28,fill:"white"})})})]})}function xm({size:e=28}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Gt.Defs,{children:[jsxRuntime.jsxs(Gt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Gt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Gt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Gt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Gt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Gt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Gt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Gt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.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 Rm({size:e=28}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Gt.G,{children:[jsxRuntime.jsx(Gt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Gt.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 hc=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:bm},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:wm},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:km},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:xm},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Rm}];function gc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function yc(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ea(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=hc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=hc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function qt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=A(),i=r==="back",a=i?jsxRuntime.jsx(Ks,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(ht,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ii.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:Ii.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Ii.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Ii.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Ii.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Ii.headerWithTitle:Ii.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Ii.headerSpacer}),!i&&l]})}var bc={paddingTop:8,paddingBottom:8},Ii=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...bc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...bc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function po({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=A();return e?jsxRuntime.jsx(reactNative.Text,{style:[_m.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[_m.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var _m=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function en({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(qi.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function Tu({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=qi.useState(false),{colors:a,components:l}=A(),u=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=gc(r);return jsxRuntime.jsxs(qi.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:u,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(lt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(Go,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Cc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ta({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=A(),s=e.toLowerCase(),i=Cc[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function wc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=A(),u=jt(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ea(r);return jsxRuntime.jsxs(reactNative.View,{style:[Mo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:Mo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:Mo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Hr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Mo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Mo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Mo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Mo.tokenIcon,{backgroundColor:Cc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Mo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Mo=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 bn(){let{colors:e,fonts:t,components:r}=A(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return qi.useMemo(()=>{let l=i.borderRadius,u={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},g={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},w=Math.max(16,Math.min(l,22)),m={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:w,borderTopRightRadius:w,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:w,borderBottomRightRadius:w,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},f={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},T={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:u,quote:g,pm:m,wallet:f,flow:T,amount:p}},[e,t,o,n,s,i,a])}var Pm="",Fm;function Sc(e){Pm=e;}function Tc(e){Fm=e;}function ho(){let e=Pm||cc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function go(){return Fm??rl()}async function kc(){let e=`${go()}/v1/public/onramps/headless/stripe/config`,t=ho(),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 ku(e){let t=await fetch(`${go()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Vm(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":ho(),"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 xu(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Dm(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(`${go()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Om(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Kn(e,t){let r=`${go()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":ho(),"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 Lm(e){let t=`${go()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":ho(),"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 Bm(e,t){let r=`${go()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":ho(),"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 Ru(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":ho(),"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 _u(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(`${go()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":ho(),"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 Iu(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":ho(),"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 Am(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(`${go()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":ho(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function vi(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Wm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${go()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":ho()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function Ly({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Gt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Gt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Gt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Gt.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(Gt.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(Gt.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 By({size:e=24}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Gt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Gt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Gt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Ay({size:e=24}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Gt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Gt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Gt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Gt.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 Pu({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(qs,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(Ly,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(By,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Ay,{size:t}):jsxRuntime.jsx(qs,{size:t*.75,color:r,strokeWidth:1.75})}function xc(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var Vu={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Du(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 Hm({status:e,colors:t,fontFamily:r}){let o=Du(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Vu[e]??e})})}function Nm({count:e=4}){let{colors:t,components:r}=A(),o=qi.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ra.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ra.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ra.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ra.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ra.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ra.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ra=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 $m({active:e,interval:t=15e3,color:r}){let o=qi.useRef(new reactNative.Animated.Value(0)).current;return qi.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function jm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=A(),[s,i]=qi.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,u=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=Du(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",w=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",m=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,T=vi(f?.icon_urls,f?.icon_url),I=ea(l?.destination_network??""),k=l?.wallet_address?gc(l.wallet_address):null,_=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,v=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,S=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,d=>d.toUpperCase()):null,x=[{label:"Amount",value:g},{label:"Received",value:`${w} ${m}`},...S?[{label:"Payment",value:S}]:[],{label:"Network",value:I},...k?[{label:"Wallet",value:k}]:[],..._?[{label:"Network Fee",value:_}]:[],...v?[{label:"Transaction Fee",value:v}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(qt,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Tt,{style:Er.scroll,contentContainerStyle:Er.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Er.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ta,{currency:m||"USD",tokenIconUrl:T,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Er.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:u?jsxRuntime.jsx(oo,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(ht,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Er.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Er.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Er.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Vu[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Er.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:xc(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Er.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Er.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Er.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:[Er.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(lt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Go,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),x.map(d=>jsxRuntime.jsx(qi__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Er.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Er.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:d.label}),jsxRuntime.jsx(reactNative.Text,{style:[Er.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:d.value})]})},d.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Er.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Er.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Er.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Er.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Er=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 Km({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=A(),[i,a]=qi.useState(false),l=u=>{a(false),e(u);};return jsxRuntime.jsxs(reactNative.View,{style:wn.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wn.trigger,onPress:()=>a(u=>!u),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(cm,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:wn.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[wn.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wn.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(oo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[wn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wn.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(uo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[wn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wn.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(dm,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[wn.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var wn=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 Gy=[50,100,500],Jy=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Ym(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Zy(e){return e.card?`${Ym(e.card.brand)} ${Ym(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function vc({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:u,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:w,onConfirm:m,onCancel:f,sheetBorderTopLeftRadius:T,sheetBorderTopRightRadius:I,accessToken:k,showHistoryProgressBar:_=true,onLogout:v,onRequestKYC:S,showSwitchAccount:x=true,inputDisabled:d=false}){let c=bn(),{colors:C,components:h,fonts:D}=A(),L=T??h.card.borderRadius,V=I??h.card.borderRadius,[R,E]=qi.useState(e),[U,q]=qi.useState(r?"apple_pay":g.length>0?g[0].id:null),Qe=qi.useRef(false),ne=P=>{Qe.current=true,q(P);};qi.useEffect(()=>{Qe.current||r||g.length>0&&q(g[0].id);},[g,r]);let[Je,$]=qi.useState(false),[ae,Q]=qi.useState("select"),[Y,we]=qi.useState(null),G=qi.useRef(false);qi.useEffect(()=>{l&&u&&/saving/i.test(u)&&Q("card");},[l,u]);let ie=s,Ye=ie!=null&&ie>0,Be=qi.useMemo(()=>{if(o)return [];let P=Gy.map(b=>({label:`$${b}`,amount:String(b),disabled:false}));return P.push({label:"MAX",amount:Ye?String(ie):"0",disabled:!Ye}),P},[o,Ye,ie]),Ze=P=>{if(P==="\u232B"){E(b=>b.slice(0,-1));return}if(P==="."){if(R.includes("."))return;E(b=>b===""?"0.":b+".");return}E(b=>{let B=b.indexOf(".");return B!==-1&&b.length-B>2?b:b==="0"&&P!=="."?P:b+P});},Ge=R===""?"0":R,Ue=parseFloat(R),Me=n!=null&&!isNaN(Ue)&&Ue>0&&Ue<n,ot=ie!=null&&ie>0&&!isNaN(Ue)&&Ue>ie,De=R!==""&&!isNaN(Ue)&&Ue>0&&!Me&&!ot,Ae=r||g.length>0,ce=i==="header",ye=qi.useMemo(()=>{let P=[];r&&P.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let b of g)P.push({id:b.id,label:Zy(b),hint:b.card?`Expires ${b.card.exp_month}/${b.card.exp_year}`:b.type,brand:b.card?.brand,isApplePay:false});return P},[r,g]),ke=ye.find(P=>P.id===U),Ne=U!=null&&U!=="apple_pay",dt=ke?ke.label:Ne&&Y?Y:Ne?"Card":"Pay With",Nt=ke?!ke.isApplePay:Ne,_e=ke?.brand??Y??void 0,[Re,Ve]=qi.useState(false),[at,Ie]=qi.useState([]),[be,Oe]=qi.useState(false),[Ut,Ht]=qi.useState(null),[wt,yt]=qi.useState(null),rr=qi.useRef(null);rr.current=wt;let We=qi.useRef(false);We.current=Re;let ve=qi.useCallback(async(P=false)=>{if(k){P||(Oe(true),Ht(null));try{let b=await Lm(k);if(!We.current)return;let B=Array.isArray(b.data)?b.data:Array.isArray(b)?b:[];Ie(B),P||Ht(null);let O=rr.current?.id;if(O){let J=B.find(M=>M.id===O);J&&yt(J);}}catch(b){if(!We.current)return;P||Ht(b?.message??"Failed to load history");}finally{!P&&We.current&&Oe(false);}}},[k]),$e=qi.useCallback(()=>{Ve(true),ve();},[ve]);qi.useEffect(()=>{if(!Re||!k)return;let P=setInterval(()=>ve(true),15e3);return ()=>clearInterval(P)},[Re,k,ve]);let ge=qi.useCallback(P=>{switch(P){case "history":$e();break;case "kyc":S?.();break;case "logout":v?.();break}},[$e,S,v]),H=!!k||!!S||!!v?jsxRuntime.jsx(Km,{onSelect:ge,showKycOption:!!S,showSwitchAccount:x&&!!v}):void 0,ue=Ae?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ce?c.amount.paymentRowHeader:c.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(Q("select"),$(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:c.amount.paymentLeft,children:[ke?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):Nt?jsxRuntime.jsx(Pu,{sublabel:_e,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:c.amount.paymentLabel,children:dt}),jsxRuntime.jsx(Jt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:c.form.screen,children:[jsxRuntime.jsx(qt,{onPress:f,title:"Enter amount",leftAction:H}),ce&&ue,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,Ge==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ge]}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.currencyLabel,children:t.toUpperCase()}),Me&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.minAmountText,{color:C.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),ot&&ie!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.minAmountText,{color:C.warning}],children:["Maximum amount is $",ie.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!ce&&ue,Be.length>0&&jsxRuntime.jsx(reactNative.View,{style:c.amount.quickRow,children:Be.map(P=>{let b=!P.disabled&&R===P.amount&&R!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,b&&{backgroundColor:C.primary},P.disabled&&{opacity:.4}],activeOpacity:.7,disabled:P.disabled||l,onPress:()=>E(P.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.quickPillText,b&&{color:C.primaryForeground}],children:P.label})},P.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:Jy.map((P,b)=>jsxRuntime.jsx(reactNative.View,{style:c.amount.numpadRow,children:P.map(B=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.numpadKey,(l||d)&&{opacity:.3}],onPress:()=>Ze(B),activeOpacity:.6,disabled:l||d,children:jsxRuntime.jsx(reactNative.Text,{style:B==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:B})},B))},b))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.form.continueBtn,(!De||l||d)&&c.form.continueBtnDisabled],onPress:()=>De&&!l&&!d&&m(R,U),disabled:!De||l||d,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,(!De||d)&&c.form.continueBtnTextDisabled],children:"Continue"})}),!Je&&p?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:p}):!Je&&l&&u&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:u}):null]}),jsxRuntime.jsx(_t,{visible:Je,onClose:()=>{l||($(false),Q("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetContent,children:ae==="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:()=>$(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(ht,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Tt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[ye.map(P=>{let b=U===P.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[c.amount.sheetOption,b&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{ne(P.id),we(P.isApplePay?null:P.label),$(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetOptionIcon,children:P.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Pu,{sublabel:P.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:P.label}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:P.hint})]})]}),b&&jsxRuntime.jsx(lt,{size:18,color:C.primary,strokeWidth:2.5})]},P.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!G.current){G.current=true;try{let P=await w?.();P&&(ne(P.token),we(P.sublabel),$(!1));}finally{G.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||Q("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Ks,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:u||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{a&&De&&a(false,R);},children:jsxRuntime.jsx(reactNative.Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(_t,{visible:Re,onClose:()=>{Ve(false),yt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:wt?jsxRuntime.jsx(jm,{session:wt,onBack:()=>yt(null)}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetContent,children:[jsxRuntime.jsx(qt,{onPress:()=>Ve(false),title:"Purchase History"}),_&&jsxRuntime.jsx($m,{active:Re&&!be&&at.length>0,color:C.primary}),be?jsxRuntime.jsx(Nm,{}):Ut?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:Ut})}):at.length===0?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.sheetStatusText,{color:C.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Tt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:at.map(P=>{let b=P.transaction_details,B=b?.source_amount?`$${parseFloat(b.source_amount).toFixed(2)}`:"\u2014",O=(b?.destination_currency??"").toUpperCase(),J=b?.destination_amount?`${parseFloat(b.destination_amount).toFixed(2)} ${O}`:"",M=xc(P.created),je=P.destination_token_metadata,He=vi(je?.icon_urls,je?.icon_url),Jr=vi(je?.chain?.icon_urls,je?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.sheetOption,activeOpacity:.7,onPress:()=>yt(P),children:[jsxRuntime.jsx(ta,{currency:O||"USD",tokenIconUrl:He,networkIconUrl:Jr,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:B}),J?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:J}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(Hm,{status:P.status,colors:C,fontFamily:D.regular}),M?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:C.foregroundMuted,fontFamily:D.regular},children:M}):null]}),jsxRuntime.jsx(Hr,{size:14,color:C.foregroundMuted,strokeWidth:2})]})]},P.id)})})]})})]})}function Pc({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=bn(),{colors:i,fonts:a,components:l}=A(),u=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[w,m]=qi.useState(1),[f,T]=qi.useState(e.firstName??""),[I,k]=qi.useState(e.lastName??""),[_,v]=qi.useState(e.dobMonth??""),[S,x]=qi.useState(e.dobDay??""),[d,c]=qi.useState(e.dobYear??""),[C,h]=qi.useState(e.addressLine1??""),[D,L]=qi.useState(e.addressLine2??""),[V,R]=qi.useState(e.city??""),[E,U]=qi.useState(e.state??""),[q,Qe]=qi.useState(e.postalCode??""),[ne,Je]=qi.useState(e.country??"US"),[$,ae]=qi.useState(e.idNumber??""),Q=qi.useRef(null),Y=qi.useRef(null),we=qi.useRef(null),G=qi.useRef(null),ie=qi.useRef(null),Ye=qi.useRef(null),Be=qi.useRef(null),Ze=qi.useRef(null),Ge=p[w-1],Ue=()=>{switch(Ge){case "name":return f.trim().length>0&&I.trim().length>0;case "dob":return _.length===2&&S.length===2&&d.length===4;case "address":return C.trim().length>0&&V.trim().length>0&&E.trim().length>0&&q.trim().length>0;case "ssn":return $.trim().length>0;default:return false}},Me=()=>{Ue()&&(w<g?m(ye=>ye+1):o({firstName:f,lastName:I,idNumber:$,dobMonth:_,dobDay:S,dobYear:d,addressLine1:C,addressLine2:D,city:V,state:E,postalCode:q,country:ne}));},ot=()=>{w>1?m(ye=>ye-1):n();},De={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:Ae}=De[Ge],ce=[kr.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:kr.header,children:[jsxRuntime.jsx(reactNative.View,{style:kr.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kr.iconButton,onPress:ot,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:w>1?"Back":"Cancel",children:jsxRuntime.jsx(Qa,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:kr.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:ce,children:[w," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:kr.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(ht,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:kr.progressTrack,children:Array.from({length:g}).map((ye,ke)=>jsxRuntime.jsx(reactNative.View,{style:[kr.progressSegment,{backgroundColor:ke<w||ke+1===w?i.primary:i.border}]},ke))}),jsxRuntime.jsx(Tt,{style:s.form.flex,contentContainerStyle:kr.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:Ae}),Ge==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yn,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:u,value:f,onChangeText:T,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Q.current?.focus()})}),jsxRuntime.jsx(Yn,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Q,style:s.form.input,placeholder:"Doe",placeholderTextColor:u,value:I,onChangeText:k,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Me})})]}),Ge==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:kr.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:kr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,kr.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,kr.dobInput],placeholder:"MM",placeholderTextColor:u,value:_,onChangeText:ye=>{let ke=ye.replace(/\D/g,"").slice(0,2);v(ke),ke.length===2&&Y.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:kr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,kr.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[s.form.input,kr.dobInput],placeholder:"DD",placeholderTextColor:u,value:S,onChangeText:ye=>{let ke=ye.replace(/\D/g,"").slice(0,2);x(ke),ke.length===2&&we.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:kr.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,kr.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:we,style:[s.form.input,kr.dobInput],placeholder:"YYYY",placeholderTextColor:u,value:d,onChangeText:ye=>{let ke=ye.replace(/\D/g,"").slice(0,4);c(ke);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Me})]})]}),Ge==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yn,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:u,value:C,onChangeText:h,returnKeyType:"next",onSubmitEditing:()=>G.current?.focus()})}),jsxRuntime.jsx(Yn,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:u,value:D,onChangeText:L,returnKeyType:"next",onSubmitEditing:()=>ie.current?.focus()})}),jsxRuntime.jsx(Yn,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ie,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:u,value:V,onChangeText:R,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Ye.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:kr.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Yn,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ye,style:s.form.input,placeholder:"CA",placeholderTextColor:u,value:E,onChangeText:ye=>U(ye.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Be.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(Yn,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Be,style:s.form.input,placeholder:"94001",placeholderTextColor:u,value:q,onChangeText:Qe,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Ze.current?.focus()})})})]}),jsxRuntime.jsx(Yn,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ze,style:s.form.input,placeholder:"US",placeholderTextColor:u,value:ne,onChangeText:ye=>Je(ye.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Me})})]}),Ge==="ssn"&&jsxRuntime.jsxs(Yn,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:u,value:$,onChangeText:ae,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Me}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,kr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&w>=g?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Ue()&&s.form.continueBtnDisabled],onPress:Me,disabled:!Ue(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Ue()&&s.form.continueBtnTextDisabled],children:w>=g?"Submit":"Continue"})})})]})})}function Yn({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 kr=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 zu="@unifold/stripe_oauth";async function Jm(){try{let e=await Mu__default.default.getItem(zu);return e?JSON.parse(e):null}catch{return null}}async function Uu(e){try{await Mu__default.default.setItem(zu,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ia(){try{await Mu__default.default.removeItem(zu);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var sb=5,Bi=null,Hu=false,Nu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Fc(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:u,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:w}=stripeReactNative.useOnramp(),[m,f]=qi.useState(r),[T,I]=qi.useState(!!e?.externalUserId),[k,_]=qi.useState(false),[v,S]=qi.useState(false),[x,d]=qi.useState(""),[c,C]=qi.useState(null),[h,D]=qi.useState(e?.email??""),[L,V]=qi.useState(e?.phone??""),[R,E]=qi.useState(""),[U,q]=qi.useState("US"),[Qe,ne]=qi.useState(""),[Je,$]=qi.useState(""),ae=qi.useRef(""),Q=qi.useRef(""),Y=qi.useRef(""),[we,G]=qi.useState(false),[ie,Ye]=qi.useState(false),Be=qi.useRef(0),Ze=qi.useRef(false),Ge=qi.useRef(false),Ue=qi.useRef(false),Me=qi.useRef(false),ot=qi.useRef(e?.email??""),De=qi.useRef(false),Ae=qi.useRef(null),ce=qi.useRef(""),ye=qi.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ke=qi.useRef(null),[Xe,Ne]=qi.useState(0),[dt,Nt]=qi.useState(Nu),[_e,Re]=qi.useState(e?.defaultWalletAddress??""),[Ve,at]=qi.useState(""),[Ie,be]=qi.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Oe,Ut]=qi.useState(e?.defaultSourceAmount??"100"),[Ht,wt]=qi.useState(e?.defaultSourceCurrency??"usd"),[yt,rr]=qi.useState(e?.defaultDestinationCurrency??"usdc"),[We,ve]=qi.useState(null),[$e,ge]=qi.useState(),[Pe,H]=qi.useState(),[ue,P]=qi.useState(false),b=qi.useRef(null),B=qi.useRef(false),O=qi.useRef(0),J=qi.useRef(e?.onComplete),M=qi.useRef(e?.onError),je=qi.useRef(e?.onStepChange),He=qi.useRef(r);qi.useEffect(()=>{J.current=e?.onComplete;},[e?.onComplete]),qi.useEffect(()=>{M.current=e?.onError;},[e?.onError]),qi.useEffect(()=>{je.current=e?.onStepChange;},[e?.onStepChange]);let Jr=qi.useRef(r);qi.useEffect(()=>{m!==Jr.current&&(je.current?.(m,Jr.current),Jr.current=m),He.current=m;},[m]),qi.useEffect(()=>{v&&m!=="email"&&S(false);},[v,m]),qi.useEffect(()=>{T&&m!==r&&I(false);},[T,m,r]);let X=qi.useCallback((F,W,se)=>{let Te={code:F,message:W,step:He.current,stripeErrorCode:se};C(Te),d(""),M.current?.(Te);},[]),Hs=qi.useCallback(F=>{let W={sessionId:F.id,status:F.status,sourceAmount:F.transaction_details.source_amount,sourceCurrency:F.transaction_details.source_currency,destinationAmount:F.transaction_details.destination_amount,destinationCurrency:F.transaction_details.destination_currency,destinationNetwork:F.transaction_details.destination_network,walletAddress:F.transaction_details.wallet_address,fees:{networkFee:F.transaction_details.fees.network_fee_amount,transactionFee:F.transaction_details.fees.transaction_fee_amount}};return J.current?.(W),W},[]),Dt=qi.useCallback(()=>C(null),[]),Fe=F=>F.refresh_token??F.refresh?.refresh_token??"",Ft=qi.useCallback((F,W,se,Te,Se)=>{Q.current=W,ae.current=se,e?.externalUserId&&Uu({accessToken:W,refreshToken:se,customerId:F,externalUserId:e.externalUserId,email:Se||h,expiresAt:Date.now()+Te*1e3});},[e?.externalUserId,h]),tt=qi.useCallback(async()=>{let F=ae.current;if(!F)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let W=await xu(F,Y.current??void 0),se=W.access_token,Te=Fe(W)||F;return $(se),Ft(Y.current,se,Te,W.expires_in??3600),se}catch(W){return console.error("[tryRefreshAccessToken] refresh failed:",W?.message),await ia(),Bi=null,ke.current=null,Q.current="",ae.current="",Y.current="",$(""),ne(""),null}},[Ft]),ze=qi.useCallback(async F=>{try{return await F(Q.current)}catch(W){let se=W?.message??"";if(se.includes("stripe_onramp_forbidden")||se.includes("403")){let Te=await tt();if(!Te)throw X("authorization_error","Session expired. Please sign in again."),f("email"),W;return await F(Te)}throw W}},[tt,X]);qi.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){P(false);return}let W=false;return stripeReactNative.isPlatformPaySupported().then(se=>{W||P(se);}),()=>{W=true;}},[e?.merchantIdentifier]),qi.useEffect(()=>(B.current=false,()=>{B.current=true,b.current&&clearTimeout(b.current);}),[]);let Cr=qi.useRef(false);qi.useEffect(()=>{if(Cr.current)return;if(!e?.externalUserId){ia(),Bi=null,ke.current=null,I(false);return}let F=false;return (async()=>{try{let W=await Jm();if(F||!W){F||I(!1);return}if(W.externalUserId!==e.externalUserId){await ia(),Bi=null,ke.current=null,F||I(!1);return}let se=Date.now()>=W.expiresAt,Te=W.accessToken,Se=W.refreshToken;if(se)try{let ut=await xu(W.refreshToken,W.customerId);if(F)return;Te=ut.access_token,Se=ut.refresh_token??ut.refresh?.refresh_token??W.refreshToken,await Uu({accessToken:Te,refreshToken:Se,customerId:W.customerId,externalUserId:e.externalUserId,email:W.email,expiresAt:Date.now()+(ut.expires_in??3600)*1e3});}catch(ut){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",ut?.message),await ia(),Bi=null,ke.current=null,F||I(!1);return}if(F)return;if(Cr.current=!0,ne(W.customerId),Y.current=W.customerId,$(Te),Q.current=Te,ae.current=Se,W.email&&(D(W.email),ot.current=W.email),Bi===W.customerId)ke.current=Promise.resolve({error:void 0});else {let ut=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:W.customerId});ut.error?console.error("[useStripeOnramp] restore configureSDK error:",ut.error.message):Bi=W.customerId,ke.current=Promise.resolve(ut);}if(F)return;let nt=()=>new Promise(ut=>{let or=()=>{De.current&&ce.current?ut():setTimeout(or,200);};or();});try{if(await Promise.race([nt(),new Promise((or,bt)=>setTimeout(()=>bt(new Error("timeout")),1e4))]),F)return;let ut=ce.current.toLowerCase();await p(ut,ye.current);}catch(ut){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",ut?.message);}if(F)return;try{let or=(await Kn(Y.current,Q.current)).kyc_tiers??[],bt=or.find(Ro=>Ro.tier==="l0"),Or=or.find(Ro=>Ro.tier==="l1"),Zr=or.find(Ro=>Ro.tier==="l2"),Ur=bt?.verification_status==="verified",Yo=Or?.verification_status==="verified",nr=Zr?.verification_status==="verified",Nn=!!bt?.verification_status&&bt.verification_status!=="not_started";f(Ur||Yo||nr?"session_params":Nn?"kyc_offer":"kyc");}catch{f("kyc");}}finally{F||I(false);}})(),()=>{F=true;}},[]),qi.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||we)return;let F=false;Ye(true);async function W(){try{let[se,Te]=await Promise.all([Am({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?Wm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(nr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",nr?.message),null)):Promise.resolve(null)]);if(F)return;let Se=e?.destinationChainType??"ethereum",nt=se.data.find(nr=>nr.chain_type===Se);if(nt?.address){let nr=nt.address.toLowerCase();Re(nr),ce.current=nr,nt.recipient_address&&at(nt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",Se,"in",se.data?.length,"wallets");let ut={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},or={8453:"base",1:"ethereum",137:"polygon"},bt=Te?.destination_network,Or="none";if(bt&&ut[bt])be(ut[bt]),ye.current=ut[bt],Or=bt+" (from default_token API)";else if(e?.destinationChainId&&or[e.destinationChainId]){let nr=or[e.destinationChainId];ut[nr]&&(be(ut[nr]),ye.current=ut[nr]),Or=nr+" (from chain_id "+e.destinationChainId+")";}else ut[Se]&&(be(ut[Se]),ye.current=ut[Se],Or=Se+" (from chain_type fallback)");Te?.destination_currency&&rr(Te.destination_currency.toLowerCase());let Zr=Te?.destination_token_metadata,Ur=vi(Zr?.icon_urls,Zr?.icon_url),Yo=vi(Zr?.chain?.icon_urls,Zr?.chain?.icon_url);Ur&&ge(Ur),Yo&&H(Yo),G(!0),De.current=!0;}catch(se){if(F)return;console.error("[resolveWallet] Failed to resolve wallet:",se?.message),G(true),De.current=true;}finally{F||Ye(false);}}return Ae.current=W(),()=>{F=true;}},[e?.publishableKey,e?.externalUserId,Xe]);let Lt=qi.useCallback(async()=>{if(ke.current)return ke.current;let F=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(W=>(W.error&&(console.error("[useStripeOnramp] configureSDK error:",W.error.message,W.error.code),ke.current=null),W)).catch(W=>{throw console.error("[useStripeOnramp] configureSDK threw:",W?.message??W),ke.current=null,W});return ke.current=F,F},[o,e?.merchantDisplayName]);qi.useEffect(()=>{e?.externalUserId||Lt();},[]);let ur=qi.useCallback(async F=>{if(!Ze.current){Ze.current=true,_(true),Dt(),d("Creating auth intent...");try{let W=await ku(F);d("Waiting for authorization...");let se=await i(W);if(se?.error){X("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(se?.status==="Denied"){X("authorization_error","Authorization denied by user."),f("email");return}if(se?.status!=="Consented"||!se.customerId){X("authorization_error","Authorization was canceled."),f("email");return}d("Exchanging tokens...");let Te=se.customerId,Se=await Vm(W,Te),nt=Se.access_token,ut=Fe(Se);D(F),ot.current=F,ne(Te),Y.current=Te,Bi=Te,$(nt),Ft(Te,nt,ut,Se.expires_in??3600,F),d("Checking verification status...");try{let bt=(await Kn(Te,nt)).kyc_tiers??[],Or=bt.find(co=>co.tier==="l0"),Zr=bt.find(co=>co.tier==="l1"),Ur=bt.find(co=>co.tier==="l2"),Yo=Or?.verification_status==="verified",nr=Zr?.verification_status==="verified",Nn=Ur?.verification_status==="verified",Ro=!!Or?.verification_status&&Or.verification_status!=="not_started";if(d(""),Yo||nr||Nn){Ae.current&&(d("Resolving wallet..."),await Ae.current,d(""));let co=ce.current;if(co)try{let xi=co.toLowerCase(),ec=ye.current,$n=await p(xi,ec);$n?.error?(console.warn("[proceedToAuthorize] wallet registration error:",$n.error.message),X("wallet_error",$n.error.message,$n.error.code),f("wallet")):f("session_params");}catch(xi){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",xi?.message),f("wallet");}else f("wallet");}else Ro?(await Hn(),d(""),f("kyc_offer")):f("kyc");}catch(or){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",or?.message),d(""),f("kyc");}}catch(W){X("authorization_error",W?.message??String(W)),f("email");}finally{Ze.current=false,_(false);}}},[i,Dt,X,Ft,p,Ie]),wr=qi.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!h){X("validation_error","Please enter an email address.");return}_(true),Dt(),d("");try{d("Configuring...");let F=await Lt();if(F.error){X("configuration_error",F.error.message,F.error.code);return}d("Checking Link account...");let W=await n(h);if(W.error){X("authorization_error",W.error.message,W.error.code);return}W.hasLinkAccount?await ur(h):(d(""),f("disclaimer"));}catch(F){X("unknown_error",F?.message??String(F));}finally{_(false);}},[Dt,Lt,h,X,n,ur]),Ns=qi.useCallback(async()=>{if(!Ue.current){if(!L){X("validation_error","Please enter your phone number.");return}Ue.current=true,_(true),Dt(),d("");try{d("Creating Link account...");let F=await s({email:h,phone:L,fullName:R||h,country:U||"US"});if(F.error){X("registration_error",F.error.message,F.error.code);return}await ur(h);}catch(F){X("registration_error",F?.message??String(F));}finally{Ue.current=false,_(false);}}},[Dt,U,h,X,R,L,s,ur]);qi.useEffect(()=>{if(m!=="email")return;let F=Me.current||Hu;if(F&&(Me.current=false,Hu=false),!e?.email||T)return;if(F){S(true);return}let W=++Be.current,se=false,Te=()=>se||Be.current!==W;return e?.phone?(async()=>{_(true),Dt();try{d("Configuring...");let Se=await Lt();if(Te())return;if(Se.error){X("configuration_error",Se.error.message,Se.error.code);return}d("Checking Link account...");let nt=await n(e.email);if(Te())return;if(nt.error){X("authorization_error",nt.error.message,nt.error.code);return}if(nt.hasLinkAccount){if(Te())return;await ur(e.email);}else {if(Te())return;d(""),f("disclaimer");}}catch(Se){Te()||X("unknown_error",Se?.message??String(Se));}finally{_(false);}})():(async()=>{_(true),Dt();try{d("Configuring...");let Se=await Lt();if(Te())return;if(Se.error){X("configuration_error",Se.error.message,Se.error.code);return}d("Checking Link account...");let nt=await n(e.email);if(Te())return;if(nt.error){X("authorization_error",nt.error.message,nt.error.code);return}if(nt.hasLinkAccount){if(Te())return;await ur(e.email);}else {if(Te())return;d(""),f("disclaimer");}}catch(Se){Te()||X("unknown_error",Se?.message??String(Se));}finally{_(false);}})(),()=>{se=true;}},[m,e?.email,e?.phone,T]);let Hn=qi.useCallback(async()=>{Ae.current&&(d("Resolving wallet..."),await Ae.current);let F=ce.current;if(F)try{d("Registering wallet...");let W=F.toLowerCase(),se=ye.current;await p(W,se);}catch(W){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",W?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Gl=qi.useCallback(async(F,W)=>{_(true),Dt(),d(""),Nt(nt=>({...nt,...F}));let se=!W,Te=W??"kyc_offer",Se=W?"kyc_l1":"kyc";try{let nt=F.dobDay&&F.dobMonth&&F.dobYear,ut=F.firstName&&F.lastName,or={};ut&&(or.firstName=F.firstName,or.lastName=F.lastName),F.addressLine1&&(or.address={line1:F.addressLine1,line2:F.addressLine2||void 0,city:F.city,state:F.state,postalCode:F.postalCode,country:F.country}),F.idNumber&&(or.idNumber=F.idNumber),nt&&(or.dateOfBirth={day:parseInt(F.dobDay,10),month:parseInt(F.dobMonth,10),year:parseInt(F.dobYear,10)});let bt=await a(or);if(bt?.error?.message&&(/no active link consumer/i.test(bt.error.message)||/not be verified/i.test(bt.error.message))){if(d("Verifying identity..."),!await ss()){X("kyc_error","Please verify your identity to continue."),f(Se);return}bt=await a(or);}if(bt?.error){let nr=se?"l0":"l1";try{let Ro=(await Kn(Y.current,Q.current)).kyc_tiers?.find(co=>co.tier===nr);if(Ro?.verification_status==="verified"){let co=se?"session_params":Te;await Hn(),d(""),f(co);return}if(Ro?.verification_status==="rejected"){if(se){await Hn(),d(""),f(Te);return}X("kyc_error","Something went wrong. Please try again."),f(Se);return}}catch(Nn){console.warn("[attachKyc] could not fetch verification status:",Nn?.message);}if(se){await Hn(),d(""),f(Te);return}X("kyc_error",bt.error.message,bt.error.stripeErrorCode??bt.error.code),f(Se);return}if(!(bt&&Object.keys(bt).length>0&&!bt.error)){let nr=se?"l0":"l1";if(d("Verifying identity..."),(!Y.current||!Q.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${nr} \u2014 missing customerIdRef or accessTokenRef`),!se)){X("kyc_error","Unable to verify identity. Please try again."),f(Se);return}let Nn=Y.current,Ro=Q.current,co=10,xi=!1;if(Nn&&Ro)for(let ec=0;ec<co;ec++){try{let Gd=(await Kn(Nn,Ro)).kyc_tiers?.find(vg=>vg.tier===nr);if(Gd?.verification_status==="verified"){xi=!0;break}if(Gd?.verification_status==="rejected"){if(se)break;console.warn(`[attachKyc] \u274C ${nr} rejected:`,Gd?.verification_errors),X("kyc_error","KYC verification was rejected. Please try again."),f(Se);return}}catch($n){console.warn(`[attachKyc] ${nr} poll error:`,$n?.message);}await new Promise($n=>setTimeout($n,2e3));}if(!xi&&!se){console.warn(`[attachKyc] \u274C ${nr} verification timed out after`,co,"attempts"),X("kyc_error","Identity verification is taking longer than expected. Please try again."),f(Se);return}await Hn(),d(""),f(se&&xi?"session_params":Te);return}d("Please review your KYC information...");let Ur=await l(null);if(Ur?.error){X("kyc_error",Ur.error.message,Ur.error.stripeErrorCode??Ur.error.code),f(Se);return}if(Ur?.status==="UpdateAddress"){X("kyc_error","Please update your address and resubmit."),f(Se);return}await Hn(),d(""),f(se?"session_params":Te);}catch(nt){X("kyc_error",nt?.message??String(nt)),f(Se);}finally{_(false);}},[a,Dt,X,l,Hn]),ss=qi.useCallback(async()=>{let F=ot.current||e?.email;if(!F)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(ot.current),"config.email:",e?.email),false;try{let W=await ku(F),se=await i(W);return se?.status==="Consented"&&se.customerId?(Y.current=se.customerId,ne(se.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",se?.status),!1)}catch(W){return console.warn("[reestablishLinkSession] failed:",W?.message),false}},[i,e?.email]),Jl=qi.useCallback(async()=>{if(!Ge.current){Ge.current=true,_(true),Dt(),d("Launching identity verification...");try{let F=await u();if(F?.error?.message&&(/no active link consumer/i.test(F.error.message)||/not be verified/i.test(F.error.message))){if(d("Verifying identity..."),!await ss()){X("identity_error","Please verify your identity to continue.");return}F=await u();}if(F?.error){let se=F.error.message??"";if(/cancel/i.test(se)){d("");return}X("identity_error",se,F.error.code);return}d(""),as.current?(as.current=!1,f("session_params")):f("wallet");}catch(F){X("identity_error",F?.message??String(F));}finally{Ge.current=false,_(false);}}},[Dt,X,ss,u]),as=qi.useRef(false);qi.useEffect(()=>{m==="identity"&&!k&&Jl();},[m]);let Zl=qi.useCallback(async()=>{if(!_e){X("validation_error","Please enter a wallet address.");return}_(true),Dt(),d("");try{let F=_e.toLowerCase(),W=await p(F,Ie);if(W?.error){console.warn("[registerWallet] error:",W.error.message),X("wallet_error",W.error.message,W.error.code);return}d(""),f("kyc_offer");}catch(F){console.error("[registerWallet] exception:",F?.message??String(F)),X("wallet_error",F?.message??String(F));}finally{_(false);}},[Dt,X,_e,Ie,p]);qi.useEffect(()=>{m==="wallet"&&we&&_e&&Zl();},[m,we,_e]);let $s=qi.useCallback(F=>{B.current=false,O.current=0;let W=0,se=async()=>{W+=1;let Te=Q.current;try{let Se=await Bm(F,Te);if(B.current)return;O.current=0,Se.status==="fulfillment_complete"?(ve(Se),f("success")):b.current=setTimeout(se,3e3);}catch(Se){if(B.current)return;let nt=Se?.message??"";if((nt.includes("stripe_onramp_forbidden")||nt.includes("403"))&&await tt()&&!B.current){b.current=setTimeout(se,1e3);return}if(O.current+=1,console.error(`[pollSessionStatus] poll #${W} error:`,nt),O.current>=sb){X("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}b.current=setTimeout(se,5e3);}};b.current=setTimeout(se,3e3);},[X,tt]),Qd=qi.useCallback(()=>{if(He.current==="processing"&&We?.id){if(!Q.current){X("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Dt(),O.current=0,b.current&&(clearTimeout(b.current),b.current=null),$s(We.id);}},[Dt,X,$s,We?.id]),Ti=qi.useCallback(async F=>{_(true),Dt(),d("");try{d("Confirming purchase...");let W=await ze(se=>Om(F,se));ve(W),f("processing"),d(""),$s(W.id);}finally{_(false);}},[Dt,$s,ze]),ja=qi.useRef(false),Yd=qi.useCallback(async()=>{if(!(!We||ja.current)){ja.current=true;try{_(!0),Dt(),d("Refreshing quote...");let F=await ze(W=>Ru(We.id,W));ve(F),await Ti(F.id);}catch{X("session_error","Something went wrong. Please try again."),f("quote");}finally{_(false),ja.current=false;}}},[Dt,X,Ti,We,ze]),de=qi.useCallback(async(F=false,W,se)=>{let Te=W??Oe;if(!Te||isNaN(Number(Te))||Number(Te)<=0){X("validation_error","Please enter a valid amount.");return}W&&Ut(W),_(true),Dt(),d("");try{let Se=await Lt();if(Se.error){X("configuration_error",Se.error.message,Se.error.code);return}let nt;if(se)nt=se;else if(F){if(!e?.merchantIdentifier?.trim()){X("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),f("session_params");return}d("Opening Apple Pay...");let bt={applePay:{merchantCountryCode:"US",currencyCode:Ht.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${yt.toUpperCase()} purchase + fees`,amount:Te}]}},Or=await g("PlatformPay",bt);if(Or?.error){let Ur=Or.error.message??"",Yo=Or.error.code??"";/cancel/i.test(Ur)||/cancel/i.test(Yo)||(X("payment_error",Ur,Yo),f("session_params"));return}if(!Or?.displayData)return;d("Creating payment token...");let Zr=await w();if(Zr?.error){X("payment_error",Zr.error.message,Zr.error.code),f("session_params");return}nt=Zr.cryptoPaymentToken;}else {d("Select a payment method...");let bt=await g("Card");if(bt?.error){let Zr=bt.error.message??"",Ur=bt.error.code??"";/cancel/i.test(Zr)||/cancel/i.test(Ur)||(X("payment_error",Zr,Ur),f("session_params"));return}if(!bt?.displayData)return;d("Creating payment token...");let Or=await w();if(Or?.error){X("payment_error",Or.error.message,Or.error.code),f("session_params");return}nt=Or.cryptoPaymentToken;}d("Creating onramp session...");let ut=ce.current||_e;if(!ut){X("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let or=await ze(bt=>Dm({cryptoCustomerId:Y.current,paymentToken:nt,sourceAmount:Number(Te),sourceCurrency:Ht,destinationCurrency:yt,walletAddress:ut,destinationNetwork:Ie},bt));ve(or),d(""),F?await Ti(or.id):f("quote");}catch{X("session_error","Something went wrong. Please try again."),f("session_params");}finally{_(false),d("");}},[Dt,Lt,g,w,yt,X,Ti,Ut,Oe,Ht,_e,Ie,ze,e?.merchantIdentifier]),Ee=qi.useCallback(async()=>{_(true),Dt(),d("Select a payment method...");try{let F=await Lt();if(F.error)return X("configuration_error",F.error.message,F.error.code),null;let W=await g("Card");if(W?.error?.message&&(/no active link consumer/i.test(W.error.message)||/not be verified/i.test(W.error.message))){if(!await ss())return X("authorization_error","Please verify your identity to add a payment method."),null;W=await g("Card");}if(W?.error){let nt=W.error.message??"",ut=W.error.code??"";return /cancel/i.test(nt)||/cancel/i.test(ut)||X("payment_error",nt,ut),null}if(!W?.displayData)return null;let Te=W.displayData;d("Saving payment method...");let Se=await w();return Se?.error?(X("payment_error",Se.error.message,Se.error.code),null):{token:Se.cryptoPaymentToken,sublabel:Te.sublabel??""}}catch(F){return X("session_error",F?.message??String(F)),null}finally{_(false),d("");}},[Dt,Lt,g,w,X,ss]),fr=qi.useCallback(async()=>{if(We){_(true),Dt(),d("");try{let F=await ze(W=>Ru(We.id,W));ve(F);}catch{X("session_error","Something went wrong. Please try again.");}finally{_(false);}}},[Dt,X,We,ze]),pn=qi.useCallback(()=>{B.current=true,O.current=0,b.current&&(clearTimeout(b.current),b.current=null),f(r),_(false),S(false),d(""),C(null),D(e?.email??""),ot.current=e?.email??"",V(e?.phone??""),E(""),q("US"),ne(""),Y.current="",$(""),Q.current="",ae.current="",G(false),Ye(false),Ae.current=null,Ne(F=>F+1),Nt(Nu),Re(""),ce.current="",De.current=false,be(stripeReactNative.Onramp.CryptoNetwork.ethereum),Ut(e?.defaultSourceAmount??"100"),wt(e?.defaultSourceCurrency??"usd"),rr(e?.defaultDestinationCurrency??"usdc"),at(""),ge(void 0),H(void 0),ve(null),Be.current+=1,Ze.current=false,Ge.current=false,Ue.current=false;},[e,r]),Xl=qi.useCallback(()=>{as.current=true,f("kyc_offer");},[]),ki=qi.useCallback(async()=>{await ia(),Bi=null,ke.current=null,Hu=true,Me.current=true,B.current=true,O.current=0,b.current&&(clearTimeout(b.current),b.current=null),Be.current+=1,Ze.current=false,Ge.current=false,Ue.current=false,Q.current="",ae.current="",Y.current="",ce.current="",De.current=false,Ae.current=null,$(""),ne(""),D(e?.email??""),ot.current=e?.email??"",V(e?.phone??""),E(""),q("US"),ve(null),C(null),_(false),S(false),d(""),Nt(Nu),Re(""),G(false),Ye(false),Ne(F=>F+1),at(""),ge(void 0),H(void 0),f(r);},[e?.email,e?.phone,r]);return {step:m,restoring:T,loading:k,status:x,error:c,email:h,phone:L,fullName:R,country:U,customerId:Qe,accessToken:Je,session:We,kycData:dt,walletAddress:_e,resolvedRecipientAddress:Ve,walletNetwork:Ie,sourceAmount:Oe,sourceCurrency:Ht,destinationCurrency:yt,tokenIconUrl:$e,networkIconUrl:Pe,applePaySupported:ue,walletReady:we,walletLoading:ie,setStep:f,setStatus:d,setEmail:D,setPhone:V,setFullName:E,setCountry:q,setWalletAddress:Re,setWalletNetwork:be,setSourceAmount:Ut,setSourceCurrency:wt,setDestinationCurrency:rr,checkEmail:wr,register:Ns,attachKyc:Gl,verifyIdentity:Jl,requestKYCUpgrade:Xl,kycUpgradeMode:as,logout:ki,registerWallet:Zl,collectPaymentMethod:de,addPaymentMethod:Ee,refreshQuote:fr,confirmCheckout:Yd,reset:pn,clearError:Dt,emitComplete:Hs,resumeFulfillmentPolling:Qd,amountFirst:t,switchingAccount:v}}function Zm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=bn(),{colors:a,fonts:l,components:u}=A(),p=u.input.placeholderColor,[g,w]=qi.useState(e.dobMonth??""),[m,f]=qi.useState(e.dobDay??""),[T,I]=qi.useState(e.dobYear??""),[k,_]=qi.useState(e.idNumber??""),[v,S]=qi.useState(null),x=qi.useRef(null),d=qi.useRef(null),c=qi.useRef(null),C=g.length===2&&m.length===2&&T.length===4&&k.trim().length>0,h=()=>{if(!C)return;let L=parseInt(g,10),V=parseInt(m,10),R=parseInt(T,10),E=new Date().getFullYear();if(L<1||L>12){S("Please enter a valid month (01\u201312).");return}if(V<1||V>31){S("Please enter a valid day (01\u201331).");return}if(R<1900||R>E){S(`Please enter a valid year (1900\u2013${E}).`);return}S(null),o({dobMonth:g,dobDay:m,dobYear:T,idNumber:k});},D=v||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(qt,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Tt,{style:i.form.flex,contentContainerStyle:kn.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:kn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:kn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:kn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,kn.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);w(V),V.length===2&&x.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:kn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:x,style:[i.form.input,kn.dobInput],placeholder:"DD",placeholderTextColor:p,value:m,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);f(V),V.length===2&&d.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:kn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:d,style:[i.form.input,kn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:T,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,4);I(V),V.length===4&&c.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:kn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:c,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:k,onChangeText:_,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:h,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),D?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:D}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!C&&i.form.continueBtnDisabled],onPress:h,disabled:!C,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!C&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var kn=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 Xm({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=qi.useRef(new reactNative.Animated.Value(.3)).current;return qi.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Vt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:Vt.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Vt.skeletonLine,{width:"60%"}]})]})}function ef({onRefresh:e,colors:t,fonts:r}){let[o,n]=qi.useState(10),s=qi.useRef(null);qi.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=qi.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:Vt.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(Ys,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[Vt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function nf({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:u="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:w=false,currentLimit:m}){let f=bn(),{colors:T,fonts:I,components:k}=A(),_=[Vt.card,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius??12,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],v=[..._,{opacity:.5}],S=l==="verified",x=l==="pending",d=l==="rejected",c=u==="verified",C=u==="pending",h=S&&c,D=!S,L=!c,V=S,R=(w||S)&&!h,E=U=>`$${U.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:f.form.screen,children:[jsxRuntime.jsx(qt,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Vt.content,children:[m!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[Vt.limitBadge,{backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth,borderRadius:k.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.limitLabel,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.limitValue,{color:T.foreground,fontFamily:I.semibold}],children:[E(m)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.subtitle,{color:T.foregroundMuted,fontFamily:I.regular}],children:i?"Checking your verification status...":h?"All verification levels have been completed. Your limits are at the maximum available.":w?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xm,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth}),jsxRuntime.jsx(Xm,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&(x?jsxRuntime.jsxs(reactNative.View,{style:_,children:[jsxRuntime.jsxs(reactNative.View,{style:Vt.pendingHeader,children:[jsxRuntime.jsx(uo,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:T.foreground,fontFamily:I.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(ef,{onRefresh:n,colors:T,fonts:I}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Vt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(St,{size:18,strokeWidth:2,gradientFrom:T.primary,gradientTo:T.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[_,Vt.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(uo,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Vt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:T.foreground,fontFamily:I.semibold}],children:d?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:T.foregroundMuted,fontFamily:I.regular}],children:d?"Previous verification was unsuccessful. Please try again.":w?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Hr,{size:18,color:T.foregroundMuted,strokeWidth:2})]})),L&&(C?jsxRuntime.jsxs(reactNative.View,{style:_,children:[jsxRuntime.jsxs(reactNative.View,{style:Vt.pendingHeader,children:[jsxRuntime.jsx(oc,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:T.foreground,fontFamily:I.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(ef,{onRefresh:n,colors:T,fonts:I}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Vt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(St,{size:18,strokeWidth:2,gradientFrom:T.primary,gradientTo:T.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[_,Vt.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(oc,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Vt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:T.foreground,fontFamily:I.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Hr,{size:18,color:T.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[v,Vt.cardRow],children:[jsxRuntime.jsx(oc,{size:20,color:T.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Vt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:T.foregroundMuted,fontFamily:I.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Vt.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:Vt.loaderRow,children:[jsxRuntime.jsx(St,{size:24,strokeWidth:2,gradientFrom:T.primary,gradientTo:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):h?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.continueBtnText,children:"Done"})}):R?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Vt=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var Oc={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 af({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=A(),a=[nn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:nn.logoRow,children:jsxRuntime.jsx(um,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:nn.scroll,contentContainerStyle:nn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[nn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[nn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[nn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[nn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:nn.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 nn=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 lf({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:u}){let{colors:p}=A();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(St,{size:56,strokeWidth:3}),jsxRuntime.jsx(po,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(po,{error:n,progress:s,loading:o})]})]})})}function df({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(St,{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(po,{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 pf({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:u,onRetryStatusCheck:p}){let{colors:g}=A(),w=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[w?jsxRuntime.jsx(qt,{onPress:u}):jsxRuntime.jsx(reactNative.View,{style:bc}),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(St,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
-
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(wc,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(po,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function mf({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:u}){let{colors:p}=A(),g=t.transaction_details,w=yc(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:u??l,title:"Review your purchase",variant:u?"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(ta,{currency:g.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(en,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"You receive",value:`${w} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(en,{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(St,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]})}function ff({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:u}){let p=A(),{colors:g,fonts:w,components:m}=p,[f,T]=qi.useState("");qi.useEffect(()=>{if(t)return;let _=f?`+1${f}`:"";a(_);},[f,a,t]);let I=qi.useCallback(_=>{T(_.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(St,{size:56,strokeWidth:3}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]});let k=f.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:u}),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:bl.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[bl.countryPrefix,{backgroundColor:m.card.backgroundColor,borderColor:m.input.borderColor,borderRadius:m.input.borderRadius,borderWidth:m.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:bl.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[bl.dialCode,{color:g.foreground,fontFamily:w.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,bl.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:I,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>k&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!k&&e.form.continueBtnDisabled],onPress:l,disabled:!k,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!k&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]})})}var bl=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 Bb({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=A(),n=e.toLowerCase(),s=Cc[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:[In.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[In.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[In.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(lt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function hf({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:u}=A(),p=t.transaction_details,g=yc(p.destination_amount,p.destination_currency),w=r||o||"";ea(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Tt,{style:e.form.flex,contentContainerStyle:In.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:In.iconSection,children:[jsxRuntime.jsx(Bb,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:In.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[In.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[In.statusText,{color:a.foreground,fontFamily:u.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[In.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(wc,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},In.detailCard],children:[jsxRuntime.jsx(en,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Tu,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),w?jsxRuntime.jsx(Tu,{quote:e.quote,label:"Recipient Address",address:w,last:true}):jsxRuntime.jsx(en,{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 In=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 gf({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:u,registerWallet:p,onClose:g}){let{colors:w,components:m}=A();if(t){let f=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!f&&jsxRuntime.jsx(St,{size:56,strokeWidth:3}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]}),f&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(qt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:m.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:hc.map(f=>{let T=i===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,T&&e.wallet.rowSelected],onPress:()=>{l(f.value),u(f.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(f.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,T&&e.wallet.rowTextSelected],children:f.label}),T&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(lt,{size:14,color:m.container.buttonTitleColor,strokeWidth:2.5})})]},f.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:w.primaryForeground,gradientTo:w.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]})})}function Mc({config:e,onClose:t}){let r=A(),o=bn(),{step:n,restoring:s,loading:i,status:a,error:l,email:u,phone:p,session:g,kycData:w,walletAddress:m,resolvedRecipientAddress:f,walletNetwork:T,sourceAmount:I,sourceCurrency:k,destinationCurrency:_,tokenIconUrl:v,networkIconUrl:S,applePaySupported:x,setStep:d,setEmail:c,setPhone:C,setWalletAddress:h,setWalletNetwork:D,setSourceAmount:L,setDestinationCurrency:V,checkEmail:R,register:E,attachKyc:U,verifyIdentity:q,registerWallet:Qe,collectPaymentMethod:ne,addPaymentMethod:Je,confirmCheckout:$,reset:ae,emitComplete:Q,resumeFulfillmentPolling:Y,amountFirst:we,customerId:G,accessToken:ie,requestKYCUpgrade:Ye,kycUpgradeMode:Be,logout:Ze,clearError:Ge,switchingAccount:Ue}=Fc(e),Me=!!e?.email&&!Ue,ot=!!e?.phone,De=!!e?.publishableKey&&!!e?.externalUserId,[Ae,ce]=qi.useState(void 0),[ye,ke]=qi.useState(void 0),[Xe,Ne]=qi.useState([]),[dt,Nt]=qi.useState(false),[_e,Re]=qi.useState(false),[Ve,at]=qi.useState(null),[Ie,be]=qi.useState(null),[Oe,Ut]=qi.useState(null),[Ht,wt]=qi.useState(false),yt=qi.useCallback(async()=>{await Ze(),t?.();},[Ze,t]);qi.useEffect(()=>{n!=="kyc_offer"||!G||!ie||(wt(true),Kn(G,ie).then(ge=>{let Pe=ge.kyc_tiers??[],H=Pe.find(b=>b.tier==="l0"),ue=Pe.find(b=>b.tier==="l1"),P=Pe.find(b=>b.tier==="l2");H?.verification_status&&at(H.verification_status),ue?.verification_status&&be(ue.verification_status),P?.verification_status&&Ut(P.verification_status);}).catch(ge=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",ge?.message);}).finally(()=>wt(false)),m&&_u({destinationNetwork:T||"ethereum",walletAddress:m,accessToken:ie,cryptoCustomerId:G}).then(ge=>{let Pe=ge.limits?.usd;if(Pe?.card?.length){let H=Math.max(...Pe.card.map(ue=>ue.limit));ce(H);}}).catch(ge=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",ge?.message);}));},[n,G,ie,m,T]),qi.useEffect(()=>{if(s||n!=="session_params"||!G||!ie)return;let ge=H=>{let ue=H?.message??"";return ue.includes("stripe_onramp_forbidden")||ue.includes("403")},Pe=H=>{ge(H)&&yt();};Kn(G,ie).then(H=>{let ue=H.kyc_tiers??[],P=ue.find(M=>M.tier==="l0"),b=ue.find(M=>M.tier==="l1"),B=ue.find(M=>M.tier==="l2"),O=!!b?.verification_status&&b.verification_status!=="not_started",J=B?.verification_status==="verified";Nt(O),Re(!!J),P?.verification_status&&at(P.verification_status),b?.verification_status&&be(b.verification_status),B?.verification_status&&Ut(B.verification_status);}).catch(H=>{console.warn("[OnrampScreen] customer fetch error:",H?.message),Pe(H);}),Iu(G,ie).then(H=>{Ne(H.data??[]);}).catch(H=>{console.warn("[OnrampScreen] payment_tokens error:",H?.message),Pe(H);}),m&&_u({destinationNetwork:T||"ethereum",walletAddress:m,accessToken:ie,cryptoCustomerId:G}).then(H=>{let ue=H.limits?.usd;if(ue?.card?.length){let P=Math.max(...ue.card.map(b=>b.limit));ce(P);}}).catch(H=>{console.warn("[OnrampScreen] transaction_limits error:",H?.message),Pe(H);}),ol(e?.publishableKey).then(H=>{let ue=H.data?.find(P=>P.currency_code==="usd");ue&&ke(ue.minimum_amount);}).catch(H=>{console.warn("[OnrampScreen] fiat_currencies error:",H?.message);});},[s,n,G,ie,m,T,ae,yt]);let rr=async()=>{if(!(!G||!ie))try{let ge=await Iu(G,ie);Ne(ge.data??[]);}catch(ge){console.warn("[OnrampScreen] payment_tokens refresh error:",ge?.message);let Pe=ge?.message??"";(Pe.includes("stripe_onramp_forbidden")||Pe.includes("403"))&&yt();}},We=async()=>{let ge=await Je();return ge&&await rr(),ge},ve=e?.skipSuccessConfirmation===true;qi.useEffect(()=>{n==="success"&&ve&&g&&(Q(g),ae(),t?.());},[n,ve,g,Q,ae,t]),qi.useEffect(()=>{n==="register"&&ot&&E();},[n,ot,E]);let $e=()=>{ae(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[Hb.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(St,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(af,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>d("register"),onClose:()=>d("email")});if(n==="email")return jsxRuntime.jsx(lf,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Me,loading:i,error:l,status:a,email:u,setEmail:c,checkEmail:R,onClose:$e});if(n==="register")return jsxRuntime.jsx(ff,{styles:o,hasPrefilledPhone:ot,loading:i,error:l,status:a,email:u,phone:p,setPhone:C,register:E,onClose:$e});if(n==="kyc")return jsxRuntime.jsx(Pc,{initialData:w,loading:i,onComplete:U,onCancel:$e});if(n==="kyc_offer"){let H=Ve==="verified"||Ie==="verified"||Oe==="verified",ue=()=>{Be.current&&(Be.current=false),d("session_params");};return jsxRuntime.jsx(nf,{onSelectL1:()=>d("kyc_l1"),onSelectL2:()=>{Be.current=true,d("identity");},onSkip:ue,onClose:()=>{Be.current?(Be.current=false,d("session_params")):H?ue():$e();},onRefresh:()=>{!G||!ie||(wt(true),Kn(G,ie).then(B=>{let O=B.kyc_tiers??[],J=O.find(He=>He.tier==="l0"),M=O.find(He=>He.tier==="l1"),je=O.find(He=>He.tier==="l2");J?.verification_status&&at(J.verification_status),M?.verification_status&&be(M.verification_status),je?.verification_status&&Ut(je.verification_status);}).catch(B=>{console.warn("[OnrampScreen] refresh customer fetch error:",B?.message);}).finally(()=>wt(false)));},loading:i,loadingTiers:Ht,error:l?.message,l1Status:Ie??"not_started",l2Status:Oe??"not_started",l1Completed:dt,l2Completed:_e,canPurchase:H,currentLimit:H?Ae:void 0})}if(n==="kyc_l1"){let ge=Be.current?"session_params":"wallet";return jsxRuntime.jsx(Zm,{initialData:w,loading:i,error:l?.message,onComplete:Pe=>{Be.current&&(Be.current=false),U(Pe,ge);},onCancel:()=>{Ge(),d("kyc_offer");},onClose:$e})}return n==="identity"?jsxRuntime.jsx(df,{styles:o,loading:i,status:a,error:l,verifyIdentity:q,onClose:()=>{Be.current?(Be.current=false,d("session_params")):$e();}}):n==="wallet"?jsxRuntime.jsx(gf,{styles:o,hasAutoWallet:De,loading:i,error:l,status:a,walletAddress:m,walletNetwork:T,setWalletAddress:h,setWalletNetwork:D,setDestinationCurrency:V,registerWallet:Qe,onClose:$e}):n==="session_params"?jsxRuntime.jsx(vc,{initialAmount:I,currency:k,applePaySupported:x,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:ye,maxAmount:Ae,paymentTokens:Xe,onAddPaymentMethod:We,onCollectPayment:(ge,Pe)=>{ne(ge,Pe);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(ge,Pe)=>{if(we&&!G)L(ge),d("email");else {let H=Pe==="apple_pay";ne(H,ge,!H&&Pe?Pe:void 0);}},onCancel:$e,accessToken:ie,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:yt,onRequestKYC:Ye,showSwitchAccount:!Me,inputDisabled:(Ve!==null||Ie!==null)&&Ve!=="verified"&&Ie!=="verified"&&Oe!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(mf,{styles:o,session:g,loading:i,error:l,status:a,confirmCheckout:$,tokenIconUrl:v,networkIconUrl:S,onClose:$e,onBack:()=>d("session_params")}):n==="processing"?jsxRuntime.jsx(pf,{styles:o,error:l,status:a,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??_,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:v,networkIconUrl:S,onClose:$e,onRetryStatusCheck:Y}):n==="success"&&g&&!ve?jsxRuntime.jsx(hf,{styles:o,session:g,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:v,networkIconUrl:S,onDone:()=>{Q(g),ae(),t?.();}}):null}var Hb=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function yf(){try{let e=Nb__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let s=n.trim();if(s.length>0)return s}}}catch{}}function zc({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:u,onError:p,onStepChange:g,onClose:w,merchantIdentifier:m="",urlScheme:f="unifoldOnramp",paymentSelectorPosition:T,skipSuccessConfirmation:I=false,appName:k}){let{colors:_,fonts:v,components:S}=A(),x=e||cc(),d=qi.useMemo(()=>{let V=m.trim();return V.length>0?V:yf()??""},[m]),[c,C]=qi.useState("loading"),[h,D]=qi.useState(null);qi.useEffect(()=>{let V=false;async function R(){try{x&&(Sc(x),Tc(rl()));let E=await kc();if(V)return;let U=d.trim();if(await stripeReactNative.initStripe({publishableKey:E,urlScheme:f,...U?{merchantIdentifier:U}:{}}),V)return;C("ready");}catch(E){if(V)return;console.error("[StripeOnramp] Init failed:",E),D(E?.message??"Failed to load Stripe configuration"),C("error");}}return R(),()=>{V=true;}},[x,d,f]);let L=qi.useMemo(()=>{let V={publishableKey:x,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:u,onError:p,onStepChange:g};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),T&&(V.paymentSelectorPosition=T),V.skipSuccessConfirmation=I,V.merchantIdentifier=d,k&&(V.merchantDisplayName=k),V},[x,o,s,i,a,l,t,r,n,T,I,d,k,u,p,g]);return c==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ua.centered,{backgroundColor:_.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ua.errorText,{color:_.error,fontFamily:v.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ua.errorDetail,{color:_.foregroundMuted,fontFamily:v.regular}],children:h}),w&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ua.retryBtn,{backgroundColor:S.button.primaryBackground,borderRadius:S.button.borderRadius}],onPress:w,children:jsxRuntime.jsx(reactNative.Text,{style:[ua.retryBtnText,{color:S.button.primaryText,fontFamily:v.medium}],children:"Go Back"})})]}):c==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ua.centered,{backgroundColor:_.background}],children:jsxRuntime.jsx(St,{size:56,strokeWidth:3,gradientFrom:_.primary,gradientTo:_.primary})}):jsxRuntime.jsx(Mc,{config:L,onClose:w})}var ua=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 Sf(){let{configure:e}=stripeReactNative.useOnramp(),t=qi.useRef(false);return qi.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var Tf="__unifold_stripe_onramp__";function Uc(e){globalThis[Tf]=e;}function kf(){return globalThis[Tf]}Uc(zc);var vn=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 hs,Ei,pa,xf,Zb=(xf=class extends vn{constructor(){super();pe(this,hs);pe(this,Ei);pe(this,pa);j(this,pa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Ei)||this.setEventListener(y(this,pa));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ei))==null||t.call(this),j(this,Ei,void 0));}setEventListener(t){var r;j(this,pa,t),(r=y(this,Ei))==null||r.call(this),j(this,Ei,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,hs)!==t&&(j(this,hs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,hs)=="boolean"?y(this,hs):globalThis.document?.visibilityState!=="hidden"}},hs=new WeakMap,Ei=new WeakMap,pa=new WeakMap,xf),ma=new Zb;var Xb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Pn,gs,Rf,eC=(Rf=class{constructor(){pe(this,Pn,Xb);pe(this,gs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,gs)&&e!==y(this,Pn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,Pn),provider:e}),j(this,Pn,e),process.env.NODE_ENV!=="production"&&j(this,gs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,gs,true),y(this,Pn).setTimeout(e,t)}clearTimeout(e){y(this,Pn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,gs,true),y(this,Pn).setInterval(e,t)}clearInterval(e){y(this,Pn).clearInterval(e);}},Pn=new WeakMap,gs=new WeakMap,Rf),Fn=new eC;function _f(e){setTimeout(e,0);}var Qu=typeof window>"u"||"Deno"in globalThis;function Ar(){}function Pf(e,t){return typeof e=="function"?e(t):e}function Cl(e){return typeof e=="number"&&e>=0&&e!==1/0}function Nc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function sn(e,t){return typeof e=="function"?e(t):e}function wo(e,t){return typeof e=="function"?e(t):e}function $c(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==wl(i,t.options))return false}else if(!Cs(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function jc(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(ys(t.options.mutationKey)!==ys(s))return false}else if(!Cs(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function wl(e,t){return (t?.queryKeyHashFn||ys)(e)}function ys(e){return JSON.stringify(e,(t,r)=>Ku(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Cs(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Cs(e[r],t[r])):false}var tC=Object.prototype.hasOwnProperty;function Hc(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=If(e)&&If(t);if(!o&&!(Ku(e)&&Ku(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},u=0;for(let p=0;p<a;p++){let g=o?p:i[p],w=e[g],m=t[g];if(w===m){l[g]=w,(o?p<s:tC.call(e,g))&&u++;continue}if(w===null||m===null||typeof w!="object"||typeof m!="object"){l[g]=m;continue}let f=Hc(w,m,r+1);l[g]=f,f===w&&u++;}return s===a&&u===s?e:l}function qc(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 If(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ku(e){if(!vf(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!vf(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vf(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ff(e){return new Promise(t=>{Fn.setTimeout(t,e);})}function Sl(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 Hc(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 Hc(e,t)}return t}function Vf(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Df(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var bs=Symbol();function Kc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===bs&&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===bs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qc(e,t){return typeof e=="function"?e(...t):!!e}function Of(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var Vn=(()=>{let e=()=>Qu;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Tl(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Lf=_f;function rC(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Lf,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var ar=rC();var fa,Mi,ha,Bf,oC=(Bf=class extends vn{constructor(){super();pe(this,fa,true);pe(this,Mi);pe(this,ha);j(this,ha,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){y(this,Mi)||this.setEventListener(y(this,ha));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Mi))==null||t.call(this),j(this,Mi,void 0));}setEventListener(t){var r;j(this,ha,t),(r=y(this,Mi))==null||r.call(this),j(this,Mi,t(this.setOnline.bind(this)));}setOnline(t){y(this,fa)!==t&&(j(this,fa,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,fa)}},fa=new WeakMap,Mi=new WeakMap,ha=new WeakMap,Bf),ga=new oC;function nC(e){return Math.min(1e3*2**e,3e4)}function Yu(e){return (e??"online")==="online"?ga.isOnline():true}var Yc=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Gc(e){let t=false,r=0,o,n=Tl(),s=()=>n.status!=="pending",i=T=>{if(!s()){let I=new Yc(T);w(I),e.onCancel?.(I);}},a=()=>{t=true;},l=()=>{t=false;},u=()=>ma.isFocused()&&(e.networkMode==="always"||ga.isOnline())&&e.canRun(),p=()=>Yu(e.networkMode)&&e.canRun(),g=T=>{s()||(o?.(),n.resolve(T));},w=T=>{s()||(o?.(),n.reject(T));},m=()=>new Promise(T=>{o=I=>{(s()||u())&&T(I);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),f=()=>{if(s())return;let T,I=r===0?e.initialPromise:void 0;try{T=I??e.fn();}catch(k){T=Promise.reject(k);}Promise.resolve(T).then(g).catch(k=>{if(s())return;let _=e.retry??(Vn.isServer()?0:3),v=e.retryDelay??nC,S=typeof v=="function"?v(r,k):v,x=_===true||typeof _=="number"&&r<_||typeof _=="function"&&_(r,k);if(t||!x){w(k);return}r++,e.onFail?.(r,k),Ff(S).then(()=>u()?void 0:m()).then(()=>{t?w(k):f();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():m().then(f),n)}}var ws,Af,Jc=(Af=class{constructor(){pe(this,ws);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Cl(this.gcTime)&&j(this,ws,Fn.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vn.isServer()?1/0:300*1e3));}clearGcTimeout(){y(this,ws)!==void 0&&(Fn.clearTimeout(y(this,ws)),j(this,ws,void 0));}},ws=new WeakMap,Af);var Ss,ya,jo,Ts,Kr,kl,ks,Do,Uf,Zn,Mf,zf=(Mf=class extends Jc{constructor(t){super();pe(this,Do);pe(this,Ss);pe(this,ya);pe(this,jo);pe(this,Ts);pe(this,Kr);pe(this,kl);pe(this,ks);j(this,ks,false),j(this,kl,t.defaultOptions),this.setOptions(t.options),this.observers=[],j(this,Ts,t.client),j(this,jo,y(this,Ts).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,j(this,Ss,Ef(this.options)),this.state=t.state??y(this,Ss),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return y(this,Kr)?.promise}setOptions(t){if(this.options={...y(this,kl),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Ef(this.options);r.data!==void 0&&(this.setState(Wf(r.data,r.dataUpdatedAt)),j(this,Ss,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,jo).remove(this);}setData(t,r){let o=Sl(this.state.data,t,this.options);return pt(this,Do,Zn).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){pt(this,Do,Zn).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=y(this,Kr)?.promise;return y(this,Kr)?.cancel(t),r?r.then(Ar).catch(Ar):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return y(this,Ss)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>wo(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===bs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>sn(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:!Nc(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),y(this,Kr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),y(this,Kr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,jo).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(y(this,Kr)&&(y(this,ks)||pt(this,Do,Uf).call(this)?y(this,Kr).cancel({revert:true}):y(this,Kr).cancelRetry()),this.scheduleGc()),y(this,jo).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pt(this,Do,Zn).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&y(this,Kr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(y(this,Kr))return y(this,Kr).continueRetry(),y(this,Kr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(u=>u.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:()=>(j(this,ks,true),o.signal)});},s=()=>{let l=Kc(this.options,r),p=(()=>{let g={client:y(this,Ts),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return j(this,ks,false),this.options.persister?this.options.persister(l,p,this):l(p)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:y(this,Ts),state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(a,this),j(this,ya,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&pt(this,Do,Zn).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),j(this,Kr,Gc({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Yc&&l.revert&&this.setState({...y(this,ya),fetchStatus:"idle"}),o.abort();},onFail:(l,u)=>{pt(this,Do,Zn).call(this,{type:"failed",failureCount:l,error:u});},onPause:()=>{pt(this,Do,Zn).call(this,{type:"pause"});},onContinue:()=>{pt(this,Do,Zn).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await y(this,Kr).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),y(this,jo).config.onSuccess?.(l,this),y(this,jo).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Yc){if(l.silent)return y(this,Kr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw pt(this,Do,Zn).call(this,{type:"error",error:l}),y(this,jo).config.onError?.(l,this),y(this,jo).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Ss=new WeakMap,ya=new WeakMap,jo=new WeakMap,Ts=new WeakMap,Kr=new WeakMap,kl=new WeakMap,ks=new WeakMap,Do=new WeakSet,Uf=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Zn=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,...Gu(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Wf(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return j(this,ya,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),ar.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),y(this,jo).notify({query:this,type:"updated",action:t});});},Mf);function Gu(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Yu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wf(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Ef(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 So,kt,Rl,mo,xs,ba,Xn,zi,_l,Ca,wa,Rs,_s,Ui,Sa,Et,xl,Ju,Zu,Xu,ep,tp,rp,op,jf,$f,ip=($f=class extends vn{constructor(t,r){super();pe(this,Et);pe(this,So);pe(this,kt);pe(this,Rl);pe(this,mo);pe(this,xs);pe(this,ba);pe(this,Xn);pe(this,zi);pe(this,_l);pe(this,Ca);pe(this,wa);pe(this,Rs);pe(this,_s);pe(this,Ui);pe(this,Sa,new Set);this.options=r,j(this,So,t),j(this,zi,null),j(this,Xn,Tl()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(y(this,kt).addObserver(this),Hf(y(this,kt),this.options)?pt(this,Et,xl).call(this):this.updateResult(),pt(this,Et,ep).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return np(y(this,kt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return np(y(this,kt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pt(this,Et,tp).call(this),pt(this,Et,rp).call(this),y(this,kt).removeObserver(this);}setOptions(t){let r=this.options,o=y(this,kt);if(this.options=y(this,So).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wo(this.options.enabled,y(this,kt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pt(this,Et,op).call(this),y(this,kt).setOptions(this.options),r._defaulted&&!qc(this.options,r)&&y(this,So).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,kt),observer:this});let n=this.hasListeners();n&&Nf(y(this,kt),o,this.options,r)&&pt(this,Et,xl).call(this),this.updateResult(),n&&(y(this,kt)!==o||wo(this.options.enabled,y(this,kt))!==wo(r.enabled,y(this,kt))||sn(this.options.staleTime,y(this,kt))!==sn(r.staleTime,y(this,kt)))&&pt(this,Et,Ju).call(this);let s=pt(this,Et,Zu).call(this);n&&(y(this,kt)!==o||wo(this.options.enabled,y(this,kt))!==wo(r.enabled,y(this,kt))||s!==y(this,Ui))&&pt(this,Et,Xu).call(this,s);}getOptimisticResult(t){let r=y(this,So).getQueryCache().build(y(this,So),t),o=this.createResult(r,t);return sC(this,o)&&(j(this,mo,o),j(this,ba,this.options),j(this,xs,y(this,kt).state)),o}getCurrentResult(){return y(this,mo)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&y(this,Xn).status==="pending"&&y(this,Xn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){y(this,Sa).add(t);}getCurrentQuery(){return y(this,kt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=y(this,So).defaultQueryOptions(t),o=y(this,So).getQueryCache().build(y(this,So),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return pt(this,Et,xl).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),y(this,mo)))}createResult(t,r){let o=y(this,kt),n=this.options,s=y(this,mo),i=y(this,xs),a=y(this,ba),u=t!==o?t.state:y(this,Rl),{state:p}=t,g={...p},w=false,m;if(r._optimisticResults){let h=this.hasListeners(),D=!h&&Hf(t,r),L=h&&Nf(t,o,r,n);(D||L)&&(g={...g,...Gu(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:f,errorUpdatedAt:T,status:I}=g;m=g.data;let k=false;if(r.placeholderData!==void 0&&m===void 0&&I==="pending"){let h;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(h=s.data,k=true):h=typeof r.placeholderData=="function"?r.placeholderData(y(this,wa)?.state.data,y(this,wa)):r.placeholderData,h!==void 0&&(I="success",m=Sl(s?.data,h,r),w=true);}if(r.select&&m!==void 0&&!k)if(s&&m===i?.data&&r.select===y(this,_l))m=y(this,Ca);else try{j(this,_l,r.select),m=r.select(m),m=Sl(s?.data,m,r),j(this,Ca,m),j(this,zi,null);}catch(h){j(this,zi,h);}y(this,zi)&&(f=y(this,zi),m=y(this,Ca),T=Date.now(),I="error");let _=g.fetchStatus==="fetching",v=I==="pending",S=I==="error",x=v&&_,d=m!==void 0,C={status:I,fetchStatus:g.fetchStatus,isPending:v,isSuccess:I==="success",isError:S,isInitialLoading:x,isLoading:x,data:m,dataUpdatedAt:g.dataUpdatedAt,error:f,errorUpdatedAt:T,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>u.dataUpdateCount||g.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:S&&!d,isPaused:g.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:S&&d,isStale:sp(t,r),refetch:this.refetch,promise:y(this,Xn),isEnabled:wo(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let h=C.data!==void 0,D=C.status==="error"&&!h,L=E=>{D?E.reject(C.error):h&&E.resolve(C.data);},V=()=>{let E=j(this,Xn,C.promise=Tl());L(E);},R=y(this,Xn);switch(R.status){case "pending":t.queryHash===o.queryHash&&L(R);break;case "fulfilled":(D||C.data!==R.value)&&V();break;case "rejected":(!D||C.error!==R.reason)&&V();break}}return C}updateResult(){let t=y(this,mo),r=this.createResult(y(this,kt),this.options);if(j(this,xs,y(this,kt).state),j(this,ba,this.options),y(this,xs).data!==void 0&&j(this,wa,y(this,kt)),qc(r,t))return;j(this,mo,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!y(this,Sa).size)return true;let i=new Set(s??y(this,Sa));return this.options.throwOnError&&i.add("error"),Object.keys(y(this,mo)).some(a=>{let l=a;return y(this,mo)[l]!==t[l]&&i.has(l)})};pt(this,Et,jf).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pt(this,Et,ep).call(this);}},So=new WeakMap,kt=new WeakMap,Rl=new WeakMap,mo=new WeakMap,xs=new WeakMap,ba=new WeakMap,Xn=new WeakMap,zi=new WeakMap,_l=new WeakMap,Ca=new WeakMap,wa=new WeakMap,Rs=new WeakMap,_s=new WeakMap,Ui=new WeakMap,Sa=new WeakMap,Et=new WeakSet,xl=function(t){pt(this,Et,op).call(this);let r=y(this,kt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Ar)),r},Ju=function(){pt(this,Et,tp).call(this);let t=sn(this.options.staleTime,y(this,kt));if(Vn.isServer()||y(this,mo).isStale||!Cl(t))return;let o=Nc(y(this,mo).dataUpdatedAt,t)+1;j(this,Rs,Fn.setTimeout(()=>{y(this,mo).isStale||this.updateResult();},o));},Zu=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,kt)):this.options.refetchInterval)??false},Xu=function(t){pt(this,Et,rp).call(this),j(this,Ui,t),!(Vn.isServer()||wo(this.options.enabled,y(this,kt))===false||!Cl(y(this,Ui))||y(this,Ui)===0)&&j(this,_s,Fn.setInterval(()=>{(this.options.refetchIntervalInBackground||ma.isFocused())&&pt(this,Et,xl).call(this);},y(this,Ui)));},ep=function(){pt(this,Et,Ju).call(this),pt(this,Et,Xu).call(this,pt(this,Et,Zu).call(this));},tp=function(){y(this,Rs)!==void 0&&(Fn.clearTimeout(y(this,Rs)),j(this,Rs,void 0));},rp=function(){y(this,_s)!==void 0&&(Fn.clearInterval(y(this,_s)),j(this,_s,void 0));},op=function(){let t=y(this,So).getQueryCache().build(y(this,So),this.options);if(t===y(this,kt))return;let r=y(this,kt);j(this,kt,t),j(this,Rl,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},jf=function(t){ar.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(y(this,mo));}),y(this,So).getQueryCache().notify({query:y(this,kt),type:"observerResultsUpdated"});});},$f);function iC(e,t){return wo(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function Hf(e,t){return iC(e,t)||e.state.data!==void 0&&np(e,t,t.refetchOnMount)}function np(e,t,r){if(wo(t.enabled,e)!==false&&sn(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&sp(e,t)}return false}function Nf(e,t,r,o){return (e!==t||wo(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&sp(e,r)}function sp(e,t){return wo(t.enabled,e)!==false&&e.isStaleByTime(sn(t.staleTime,e))}function sC(e,t){return !qc(e.getCurrentResult(),t)}function ap(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,u=async()=>{let p=false,g=f=>{Of(f,()=>t.signal,()=>p=true);},w=Kc(t.options,t.fetchOptions),m=async(f,T,I)=>{if(p)return Promise.reject();if(T==null&&f.pages.length)return Promise.resolve(f);let _=(()=>{let d={client:t.client,queryKey:t.queryKey,pageParam:T,direction:I?"backward":"forward",meta:t.options.meta};return g(d),d})(),v=await w(_),{maxPages:S}=t.options,x=I?Df:Vf;return {pages:x(f.pages,v,S),pageParams:x(f.pageParams,T,S)}};if(n&&s.length){let f=n==="backward",T=f?aC:qf,I={pages:s,pageParams:i},k=T(o,I);a=await m(I,k,f);}else {let f=e??s.length;do{let T=l===0?i[0]??o.initialPageParam:qf(o,a);if(l>0&&T==null)break;a=await m(a,T),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u;}}}function qf(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 aC(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Il,Dn,io,Is,On,Hi,Kf,Qf=(Kf=class extends Jc{constructor(t){super();pe(this,On);pe(this,Il);pe(this,Dn);pe(this,io);pe(this,Is);j(this,Il,t.client),this.mutationId=t.mutationId,j(this,io,t.mutationCache),j(this,Dn,[]),this.state=t.state||lC(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){y(this,Dn).includes(t)||(y(this,Dn).push(t),this.clearGcTimeout(),y(this,io).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){j(this,Dn,y(this,Dn).filter(r=>r!==t)),this.scheduleGc(),y(this,io).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){y(this,Dn).length||(this.state.status==="pending"?this.scheduleGc():y(this,io).remove(this));}continue(){return y(this,Is)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{pt(this,On,Hi).call(this,{type:"continue"});},o={client:y(this,Il),meta:this.options.meta,mutationKey:this.options.mutationKey};j(this,Is,Gc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{pt(this,On,Hi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{pt(this,On,Hi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,io).canRun(this)}));let n=this.state.status==="pending",s=!y(this,Is).canStart();try{if(n)r();else {pt(this,On,Hi).call(this,{type:"pending",variables:t,isPaused:s}),y(this,io).config.onMutate&&await y(this,io).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&pt(this,On,Hi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await y(this,Is).start();return await y(this,io).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await y(this,io).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),pt(this,On,Hi).call(this,{type:"success",data:i}),i}catch(i){try{await y(this,io).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await y(this,io).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw pt(this,On,Hi).call(this,{type:"error",error:i}),i}finally{y(this,io).runNext(this);}}},Il=new WeakMap,Dn=new WeakMap,io=new WeakMap,Is=new WeakMap,On=new WeakSet,Hi=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),ar.batch(()=>{y(this,Dn).forEach(o=>{o.onMutationUpdate(t);}),y(this,io).notify({mutation:this,type:"updated",action:t});});},Kf);function lC(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ei,an,vl,Yf,Gf=(Yf=class extends vn{constructor(t={}){super();pe(this,ei);pe(this,an);pe(this,vl);this.config=t,j(this,ei,new Set),j(this,an,new Map),j(this,vl,0);}build(t,r,o){let n=new Qf({client:t,mutationCache:this,mutationId:++qa(this,vl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){y(this,ei).add(t);let r=Zc(t);if(typeof r=="string"){let o=y(this,an).get(r);o?o.push(t):y(this,an).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(y(this,ei).delete(t)){let r=Zc(t);if(typeof r=="string"){let o=y(this,an).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&y(this,an).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Zc(t);if(typeof r=="string"){let n=y(this,an).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Zc(t);return typeof r=="string"?y(this,an).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ar.batch(()=>{y(this,ei).forEach(t=>{this.notify({type:"removed",mutation:t});}),y(this,ei).clear(),y(this,an).clear();});}getAll(){return Array.from(y(this,ei))}find(t){let r={exact:true,...t};return this.getAll().find(o=>jc(r,o))}findAll(t={}){return this.getAll().filter(r=>jc(t,r))}notify(t){ar.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return ar.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ar))))}},ei=new WeakMap,an=new WeakMap,vl=new WeakMap,Yf);function Zc(e){return e.options.scope?.id}var Ln,Jf,Zf=(Jf=class extends vn{constructor(t={}){super();pe(this,Ln);this.config=t,j(this,Ln,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??wl(n,r),i=this.get(s);return i||(i=new zf({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){y(this,Ln).has(t.queryHash)||(y(this,Ln).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=y(this,Ln).get(t.queryHash);r&&(t.destroy(),r===t&&y(this,Ln).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){ar.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return y(this,Ln).get(t)}getAll(){return [...y(this,Ln).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>$c(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>$c(t,o)):r}notify(t){ar.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){ar.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){ar.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Ln=new WeakMap,Jf);var _r,Ni,$i,Ta,ka,ji,xa,Ra,Xf,lp=(Xf=class{constructor(e={}){pe(this,_r);pe(this,Ni);pe(this,$i);pe(this,Ta);pe(this,ka);pe(this,ji);pe(this,xa);pe(this,Ra);j(this,_r,e.queryCache||new Zf),j(this,Ni,e.mutationCache||new Gf),j(this,$i,e.defaultOptions||{}),j(this,Ta,new Map),j(this,ka,new Map),j(this,ji,0);}mount(){qa(this,ji)._++,y(this,ji)===1&&(j(this,xa,ma.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,_r).onFocus());})),j(this,Ra,ga.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,_r).onOnline());})));}unmount(){var e,t;qa(this,ji)._--,y(this,ji)===0&&((e=y(this,xa))==null||e.call(this),j(this,xa,void 0),(t=y(this,Ra))==null||t.call(this),j(this,Ra,void 0));}isFetching(e){return y(this,_r).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Ni).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,_r).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=y(this,_r).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(sn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return y(this,_r).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=y(this,_r).get(o.queryHash)?.state.data,i=Pf(t,s);if(i!==void 0)return y(this,_r).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return ar.batch(()=>y(this,_r).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,_r).get(t.queryHash)?.state}removeQueries(e){let t=y(this,_r);ar.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=y(this,_r);return ar.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=ar.batch(()=>y(this,_r).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Ar).catch(Ar)}invalidateQueries(e,t={}){return ar.batch(()=>(y(this,_r).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=ar.batch(()=>y(this,_r).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Ar)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Ar)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=y(this,_r).build(this,t);return r.isStaleByTime(sn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ar).catch(Ar)}fetchInfiniteQuery(e){return e.behavior=ap(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ar).catch(Ar)}ensureInfiniteQueryData(e){return e.behavior=ap(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ga.isOnline()?y(this,Ni).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,_r)}getMutationCache(){return y(this,Ni)}getDefaultOptions(){return y(this,$i)}setDefaultOptions(e){j(this,$i,e);}setQueryDefaults(e,t){y(this,Ta).set(ys(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...y(this,Ta).values()],r={};return t.forEach(o=>{Cs(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){y(this,ka).set(ys(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...y(this,ka).values()],r={};return t.forEach(o=>{Cs(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...y(this,$i).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=wl(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===bs&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...y(this,$i).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){y(this,_r).clear(),y(this,Ni).clear();}},_r=new WeakMap,Ni=new WeakMap,$i=new WeakMap,Ta=new WeakMap,ka=new WeakMap,ji=new WeakMap,xa=new WeakMap,Ra=new WeakMap,Xf);var cp=qi__namespace.createContext(void 0),dp=e=>{let t=qi__namespace.useContext(cp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},up=({client:e,children:t})=>(qi__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(cp.Provider,{value:e,children:t}));var eh=qi__namespace.createContext(false),th=()=>qi__namespace.useContext(eh);eh.Provider;function dC(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var uC=qi__namespace.createContext(dC()),rh=()=>qi__namespace.useContext(uC);var nh=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Qc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},ih=e=>{qi__namespace.useEffect(()=>{e.clearReset();},[e]);},sh=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Qc(r,[e.error,o]));var ah=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));}},lh=(e,t)=>e.isLoading&&e.isFetching&&!t,ch=(e,t)=>e?.suspense&&t.isPending,pp=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function dh(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=th(),n=rh(),s=dp(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",ah(i),nh(i,n,a),ih(n);let l=!s.getQueryCache().get(i.queryHash),[u]=qi__namespace.useState(()=>new t(s,i)),p=u.getOptimisticResult(i),g=!o&&e.subscribed!==false;if(qi__namespace.useSyncExternalStore(qi__namespace.useCallback(w=>{let m=g?u.subscribe(ar.batchCalls(w)):Ar;return u.updateResult(),m},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),qi__namespace.useEffect(()=>{u.setOptions(i);},[i,u]),ch(i,p))throw pp(i,u,n);if(sh({result:p,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw p.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,p),i.experimental_prefetchInRender&&!Vn.isServer()&&lh(p,o)&&(l?pp(i,u,n):a?.promise)?.catch(Ar).finally(()=>{u.updateResult();}),i.notifyOnChangeProps?p:u.trackResult(p)}function ti(e,t){return dh(e,ip)}var va=new Map;function uh({width:e,height:t,borderRadius:r,color:o}){let n=qi.useRef(new reactNative.Animated.Value(.3)).current;return qi.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ri({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=A(),[u,p]=qi.useState(false),[g,w]=qi.useState(false),[m,f]=qi.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=va.get(e);return x?{uri:e,xml:x}:null}),T=e?.toLowerCase().endsWith(".svg"),I=T&&e&&m?.uri===e?m.xml:null;qi.useEffect(()=>{p(false),w(false);},[e]),qi.useEffect(()=>{if(!T||!e)return;if(va.has(e)){f({uri:e,xml:va.get(e)});return}let x=false;return fetch(e).then(d=>{if(!d.ok)throw new Error(`HTTP ${d.status}`);return d.text()}).then(d=>{x||(va.set(e,d),f({uri:e,xml:d}));}).catch(()=>{x||p(true);}),()=>{x=true;}},[e,T]);let k=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:k},a]});let _={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},v=t-n*2,S=r-n*2;return u?jsxRuntime.jsx(reactNative.View,{style:[_,{backgroundColor:i||k}]}):T?jsxRuntime.jsxs(reactNative.View,{style:_,children:[!!!I&&jsxRuntime.jsx(uh,{width:v,height:S,borderRadius:o,color:k}),I?jsxRuntime.jsx(Gt.SvgXml,{xml:I,width:v,height:S,onError:()=>p(true)}):jsxRuntime.jsx(Gt.SvgUri,{uri:e,width:v,height:S,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:_,children:[!g&&jsxRuntime.jsx(uh,{width:v,height:S,borderRadius:o,color:k}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:v,height:S},resizeMode:"contain",onLoad:()=>w(true),onError:()=>p(true)})]})}function hp(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(va.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{va.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function to({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:u,balanceChainId:p,balanceTokenAddress:g,publishableKey:w,projectName:m,leftIcon:f,onLeftAction:T}){let{colors:I,fonts:k,components:_}=A(),[v,S]=qi.useState(null),[x,d]=qi.useState(false),c=qi.useState(()=>new reactNative.Animated.Value(0))[0];qi.useEffect(()=>{if(!x)return;let h=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(c,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(c,{toValue:0,duration:700,useNativeDriver:true})]));return h.start(),()=>h.stop()},[x,c]),qi.useEffect(()=>{if(!a||!l||!u||!p||!g||!w){S(null),d(false);return}let h=false;return d(true),fc(l,u,p,g,w).then(D=>{if(h)return;let L=D.balance,V=null;L&&(L.amount_usd!=null&&L.amount_usd!==""?V=`$${L.amount_usd}`:V="$0.00"),S(V);}).catch(()=>{h||S(null);}).finally(()=>{h||d(false);}),()=>{h=true;}},[a,l,u,p,g,w]);let C=c.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:so.header,children:[jsxRuntime.jsx(reactNative.View,{style:so.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Qa,{size:20,color:_.header.buttonColor,strokeWidth:2})}):f&&T?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:T,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsxRuntime.jsx(reactNative.View,{style:so.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:so.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:so.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[so.title,{color:_.header.titleColor,fontFamily:k.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[so.titleBadge,{backgroundColor:I.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[so.titleBadgeText,{color:I.foregroundMuted,fontFamily:k.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[so.balanceText,{color:I.foregroundMuted,fontFamily:k.regular}],children:t}):null,a&&(x?jsxRuntime.jsx(reactNative.Animated.View,{style:[so.balanceSkeleton,{backgroundColor:I.cardHover,opacity:C}]}):v!=null?jsxRuntime.jsxs(reactNative.Text,{style:[so.balanceText,{color:I.foregroundMuted,fontFamily:k.regular}],children:[m?`${m} `:"","Balance: ",v]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:so.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:_.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:so.spacer})})]})}var so=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Ir({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=A(),a=s??i.card,l=a.backShadowColor!=="transparent",u={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[hh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[u,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[hh.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 hh=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Fl({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card,a=o?[...o].sort((l,u)=>l.position-u.position):[];return jsxRuntime.jsxs(Ir,{cardTokens:i,onPress:e,style:Bn.wrapper,contentStyle:Bn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Bn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Bn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(ou,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Bn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Bn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Bn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Bn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Bn.networkIcons,children:a.map((l,u)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Bn.networkIconWrapper,{marginLeft:u===0?0:-6,zIndex:a.length-u}],children:jsxRuntime.jsx(ri,{uri:re(p),width:20,height:20})},l.name)})})})]})}var Bn=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 Dl({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsxs(Ir,{cardTokens:i,onPress:e,style:oi.wrapper,contentStyle:oi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:oi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[oi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(qs,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:oi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[oi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[oi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:oi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:oi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(u=>u.format==="png")?.url||a.icon_urls.find(u=>u.format==="svg")?.url;return jsxRuntime.jsx(ri,{uri:re(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var oi=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 Ol({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsx(Ir,{cardTokens:i,onPress:e,style:ni.wrapper,contentStyle:ni.container,children:jsxRuntime.jsxs(reactNative.View,{style:ni.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ni.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(oo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[ni.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ni.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:ni.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ni.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ni.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var ni=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 Bl({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=A(),s=n.depositMenu.card;return jsxRuntime.jsxs(Ir,{cardTokens:s,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:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(nc,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:An.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[An.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[An.subtitle,{color:s.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 _C="#00D632";function Al({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=A(),s=n.depositMenu.card,[i,a]=qi.useState(false),l=jt("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Ir,{cardTokens:s,onPress:e,style:Wn.wrapper,contentStyle:Wn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Wn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Wn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[Wn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Wn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Wn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Wn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Wn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:_C,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var Vs="#00D632",kh=5,FC=[25,50,100,500],Da=120,VC=5e3,DC=2e3,OC=300;function Wl(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function xh(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function LC(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function Rh(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function BC(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function _h(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function AC(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function WC(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function id({size:e,faded:t=false,withBackground:r=false}){let[o,n]=qi.useState(false),s=jt("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Vs,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Vs}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function sd({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:u,fonts:p,components:g}=A();qi.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[w,m]=qi.useState("amountInput"),[f,T]=qi.useState("25"),[I,k]=qi.useState(null),[_,v]=qi.useState(null),[S,x]=qi.useState(true),[d,c]=qi.useState(null),[C,h]=qi.useState(false),[D,L]=qi.useState(null),[V,R]=qi.useState(Da),[E,U]=qi.useState(null),[q,Qe]=qi.useState(false),[ne,Je]=qi.useState("pending"),$=qi.useRef(null),ae=qi.useRef(null),Q=qi.useRef(null),Y=qi.useRef("pending"),we=qi.useRef(null),G=qi.useRef("amountInput"),ie=qi.useRef(Da),Ye=qi.useRef(null),Be=qi.useRef(null),Ze=qi.useRef(false),Ge=qi.useRef(true),Ue=_?.minimum_amount??kh,Me=_?.maximum_amount,ot=parseFloat(f)||0,De=!isNaN(ot)&&ot>=Ue&&(Me==null||ot<=Me),Ae=Me?`$${Wl(Ue)} \u2013 $${Wl(Me)}`:`$${Wl(Ue)} minimum`,ce=w==="amountInput"?"Pay with Cash App":`Pay $${xh(f)} via Cash App`,ye=w==="waitingForPayment";qi.useEffect(()=>(Ge.current=true,x(true),hu("usd",t).then(b=>{Ge.current&&v(b);}).catch(()=>{}).finally(()=>{Ge.current&&x(false);}),()=>{Ge.current=false,Xe();}),[t]);function ke(b,B=_){if(L(null),!b){k(null);return}let O=parseFloat(b);if(isNaN(O)){k("Enter a valid number");return}let J=B?.minimum_amount??kh,M=B?.maximum_amount;O<J?k(`$${Wl(J)} minimum`):M!=null&&O>M?k(`$${Wl(M)} maximum`):k(null);}function Xe(){$.current&&clearInterval($.current),ae.current&&clearInterval(ae.current),Q.current&&clearInterval(Q.current),$.current=null,ae.current=null,Q.current=null;}function Ne(){Xe(),c(null),we.current=null,U(null),Qe(false),L(null),Y.current="pending",Je("pending"),R(Da),ie.current=Da,Ye.current=null,Ze.current=false,m("amountInput"),G.current="amountInput";}async function dt(){if(!(!De||C)){h(true),L(null),Xe(),Ye.current=null;try{let b=await fu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:f},t);we.current=b,Y.current=b.status,c(b),h(!1),m("waitingForPayment"),G.current="waitingForPayment",Nt(),_e(),reactNative.Linking.openURL(b.url).catch(()=>{});}catch(b){h(false),L(b instanceof Error?b.message:"Failed to create session");}}}function Nt(){ie.current=Da,R(Da),Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{ie.current-=1,R(ie.current),ie.current<=0&&(clearInterval(Q.current),Q.current=null,Y.current==="pending"&&(m("softExpired"),G.current="softExpired"));},1e3);}function _e(){$.current&&clearInterval($.current),$.current=setInterval(()=>{Re();},VC);}async function Re(){if(!Ge.current)return;let b=we.current;if(!b)return;let B=b.external_id??b.id;try{let O=await gu(B,t),J=Y.current;switch(Y.current=O.status,Je(O.status),O.status){case "processing":(G.current==="amountInput"||G.current==="softExpired"||G.current==="waitingForPayment")&&(m("paymentReceived"),G.current="paymentReceived",Q.current&&(clearInterval(Q.current),Q.current=null));break;case "completed":$.current&&(clearInterval($.current),$.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),J!=="completed"&&(m("paymentReceived"),G.current="paymentReceived",at());break;case "failed":$.current&&(clearInterval($.current),$.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),G.current!=="amountInput"&&(m("failed"),G.current="failed");break;case "expired":$.current&&(clearInterval($.current),$.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),G.current!=="amountInput"&&(m("softExpired"),G.current="softExpired");break;default:break}}catch{}}let Ve=6e5;function at(){ae.current&&clearInterval(ae.current);let b=Date.now()+Ve;ae.current=setInterval(()=>{if(Date.now()>b){clearInterval(ae.current),ae.current=null;let B=Y.current;B==="completed"||B==="processing"?(m("paymentReceived"),G.current="paymentReceived"):(m("failed"),G.current="failed");return}Ie();},DC);}async function Ie(){if(Ge.current)try{let b=await Xo(e,t,"deposit"),B=Date.now(),O=[...b.data].sort((je,He)=>{let Jr=je.created_at?new Date(je.created_at).getTime():0;return (He.created_at?new Date(He.created_at).getTime():0)-Jr}),J=Ye.current,M=J?O.find(je=>je.id===J):O.find(je=>{if(!je.created_at)return !1;let He=new Date(je.created_at).getTime();return B-He<OC*1e3});M&&(Ye.current||(Ye.current=M.id),M.status==="succeeded"?(ae.current&&(clearInterval(ae.current),ae.current=null),U(M),m("depositComplete"),G.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:M.id,transaction:M})):(M.status==="failed"||M.status==="refunded")&&(ae.current&&(clearInterval(ae.current),ae.current=null),U(M),m("failed"),G.current="failed"));}catch{}}function be(){if(w==="waitingForPayment"){Q.current&&(clearInterval(Q.current),Q.current=null),m("amountInput"),G.current="amountInput";return}i();}function Oe(){Xe(),a();}function Ut(){let b=we.current??d;b&&reactNative.Linking.openURL(b.url).catch(()=>{});}function Ht(b){let B=b.destination_amount_base_unit;if(!B)return "\u2014";let O=b.destination_token_metadata?.decimals??6;return LC(B,O)}function wt(b){return BC(b.destination_currency)}function yt(b){let B=b.destination_token_metadata;return B?B.icon_urls&&B.icon_urls.length>0?_i(B.icon_urls,"png")??B.icon_url??null:B.icon_url??null:null}function rr(){return jsxRuntime.jsxs(reactNative.View,{style:N.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.poweredByText,{color:u.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.poweredByBold,{color:u.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[N.poweredByBold,{color:u.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function We(b,B){return jsxRuntime.jsxs(reactNative.View,{style:N.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.detailLabel,{color:u.foregroundMuted,fontFamily:p.regular}],children:b}),jsxRuntime.jsx(reactNative.Text,{style:[N.detailValue,{color:u.foreground,fontFamily:p.medium}],children:B})]},b)}function ve(b,B,O){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.txRow,{backgroundColor:u.card,borderColor:u.cardHover}],onPress:()=>reactNative.Linking.openURL(O).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txLabel,{color:u.foreground,fontFamily:p.medium}],children:b}),jsxRuntime.jsxs(reactNative.View,{style:N.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txHash,{color:u.foregroundMuted}],children:B}),jsxRuntime.jsx(reactNative.Text,{style:[N.txArrow,{color:u.foregroundMuted}],children:"\u2197"})]})]},b)}function $e(){let b=Math.max(60-f.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:N.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:N.flex,contentContainerStyle:N.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{Ze.current||(Ze.current=true,setTimeout(()=>Be.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:N.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:N.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.amountDollar,{color:u.foreground,fontSize:b}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Be,value:f,onChangeText:B=>{T(B),ke(B);},keyboardType:"decimal-pad",style:[N.amountInput,{color:u.foreground,fontSize:b}],placeholderTextColor:u.foregroundMuted,placeholder:"0"})]}),I?jsxRuntime.jsx(reactNative.Text,{style:[N.amountError,{color:u.warning,fontFamily:p.regular}],children:I}):S?jsxRuntime.jsx(reactNative.View,{style:[N.limitsSkeleton,{backgroundColor:u.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[N.limitsSubtitle,{color:u.foregroundMuted,fontFamily:p.regular}],children:Ae})]}),jsxRuntime.jsx(reactNative.View,{style:N.quickAmountsRow,children:FC.map(B=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.quickAmountButton,{backgroundColor:u.card}],onPress:()=>{let O=String(B);T(O),ke(O);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[N.quickAmountText,{color:u.foreground,fontFamily:p.medium}],children:["$",B]})},B))}),D&&jsxRuntime.jsxs(reactNative.View,{style:[N.errorBanner,{backgroundColor:u.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:N.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[N.errorBannerText,{color:u.foreground,fontFamily:p.regular}],children:D})]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius,opacity:!De||C?.4:1}],onPress:dt,disabled:!De||C,activeOpacity:.8,children:[C&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:N.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:C?"Loading...":"Continue"})]})})]})}function ge(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(id,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:u.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:u.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
|
|
3
|
-
This page will update automatically.`}),V>0&&jsxRuntime.jsxs(reactNative.Text,{style:[N.expiryText,{color:V<=30?u.warning:u.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",WC(V)]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:
|
|
4
|
-
`,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Ne,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function P(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[N.failedIconCircle,{backgroundColor:u.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.failedIconText,{color:u.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:u.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:u.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:N.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Ne,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),rr()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[N.root,{backgroundColor:u.background}],children:[jsxRuntime.jsx(to,{title:ce,showBack:ye,onBack:be,onClose:Oe}),w==="amountInput"&&$e(),w==="waitingForPayment"&&ge(),w==="paymentReceived"&&Pe(),w==="depositComplete"&&H(),w==="softExpired"&&ue(),w==="failed"&&P()]})}var N=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var Fh=5e3,Vh=2500,Dh=5e3,Oh=6e4;function si(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:u,trackedExecutions:p,setDepositExecutions:g,setTrackedExecutions:w,setLatestExecution:m,setShowStatusSheet:f,onDepositSuccess:T,onExecutionsChange:I,onDepositError:k}=e,[_,v]=qi.useState(false),[S,x]=qi.useState(false);return qi.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;v(false),t==="auto_ui"&&x(false);let c=setTimeout(()=>{v(true),t==="auto_ui"&&x(true);},Fh);return ()=>clearTimeout(c)},[r,t,o,n]),qi.useEffect(()=>{if(!r||!s||!a)return;let c=new Date(a.getTime()-Oh),C=setInterval(async()=>{try{let L=[...(await Xo(s,i,"deposit")).data??[]].sort((R,E)=>{let U=R.created_at?new Date(R.created_at).getTime():0;return (E.created_at?new Date(E.created_at).getTime():0)-U}),V=null;for(let R of L){let E=R.created_at?new Date(R.created_at):null;if(!E||E<=c)continue;let U=p.get(R.id);if(!U){V=R;break}if(["pending","waiting","delayed"].includes(U)&&R.status==="succeeded"){V=R;break}}if(V){let R=V;g(E=>{let U=E.findIndex(q=>q.id===R.id);if(U>=0){let q=[...E];return q[U]=R,q}return [...E,R]}),w(E=>{let U=new Map(E);return U.set(R.id,R.status),U}),m(R),f(!0),R.status==="succeeded"&&T?.({message:"Deposit completed successfully",executionId:R.id}),I?.([...u,R]);}}catch(h){k?.({message:"Failed to check deposit status",error:h});}},Vh);return ()=>clearInterval(C)},[r,s,i,a,p,u,I,T,k]),qi.useEffect(()=>{if(!r||!_||!l)return;let c=async()=>{try{await dc(l,i);}catch{}};c();let C=setInterval(c,Dh);return ()=>clearInterval(C)},[r,_,l,i]),{pollingEnabled:_,showWaitingUi:S,handleIveDeposited:()=>{v(true),x(true);}}}var li=7,ai=4,Oa=4;function $C(e,t,r){return e<li&&t<li||e<li&&t>=r-li||e>=r-li&&t<li}function Zi({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=A(),l=a?"#1a1a1a":"#ffffff",u=a?"#ffffff":"#000000",p=n||l,g=qi.useMemo(()=>{try{return NC__default.default(e||"placeholder","H")}catch{return null}},[e]),w=g?g.length:0,m=w?(t-ai*2)/w:0,f=m*.38,T=o+12,I=T/2+4,k=t/2,_=t/2,v=w?[{x:ai,y:ai},{x:ai+(w-li)*m,y:ai},{x:ai,y:ai+(w-li)*m}]:[],S=li*m,x=5*m,d=m,c=3*m,C=2*m;return jsxRuntime.jsxs(reactNative.View,{style:[Fp.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Gt__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Gt.Rect,{x:0,y:0,width:t,height:t,fill:l}),g?.map((h,D)=>h.map((L,V)=>{if(!L||$C(D,V,w))return null;let R=ai+V*m+m/2,E=ai+D*m+m/2;if(r){let U=R-k,q=E-_;if(Math.sqrt(U*U+q*q)<I)return null}return jsxRuntime.jsx(Gt.Circle,{cx:R,cy:E,r:f,fill:u},`${D}-${V}`)})),v.map((h,D)=>jsxRuntime.jsxs(qi__namespace.default.Fragment,{children:[jsxRuntime.jsx(Gt.Rect,{x:h.x,y:h.y,width:S,height:S,rx:Oa,ry:Oa,fill:u}),jsxRuntime.jsx(Gt.Rect,{x:h.x+d,y:h.y+d,width:x,height:x,rx:Oa-1,ry:Oa-1,fill:l}),jsxRuntime.jsx(Gt.Rect,{x:h.x+C,y:h.y+C,width:c,height:c,rx:Oa-1.5,ry:Oa-1.5,fill:u})]},`finder-${D}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[Fp.logoContainer,{width:T,height:T,top:_-T/2,left:k-T/2,backgroundColor:p,borderRadius:T/2}],children:[jsxRuntime.jsx(ri,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[Fp.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(ri,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var Fp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});function ud({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:s,fonts:i,components:a}=A(),l=qi.useRef(new reactNative.Animated.Value(0)).current;qi.useEffect(()=>{if(r&&!o){l.setValue(0);let p=reactNative.Animated.loop(reactNative.Animated.timing(l,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return p.start(),()=>p.stop()}},[r,o,l]);let u=l.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[dd.iveDepositedButton,{backgroundColor:s.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[dd.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:dd.processingCard,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:u}]},children:jsxRuntime.jsx(Ga,{size:16,color:s.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[dd.processingCardTitle,{color:s.foregroundMuted,fontFamily:i.regular}],children:"Checking for deposit"})]})]})}var dd=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingTop:6,marginBottom:12},processingCardTitle:{fontSize:14}});var Ba=(e,t)=>`${t}:${e}`,rw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function md({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:w,onDepositError:m,onLatestExecution:f,onShowStatusSheet:T,onSelectedTokenIconUrl:I,borderTopLeftRadius:k,borderTopRightRadius:_,sheetBorderRadius:v}){let{colors:S,fonts:x,components:d}=A(),c=a&&l?`${a}:${l}`:"solana:mainnet",[C,h]=qi.useState("USDC"),[D,L]=qi.useState(c),[V,R]=qi.useState([]),[E,U]=qi.useState(true),[q,Qe]=qi.useState([]),[ne,Je]=qi.useState(true),[$,ae]=qi.useState(false),[Q,Y]=qi.useState(false),[we,G]=qi.useState(false),[ie,Ye]=qi.useState(false),[Be,Ze]=qi.useState([]),[Ge,Ue]=qi.useState(new Map),[Me]=qi.useState(()=>new Date),[ot,De]=qi.useState(null),[Ae,ce]=qi.useState(false),[ye,ke]=qi.useState(null),[Xe,Ne]=qi.useState(false);qi.useEffect(()=>{ye&&f?.(ye);},[ye]),qi.useEffect(()=>{Ae&&(T?.(true),ce(false));},[Ae]);let dt=new Map;q.forEach(P=>{P.chains.forEach(b=>{let B=`${b.chain_type}:${b.chain_id}`;dt.has(B)||dt.set(B,b);});});let Nt=Array.from(dt.values()),_e=rw(D),Ve=Nt.find(P=>P.chain_type===_e.chainType&&P.chain_id===_e.chainId)?.chain_type||"ethereum",at=Eo(V,Ve),Ie=at?.address||"",be=qi.useRef(false);qi.useEffect(()=>{async function P(){try{Je(!0),De(null);let B=await qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Qe(B.data),B.data.length>0&&!be.current){be.current=!0;let O,J;if(a&&l)if(u)for(let M of B.data){let je=M.chains.find(He=>He.chain_type===a&&He.chain_id===l&&He.token_address.toLowerCase()===u.toLowerCase());if(je){O=M,J=je;break}}else {let M=He=>He.chain_type===a&&He.chain_id===l,je=B.data.find(He=>He.symbol==="USDC"&&He.chains.some(M));if(je)O=je,J=je.chains.find(M);else for(let He of B.data){let Jr=He.chains.find(M);if(Jr){O=He,J=Jr;break}}}if(!O&&s)for(let M of B.data){let je=M.chains.find(He=>He.token_address.toLowerCase()===s.toLowerCase());if(je){O=M,J=je;break}}O||(O=B.data.find(M=>M.symbol==="USDC"),O&&O.chains.length>0&&(J=O.chains[0])),O||(O=B.data.find(M=>M.symbol==="USDT"),O&&O.chains.length>0&&(J=O.chains[0])),O||(O=B.data[0],O.chains.length>0&&(J=O.chains[0])),O&&h(O.symbol),J&&L(Ba(J.chain_id,J.chain_type));}}catch(b){console.error("Error fetching supported tokens:",b),De("Failed to load supported tokens"),m?.({message:"Failed to load supported tokens",error:b});}finally{Je(false);}}P();},[t,m,a,l,u,s,n,o]),qi.useEffect(()=>{async function P(){try{U(!0),De(null);let b=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);R(b.data);}catch(b){console.error("Error fetching wallets:",b),De("Failed to load wallets"),m?.({message:"Failed to load wallets",error:b});}finally{U(false);}}P();},[e,r,o,n,s,t,m]);let Oe=at?.id??"",{showWaitingUi:Ut,handleIveDeposited:Ht}=si({depositConfirmationMode:p,depositAddress:Ie,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:Me,depositWalletId:Oe,depositExecutions:Be,trackedExecutions:Ge,setDepositExecutions:Ze,setTrackedExecutions:Ue,setLatestExecution:ke,setShowStatusSheet:ce,onDepositSuccess:w,onExecutionsChange:g,onDepositError:m});qi.useEffect(()=>{if(!q.length)return;let P=q.find(B=>B.symbol===C);if(!P||P.chains.length===0){let B=q.find(O=>O.symbol==="USDC")||q[0];B&&(h(B.symbol),B.chains.length>0&&L(Ba(B.chains[0].chain_id,B.chains[0].chain_type)));return}if(!P.chains.some(B=>Ba(B.chain_id,B.chain_type)===D)){let B=P.chains[0];L(Ba(B.chain_id,B.chain_type));}},[C,q,D]);let wt=q.find(P=>P.symbol===C),yt=xe(wt,"png")||void 0;qi.useEffect(()=>{I?.(yt);},[yt]);let rr=wt?.chains||[],We=rr.find(P=>Ba(P.chain_id,P.chain_type)===D),ve=async()=>{if(Ie)try{reactNative.Clipboard.setString(Ie),ae(!0),setTimeout(()=>ae(!1),2e3);}catch(P){console.error("Failed to copy:",P);}},$e=We?.estimated_price_impact_percent??0,ge=We?.max_slippage_percent??.25,Pe=We?.minimum_deposit_amount_usd??3;if(ne)return jsxRuntime.jsxs(reactNative.View,{style:z.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:S.foregroundMuted,fontFamily:x.regular}],children:"Loading currencies..."})]});if(ot&&q.length===0)return jsxRuntime.jsxs(reactNative.View,{style:z.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:S.error,fontFamily:x.regular}],children:ot}),jsxRuntime.jsx(reactNative.Text,{style:[z.errorHint,{color:S.foregroundMuted,fontFamily:x.regular}],children:"Please check your network connection and try again."})]});let H=()=>jsxRuntime.jsxs(_t,{visible:we,onClose:()=>G(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:d.header.titleColor,fontFamily:x.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Tt,{style:z.sheetList,contentContainerStyle:z.sheetListContent,showsVerticalScrollIndicator:false,children:q.map(P=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{h(P.symbol),G(false);},activeOpacity:.7,style:[z.sheetItem,{backgroundColor:C===P.symbol?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(P,"png"))},style:z.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:z.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.sheetItemTitle,{color:d.card.titleColor,fontFamily:x.medium}],children:P.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[z.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:x.regular}],children:[P.chains.length," network",P.chains.length!==1?"s":""," available"]})]}),C===P.symbol&&jsxRuntime.jsx(lt,{size:20,color:S.primary,strokeWidth:2})]},P.symbol))})]}),ue=()=>jsxRuntime.jsxs(_t,{visible:ie,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.chainSelector?.borderTopLeftRadius??k,borderTopRightRadius:v?.chainSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:d.header.titleColor,fontFamily:x.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Tt,{style:z.sheetList,contentContainerStyle:z.sheetListContent,showsVerticalScrollIndicator:false,children:rr.map(P=>{let b=Ba(P.chain_id,P.chain_type),B=D===b;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{L(b),Ye(false);},activeOpacity:.7,style:[z.sheetItem,{backgroundColor:B?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(P,"png"))},style:z.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:z.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.sheetItemTitle,{color:d.card.titleColor,fontFamily:x.medium}],children:P.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[z.sheetItemSubtitle,{fontFamily:x.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:d.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:S.warning},children:["$",P.minimum_deposit_amount_usd]})]})]}),B&&jsxRuntime.jsx(lt,{size:20,color:S.primary,strokeWidth:2})]},b)})})]});return jsxRuntime.jsxs(reactNative.View,{style:z.container,children:[jsxRuntime.jsxs(reactNative.View,{style:z.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.selectorLabel,{color:d.card.labelColor,fontFamily:x.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(true),style:[z.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[wt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(wt,"png"))},style:z.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[z.selectorText,{color:d.card.titleColor,fontFamily:x.medium}],children:C}),jsxRuntime.jsx(Jt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:z.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[z.selectorLabel,{color:d.card.labelColor,fontFamily:x.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[z.minDeposit,{color:S.warning,fontFamily:x.regular}],children:["($",Pe," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),style:[z.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[We&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(We,"png"))},style:z.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[z.selectorText,{color:d.card.titleColor,fontFamily:x.medium}],numberOfLines:1,children:We?.chain_name||"Select network"}),jsxRuntime.jsx(Jt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:z.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[z.qrWrapper,{backgroundColor:S.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:E?jsxRuntime.jsxs(reactNative.View,{style:z.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:S.foregroundMuted,fontFamily:x.regular}],children:"Loading..."})]}):Ie?jsxRuntime.jsx(Zi,{value:Ie,size:160,logoUri:re(xe(We,"png")||jt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:z.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:S.error,fontFamily:x.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:z.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:z.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressLabel,{color:d.card.labelColor,fontFamily:x.medium}],children:"Deposit Address"}),$&&jsxRuntime.jsxs(reactNative.View,{style:z.copiedIndicator,children:[jsxRuntime.jsx(lt,{size:14,color:S.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[z.copiedText,{color:S.success,fontFamily:x.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Ir,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!E&&Ie?ve:void 0,contentStyle:z.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressText,{color:d.card.titleColor,fontFamily:x.regular}],numberOfLines:2,children:E?"Loading...":Ie||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:z.addressCopyIcon,children:jsxRuntime.jsx(Go,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Y(!Q),style:z.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:x.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:z.chevronContainer,children:Q?jsxRuntime.jsx(fn,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),Q&&jsxRuntime.jsxs(reactNative.View,{style:z.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:x.regular}],children:["Price impact: ",$e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ne(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:x.regular}],children:["Slippage: Auto \u2022 ",ge.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ne(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:x.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ud,{depositConfirmationMode:p,depositAddress:Ie,showWaitingUi:Ut,latestExecution:ye,onIveDeposited:Ht}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:z.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[z.termsText,{color:S.primary,fontFamily:x.regular}],children:"Terms apply"})}),H(),ue(),jsxRuntime.jsxs(_t,{visible:Xe,onClose:()=>Ne(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:d.header.titleColor,fontFamily:x.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ne(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardTitle,{color:d.card.titleColor,fontFamily:x.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:d.card.titleColor,fontFamily:x.medium}],children:[$e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:d.card.descriptionColor,fontFamily:x.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:[z.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardTitle,{color:d.card.titleColor,fontFamily:x.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:d.card.titleColor,fontFamily:x.medium}],children:[ge.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:d.card.descriptionColor,fontFamily:x.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var z=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 fd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=A();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ds.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ds.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ds.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(e,"png"))},style:Ds.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ds.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ds.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ds.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(lt,{size:16,color:o.primary,strokeWidth:2})]})}var Ds=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 Ul({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=A();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Mh.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Mh.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(fd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Mh=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function gd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:u,components:p}=A(),[g,w]=qi.useState(""),m=o.map(S=>r.find(x=>x.currency_code.toLowerCase()===S.toLowerCase())).filter(S=>S!==void 0),f=r.filter(S=>!o.includes(S.currency_code.toLowerCase())),T=S=>{if(!g)return S;let x=g.toLowerCase();return S.filter(d=>d.name.toLowerCase().includes(x)||d.currency_code.toLowerCase().includes(x))},I=T(m),k=T(f),_=S=>{s(S),t(false),w("");},v=()=>{t(false),w("");};return jsxRuntime.jsxs(_t,{visible:e,onClose:v,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(to,{title:"Currency",showBack:false,onClose:v}),jsxRuntime.jsx(reactNative.View,{style:Os.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Os.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:u.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:w,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(Tt,{style:Os.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Os.listContent,children:[jsxRuntime.jsx(Ul,{title:"Popular currencies",currencies:I,selectedCurrency:n,onSelect:_}),I.length>0&&k.length>0&&jsxRuntime.jsx(reactNative.View,{style:Os.sectionSpacer}),jsxRuntime.jsx(Ul,{title:"All currencies",currencies:k,selectedCurrency:n,onSelect:_}),I.length===0&&k.length===0&&jsxRuntime.jsx(reactNative.View,{style:Os.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Os.noResultsText,{color:p.container.subtitleColor,fontFamily:u.regular}],children:"No currencies found"})})]})})]})}var Os=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 Bp(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 Cd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:u,onDepositError:p,onExecutionsChange:g,onLatestExecution:w,onShowStatusSheet:m,onSelectedTokenIconUrl:f,borderTopLeftRadius:T,borderTopRightRadius:I,sheetBorderRadius:k}){let{colors:_,fonts:v,components:S}=A(),[x,d]=qi.useState(""),[c,C]=qi.useState("usd"),[h,D]=qi.useState(false),[L,V]=qi.useState(false),[R,E]=qi.useState([]),[U,q]=qi.useState(false),[Qe,ne]=qi.useState(null),[Je,$]=qi.useState(null),[ae,Q]=qi.useState("amount"),[Y,we]=qi.useState(null),[G,ie]=qi.useState(true),[Ye,Be]=qi.useState(null),[Ze,Ge]=qi.useState(false),Ue=qi.useRef(null),Me=qi.useRef(false);qi.useEffect(()=>{Ue.current=Y;},[Y]),qi.useEffect(()=>{Me.current=Ze;},[Ze]);let[ot,De]=qi.useState([]),[Ae,ce]=qi.useState(true),[ye,ke]=qi.useState(60),[Xe,Ne]=qi.useState([]),[dt,Nt]=qi.useState([]),[_e,Re]=qi.useState(null),[Ve,at]=qi.useState(null),[Ie,be]=qi.useState(true),[Oe,Ut]=qi.useState(null),[Ht,wt]=qi.useState(false),[yt,rr]=qi.useState(null),[We,ve]=qi.useState(false),[$e,ge]=qi.useState(false),[Pe,H]=qi.useState(false),[ue,P]=qi.useState(null),b=r??ae,B=qi.useRef(null),O=Xe.find(de=>de.currency_code.toLowerCase()===c.toLowerCase()),J=qi.useCallback(de=>{Q(de),de==="quotes"?o?.(de,R.length):o?.(de);},[R.length,o]);qi.useEffect(()=>{async function de(){try{let Ee=await il();at(Ee);}catch(Ee){console.error("Error fetching user IP:",Ee);}finally{be(false);}}de();},[]),qi.useEffect(()=>{async function de(){try{let Ee=await Zo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);De(Ee.data);}catch(Ee){console.error("Error fetching wallets:",Ee),ne("Failed to load wallet addresses");}finally{ce(false);}}de();},[e,s,i,a,l,t]);let M=n||_e?.symbol.toUpperCase()||"USDC",je=_i(_e?.icon_urls,"png")||_e?.icon_url,He=_i(_e?.chain_icon_urls,"png")||_e?.chain_icon_url,[Jr,X]=qi.useState([]),[Hs,Dt]=qi.useState(new Map),[Fe]=qi.useState(()=>new Date),[Ft,tt]=qi.useState(null),[ze,Cr]=qi.useState(false),[Lt,ur]=qi.useState(null);qi.useEffect(()=>{b==="onramp"&&!Lt&&ur(new Date);},[b,Lt]);let wr=Oe?.destination_token_metadata?.chain_type||i||"ethereum",Ns=Oe?.destination_token_metadata?.chain_id||a||"",Hn=`${wr}:${Ns}`,Gl=Eo(ot,wr),ss=Gl?.address||"",Jl=Gl?.id??"";qi.useEffect(()=>{Ft&&w?.(Ft);},[Ft]),qi.useEffect(()=>{ze&&(m?.(true),Cr(false));},[ze]),qi.useEffect(()=>{f?.(je||void 0);},[je]),qi.useEffect(()=>{g?.(Jr);},[Jr]),si({depositConfirmationMode:"auto_silent",enabled:b==="onramp",depositAddress:ss,chain:Hn,externalUserId:e,publishableKey:t,modalOpenedAt:Lt??Fe,depositWalletId:Jl,depositExecutions:Jr,trackedExecutions:Hs,setDepositExecutions:X,setTrackedExecutions:Dt,setLatestExecution:tt,setShowStatusSheet:Cr,onDepositSuccess:u,onExecutionsChange:g,onDepositError:p}),qi.useEffect(()=>{async function de(){try{let Ee=await ol(t);Ne(Ee.data),Nt(Ee.preferred||[]);}catch(Ee){console.error("Error fetching fiat currencies:",Ee);}}de();},[t]),qi.useEffect(()=>{if(h||Xe.length===0||!Ve?.alpha2)return;let de=Ve.alpha2.toUpperCase(),Ee=Xe.find(fr=>fr.country_codes.includes(de));if(Ee)C(Ee.currency_code.toLowerCase()),!x&&!L&&d(String(Ee.default_amount??100));else if(!x&&!L){let fr=Xe.find(pn=>pn.currency_code.toLowerCase()==="usd");fr&&d(String(fr.default_amount??100));}},[Xe,Ve,h,x,L]),qi.useEffect(()=>{if(Xe.length!==0){if(B.current!==null&&B.current!==c){let de=Xe.find(Ee=>Ee.currency_code.toLowerCase()===c.toLowerCase());de&&d(String(de.default_amount??100));}B.current=c;}},[c,Xe]),qi.useEffect(()=>{async function de(){try{let Ee=await au({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Re(Ee);}catch(Ee){console.error("Error fetching supported tokens:",Ee);}}de();},[i,a,l,t]),qi.useEffect(()=>{async function de(){if(!(!l||!a||!i)&&!Ie){wt(true);try{let Ee=await du({country_code:Ve?.alpha2?.toUpperCase()||"US",subdivision_code:Ve?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Ut(Ee);}catch(Ee){console.error("Error fetching default onramp token:",Ee);}finally{wt(false);}}}de();},[l,a,i,Ve,Ie,t]),qi.useEffect(()=>{let de=parseFloat(x);if(isNaN(de)||de<=0){E([]),$(null);return}if(!Oe||Ht){E([]),we(null);return}let Ee=Xe.find(pn=>pn.currency_code.toLowerCase()===c.toLowerCase());if(Ee){if(de<Ee.minimum_amount){E([]),we(null),$(`Minimum amount is ${Bp(c)}${Ee.minimum_amount.toLocaleString()}`);return}if(de>Ee.maximum_amount){E([]),we(null),$(`Maximum amount is ${Bp(c)}${Ee.maximum_amount.toLocaleString()}`);return}}$(null);let fr=setTimeout(()=>{as(de);},500);return ()=>clearTimeout(fr)},[x,c,t,Oe,Ht,Xe]);let as=async de=>{if(!Oe){ne("Loading token information...");return}q(true),ne(null);try{let Ee={country_code:Ve?.alpha2?.toUpperCase()||"US",source_amount:de.toString(),source_currency:c.toLowerCase(),destination_currency:Oe.destination_currency,destination_network:Oe.destination_network,subdivision_code:Ve?.state||void 0},fr=await lu(Ee,t);E(fr.data);let pn=Me.current,Xl=Ue.current;if(pn&&Xl){let ki=fr.data.find(F=>F.service_provider===Xl.service_provider);if(ki){if(we(ki),fr.data.length>0){let F=fr.data[0];Ye||Be(F.service_provider),ie(ki.service_provider===Ye);}}else if(fr.data.length>0){let F=fr.data[0];we(F),Be(F.service_provider),ie(!0),Ge(!1);}}else if(fr.data.length>0){let ki=fr.data[0];we(ki),Be(ki.service_provider),ie(!0);}ke(60);}catch(Ee){console.error("Failed to fetch quotes:",Ee),ne("Failed to fetch quotes. Please try again."),E([]);}finally{q(false);}};qi.useEffect(()=>{if(R.length===0)return;let de=setInterval(()=>{ke(Ee=>{if(Ee<=1){let fr=parseFloat(x);return !isNaN(fr)&&fr>0&&as(fr),60}return Ee-1});},1e3);return ()=>clearInterval(de)},[R.length,x]);let Zl=de=>{(/^\d*\.?\d{0,2}$/.test(de)||de==="")&&(d(de),V(true));},$s=de=>{d(de.toString()),V(true);},Qd=async()=>{if(Y&&Oe)try{let de=Oe.destination_token_metadata.chain_type,Ee=Eo(ot,de);if(!Ee?.address){ne("Wallet address not available");return}let fr={service_provider:Y.service_provider,country_code:Y.country_code?.toUpperCase()||Ve?.alpha2?.toUpperCase()||"US",source_currency:Y.source_currency,source_amount:x,destination_currency:Y.destination_currency,destination_network:Y.destination_network,wallet_address:Ee.address,subdivision_code:Ve?.state||void 0},pn=await cu(fr,t);rr({provider:Y,sourceCurrency:c,sourceAmount:x,sessionUrl:pn.url}),P(pn.url),H(!0);}catch(de){console.error("Failed to create session:",de),ne("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:de});}},Ti=Bp(c),ja=()=>{H(false),J("onramp"),u?.({message:"Payment flow completed"});},Yd=()=>jsxRuntime.jsx(gw,{visible:Pe,onClose:ja,url:ue,providerName:Y?.service_provider_display_name||"Complete Payment",colors:_,fonts:v,borderTopLeftRadius:k?.webView?.borderTopLeftRadius??T,borderTopRightRadius:k?.webView?.borderTopRightRadius??I});return b==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:te.amountViewContainer,children:[jsxRuntime.jsxs(Tt,{style:te.scrollContainer,contentContainerStyle:te.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:te.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ve(true),style:[te.currencyButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.input.borderRadius,borderWidth:S.input.borderWidth,borderColor:S.input.borderColor}],children:[O&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(O,"png"))},style:te.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[te.currencyText,{color:S.card.titleColor,fontFamily:v.medium}],children:c.toUpperCase()}),jsxRuntime.jsx(Jt,{size:16,color:S.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(gd,{open:We,onOpenChange:ve,currencies:Xe,preferredCurrencyCodes:dt,selectedCurrency:c,onSelectCurrency:de=>{C(de.toLowerCase()),D(true);},borderTopLeftRadius:k?.currencyModal?.borderTopLeftRadius??T,borderTopRightRadius:k?.currencyModal?.borderTopRightRadius??I}),jsxRuntime.jsx(reactNative.View,{style:te.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:te.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.currencySymbol,{color:S.container.titleColor,fontFamily:v.medium}],children:Ti}),jsxRuntime.jsx(reactNative.TextInput,{style:[te.amountInput,{color:S.container.titleColor,fontFamily:v.medium}],value:x,onChangeText:Zl,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:_.foregroundMuted})]})}),O?.suggested_amounts&&O.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:te.quickAmounts,children:O.suggested_amounts.map(de=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>$s(de),style:[te.quickAmountButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.button.borderRadius,borderWidth:parseFloat(x)===de?2:S.button.borderWidth,borderColor:parseFloat(x)===de?_.primary:S.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[te.quickAmountText,{color:S.card.titleColor,fontFamily:v.medium}],children:[Ti,de.toLocaleString()]})},de))}),Je&&jsxRuntime.jsx(reactNative.Text,{style:[te.validationError,{color:_.error,fontFamily:v.regular}],children:Je}),jsxRuntime.jsxs(reactNative.View,{style:te.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:te.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.providerLabel,{color:S.card.labelColor,fontFamily:v.medium}],children:"Provider"}),R.length>0&&!U&&jsxRuntime.jsxs(reactNative.Text,{style:[te.refreshText,{color:S.card.labelRightColor,fontFamily:v.regular}],children:["Refreshing in ",ye,"s"]})]}),jsxRuntime.jsx(Ir,{cardTokens:S.depositCard.quoteProvider.card,onPress:U||R.length===0?void 0:()=>ge(true),contentStyle:reactNative.StyleSheet.flatten([te.providerButton,(U||R.length===0)&&te.disabled]),children:U?jsxRuntime.jsxs(reactNative.View,{style:te.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[te.loadingText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"Finding best rates..."})]}):Y?jsxRuntime.jsxs(reactNative.View,{style:te.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:te.providerInfo,children:[G&&jsxRuntime.jsx(reactNative.Text,{style:[te.autoPickedText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:te.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(uc(Y.icon_urls,"png",Y.icon_url))},style:te.providerIconImage},`provider-${Y.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[te.providerName,{color:S.card.titleColor,fontFamily:v.medium}],children:Y.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[te.bestPriceText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:[Y.destination_amount.toFixed(2)," ",M]})]})]})]}),jsxRuntime.jsx(Hr,{size:20,color:S.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[te.noProviderText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:parseFloat(x)>0?"No providers available":"Enter an amount to see providers"})}),Qe&&jsxRuntime.jsx(reactNative.Text,{style:[te.errorText,{color:_.error,fontFamily:v.regular}],children:Qe})]}),jsxRuntime.jsxs(_t,{visible:$e,onClose:()=>ge(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:k?.providerModal?.borderTopLeftRadius??T,borderTopRightRadius:k?.providerModal?.borderTopRightRadius??I,children:[jsxRuntime.jsx(to,{title:"Select Provider",showBack:false,onClose:()=>ge(false)}),jsxRuntime.jsx(Tt,{style:te.providerModalList,contentContainerStyle:te.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:te.quotesList,children:R.map(de=>{let Ee=Y?.service_provider===de.service_provider;return jsxRuntime.jsxs(Ir,{cardTokens:S.depositCard.quoteProvider.card,onPress:()=>{we(de),Ge(true),ie(de.service_provider===Ye),ge(false);},contentStyle:reactNative.StyleSheet.flatten([te.quoteItem,Ee&&{borderWidth:2,borderColor:_.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:te.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(uc(de.icon_urls,"png",de.icon_url))},style:te.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[te.quoteName,{color:S.card.titleColor,fontFamily:v.medium}],children:de.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:te.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[te.quoteAmount,{color:S.card.textRightColor,fontFamily:v.medium}],children:[de.destination_amount.toFixed(2)," ",M]}),jsxRuntime.jsxs(reactNative.Text,{style:[te.quoteSource,{color:S.card.subtextRightColor,fontFamily:v.regular}],children:["Fee: ",Ti,de.total_fee.toFixed(2)]})]})]},de.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.continueButtonContainer,{backgroundColor:_.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:U||Ae||!Y||parseFloat(x)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Qd,disabled:U||Ae||!Y||parseFloat(x)<=0,style:[te.continueButton,{backgroundColor:S.container.buttonColor,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[te.continueButtonText,{color:S.container.buttonTitleColor,fontFamily:v.medium}],children:Ae?"Loading...":"Continue"})})})})]}),Yd()]}):b==="onramp"&&yt?jsxRuntime.jsxs(reactNative.View,{style:te.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(uc(yt.provider.icon_urls,"png",yt.provider.icon_url))},style:te.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[te.onrampTitle,{color:S.container.titleColor,fontFamily:v.medium}],children:["Complete transaction with ",yt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[te.onrampSubtitle,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[te.flowDiagram,{backgroundColor:S.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:te.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:jt(`/icons/currencies/png/${yt.sourceCurrency.toLowerCase()}.png`)},style:te.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:yt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Hr,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:te.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:te.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:_i(Oe?.destination_token_metadata?.icon_urls,"png")||Oe?.destination_token_metadata?.icon_url||jt("/icons/tokens/png/usdc.png")},style:te.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:_i(Oe?.destination_token_metadata?.chain?.icon_urls,"png")||Oe?.destination_token_metadata?.chain?.icon_url||jt("/icons/networks/png/polygon.png")},style:[te.flowNetworkBadge,{borderColor:_.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:"USDC"})]}),jsxRuntime.jsx(Hr,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:te.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:te.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:je||jt("/icons/tokens/png/usdc.png")},style:te.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:He||jt("/icons/networks/png/polygon.png")},style:[te.flowNetworkBadge,{borderColor:_.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:M})]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.onrampInfoBox,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[te.onrampInfoText,{color:S.card.descriptionColor,fontFamily:v.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function gw({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Ls.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ls.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(lt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ls.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Ls.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Ls.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Ls.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Ls.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Ls=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"}}),te=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 ww(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 Td({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=re(xe(e.destination_token_metadata,"png")||jt("/icons/tokens/png/usdc.png")),u=i?"Deposit Processing":"Deposit Completed",p=ww(e.created_at||new Date().toISOString()),g=Sw(e.source_amount_usd);return jsxRuntime.jsxs(Ir,{cardTokens:s,onPress:t,contentStyle:ui.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ui.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:ui.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ui.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(Ys,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ui.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ui.title,{color:s.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[ui.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:ui.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ui.amount,{color:s.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(Hr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var ui=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 Nh(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 $h(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 kw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var jh=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function qh(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}=A(),o=qi.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Bs.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Bs.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Bs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var Bs=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 Ep({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=A(),[l,u]=qi.useState(r),[p,g]=qi.useState(false),[w,m]=qi.useState(null),[f,T]=qi.useState(false),I=qi.useRef(null);qi.useEffect(()=>{if(!e||!o)return;let c=async()=>{g(true);try{let D=[...(await Xo(o,n,"deposit")).data].sort((L,V)=>{let R=L.created_at?new Date(L.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-R});u(D);}catch(h){console.error("Failed to fetch executions:",h),u(r);}finally{g(false);}};c();let C=setInterval(c,1e4);return ()=>clearInterval(C)},[e,o,n,r]),qi.useEffect(()=>{r.length>0&&u(c=>{let C=new Set(c.map(D=>D.id)),h=r.filter(D=>!C.has(D.id));return h.length>0?[...h,...c]:c});},[r]),qi.useEffect(()=>{e||m(null);},[e]);let k=c=>{m(c);},_=()=>{m(null),T(false);},v=()=>{m(null),t();},S=()=>{if(!w)return null;let c=w,C=c.status==="pending"||c.status==="waiting"||c.status==="delayed",h=c.status==="succeeded",D=re(xe(c.destination_token_metadata,"png")||jt("/icons/tokens/png/usdc.png")),L=c.provider_metadata?.details,V=L?.currencyIn,R=L?.currencyOut;V?.currency?.symbol||"USDC";R?.currency?.symbol||"USDC";let q=$h(c.source_amount_base_unit,c.source_token_metadata?.decimals),Qe=$h(c.destination_amount_base_unit,c.destination_token_metadata?.decimals),ne=kw(c.source_amount_usd),Je=Nh(c.source_chain_type,c.source_chain_id),$=Nh(c.destination_chain_type,c.destination_chain_id),ae=()=>{c.explorer_url&&reactNative.Linking.openURL(c.explorer_url);},Q=()=>{c.destination_explorer_url&&reactNative.Linking.openURL(c.destination_explorer_url);};return jsxRuntime.jsxs(Tt,{ref:I,style:Le.scrollContainer,contentContainerStyle:Le.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Le.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Le.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:D},style:Le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Le.statusBadge,{backgroundColor:C?s.warning:s.success,borderColor:s.background}],children:C?jsxRuntime.jsx(Jt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(lt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Le.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Le.statusDot,{backgroundColor:C?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Le.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Le.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:xw(c.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[Le.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[q," ",qh(c.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Qe," ",qh(c.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ne})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Je})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:$})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Y=!f;T(Y),Y?setTimeout(()=>{I.current?.scrollToEnd({animated:true});},100):I.current?.scrollTo({y:0,animated:true});},style:Le.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(fn,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:[Le.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[c.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ae,style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:jh(c.transaction_hash)}),jsxRuntime.jsx(mn,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]})]}),c.destination_explorer_url&&h&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Q,style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:jh(c.destination_transaction_hashes[0])}),jsxRuntime.jsx(mn,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},x=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(to,{title:w?"Deposit Details":"Deposit Tracker",onClose:v,showClose:!w,showBack:!!w,onBack:_}),w?S():x?jsxRuntime.jsx(Rw,{}):jsxRuntime.jsx(Tt,{style:Le.scrollContainer,contentContainerStyle:Le.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:Le.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:Le.executionsList,children:l.map(c=>jsxRuntime.jsx(Td,{execution:c,onPress:()=>k(c)},c.id))})})]})}var Le=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 Hl(e,t=true){let[r,o]=qi.useState(null),[n,s]=qi.useState(null),[i,a]=qi.useState(false),[l,u]=qi.useState(false),[p,g]=qi.useState(null),[w,m]=qi.useState(null);qi.useEffect(()=>{!t||r||(a(true),il().then(k=>{o(k),g(null);}).catch(k=>{g(k instanceof Error?k:new Error(String(k)));}).finally(()=>{a(false);}));},[t,r]),qi.useEffect(()=>{!t||!e||n||(u(true),nl(e).then(k=>{s(k),m(null);}).catch(k=>{m(k instanceof Error?k:new Error(String(k)));}).finally(()=>{u(false);}));},[t,e,n]);let f=i||l,T=p||w||null,I=null;if(r&&n){let k=n.blocked_country_codes||[],_=r.alpha2.toUpperCase();I=!k.some(v=>v.toUpperCase()===_);}return {isAllowed:I,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:T}}var Up="unifold_recent_tokens",Fw=5,Zh=[{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 Id(){try{let e=await Mu__default.default.getItem(Up);return e?JSON.parse(e):[]}catch{return []}}async function Vw(e){try{let r=(await Id()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Fw);await Mu__default.default.setItem(Up,JSON.stringify(o));}catch{}}async function Dw(e){try{let r=(await Id()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Mu__default.default.setItem(Up,JSON.stringify(r)),r}catch{return []}}function Hp({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:u,heightPercent:p=.9,showHandle:g=true}){let{colors:w,fonts:m,components:f}=A(),[T,I]=qi.useState(""),[k,_]=qi.useState([]);qi.useEffect(()=>{e&&Id().then(_);},[e]),qi.useEffect(()=>{e||I("");},[e]);let v=qi.useMemo(()=>{let h=[];return r.forEach(D=>{D.chains.forEach(L=>{h.push({token:D,chain:L});});}),h},[r]),S=qi.useMemo(()=>{let h=[],D=new Set,L=(V,R,E,U)=>{let q=`${V}-${R}:${E}`;if(D.has(q))return;let Qe=r.find(Je=>Je.symbol===V);if(!Qe)return;let ne=Qe.chains.find(Je=>Je.chain_type===R&&Je.chain_id===E);ne&&(D.add(q),h.push({token:Qe,chain:ne,isRecent:U}));};return k.forEach(V=>{L(V.symbol,V.chainType,V.chainId,true);}),Zh.forEach(V=>{L(V.symbol,V.chainType,V.chainId,false);}),h},[r,k]),x=qi.useMemo(()=>{if(!T.trim())return v;let h=T.toLowerCase();return v.filter(({token:D,chain:L})=>D.symbol.toLowerCase().includes(h)||D.name.toLowerCase().includes(h)||L.chain_name.toLowerCase().includes(h))},[v,T]),d=(h,D,L)=>Zh.some(V=>V.symbol===h&&V.chainType===D&&V.chainId===L),c=async(h,D)=>{let L=`${D.chain_type}:${D.chain_id}`;if(!d(h.symbol,D.chain_type,D.chain_id)){await Vw({symbol:h.symbol,chainType:D.chain_type,chainId:D.chain_id});let V=await Id();_(V);}I(""),s(h.symbol,L),t();},C=async(h,D)=>{let L=await Dw({symbol:h.symbol,chainType:D.chain_type,chainId:D.chain_id});_(L);};return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:g,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:u,children:[jsxRuntime.jsxs(reactNative.View,{style:[zt.header,!g&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:zt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[zt.headerTitle,{color:f.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:zt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(ht,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:zt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[zt.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:m.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:T,onChangeText:I,autoCapitalize:"none",autoCorrect:false})}),!l&&S.length>0&&!T&&jsxRuntime.jsxs(reactNative.View,{style:zt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:zt.quickSelectScroll,children:S.map(({token:h,chain:D,isRecent:L})=>{let V=`${D.chain_type}:${D.chain_id}`;h.symbol===o&&V===n;return jsxRuntime.jsxs(reactNative.View,{children:[L&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>C(h,D),style:zt.removeButton,children:jsxRuntime.jsx(ht,{size:12,color:w.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>c(h,D),activeOpacity:.7,style:[zt.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:zt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(h,"png"))},style:zt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(D,"png"))},style:[zt.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:zt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[zt.quickSelectSymbol,{color:f.card.titleColor,fontFamily:m.medium}],children:h.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[zt.quickSelectChain,{color:f.card.subtitleColor,fontFamily:m.regular}],children:D.chain_name})]})]})]},`quick-${h.symbol}-${V}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Tt,{style:zt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:zt.tokenListContent,children:x.length===0?jsxRuntime.jsx(reactNative.View,{style:zt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[zt.emptyText,{color:w.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):x.map(({token:h,chain:D})=>{let L=`${D.chain_type}:${D.chain_id}`,V=h.symbol===o&&L===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>c(h,D),activeOpacity:.7,style:[zt.tokenItem,{backgroundColor:V?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:zt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(h,"png"))},style:zt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(D,"png"))},style:[zt.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:zt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[zt.tokenSymbol,{color:f.card.titleColor,fontFamily:m.medium}],children:h.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[zt.tokenChainName,{color:f.card.subtitleColor,fontFamily:m.regular}],children:D.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[zt.minDeposit,{color:f.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",D.minimum_deposit_amount_usd]})]})]},`${h.symbol}-${L}`)})})]})}var zt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Nl=(e,t)=>`${t}:${e}`,Ww=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Np({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:w,onDepositError:m,onLatestExecution:f,onShowStatusSheet:T,onSelectedTokenIconUrl:I,wallets:k,borderTopLeftRadius:_,borderTopRightRadius:v,sheetBorderRadius:S}){let{colors:x,fonts:d,components:c}=A(),C=a&&l?`${a}:${l}`:"solana:mainnet",[h,D]=qi.useState("USDC"),[L,V]=qi.useState(C),[R,E]=qi.useState([]),[U,q]=qi.useState(!k?.length),Qe=k?.length?k:R,[ne,Je]=qi.useState([]),[$,ae]=qi.useState(true),[Q,Y]=qi.useState(false),[we,G]=qi.useState(false),[ie,Ye]=qi.useState(false),[Be,Ze]=qi.useState([]),[Ge,Ue]=qi.useState(new Map),[Me]=qi.useState(()=>new Date),[ot,De]=qi.useState(null),[Ae,ce]=qi.useState(false),[ye,ke]=qi.useState(null),[Xe,Ne]=qi.useState(false);qi.useEffect(()=>{ye&&f?.(ye);},[ye]),qi.useEffect(()=>{Ae&&(T?.(true),ce(false));},[Ae]);let dt=new Map;ne.forEach(H=>{H.chains.forEach(ue=>{let P=`${ue.chain_type}:${ue.chain_id}`;dt.has(P)||dt.set(P,ue);});});let Nt=Array.from(dt.values()),_e=Ww(L),Re=Nt.find(H=>H.chain_type===_e.chainType&&H.chain_id===_e.chainId),Ve=Re?.chain_type||"ethereum",at=Eo(Qe,Ve),Ie=at?.address||"",be=qi.useRef(false);qi.useEffect(()=>{async function H(){try{ae(!0),De(null);let P=await qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Je(P.data),P.data.length>0&&!be.current){be.current=!0;let b,B;if(a&&l)if(u)for(let O of P.data){let J=O.chains.find(M=>M.chain_type===a&&M.chain_id===l&&M.token_address.toLowerCase()===u.toLowerCase());if(J){b=O,B=J;break}}else {let O=M=>M.chain_type===a&&M.chain_id===l,J=P.data.find(M=>M.symbol==="USDC"&&M.chains.some(O));if(J)b=J,B=J.chains.find(O);else for(let M of P.data){let je=M.chains.find(O);if(je){b=M,B=je;break}}}if(!b&&s)for(let O of P.data){let J=O.chains.find(M=>M.token_address.toLowerCase()===s.toLowerCase());if(J){b=O,B=J;break}}b||(b=P.data.find(O=>O.symbol==="USDC"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=P.data.find(O=>O.symbol==="USDT"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=P.data[0],b.chains.length>0&&(B=b.chains[0])),b&&D(b.symbol),B&&V(Nl(B.chain_id,B.chain_type));}}catch(ue){console.error("Error fetching supported tokens:",ue),De("Failed to load supported tokens"),m?.({message:"Failed to load supported tokens",error:ue});}finally{ae(false);}}H();},[t,s,n,o,a,l,u,m]),qi.useEffect(()=>{g&&g(Be);},[Be,g]),qi.useEffect(()=>{if(k?.length){q(false);return}if(R.length>0){q(false);return}let H=null,ue=false,P=async()=>{if(!ue){q(true);try{let b=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);ue||(E(b.data),De(null),q(!1));}catch(b){console.error("Error fetching wallets, retrying in 5s:",b),ue||(De(b instanceof Error?b.message:"Failed to load wallets"),q(false),H=setTimeout(P,5e3));}}};return P(),()=>{ue=true,H&&clearTimeout(H);}},[e,r,o,n,s,t,k,R.length]);let Oe=at?.id??"",{showWaitingUi:Ut,handleIveDeposited:Ht}=si({depositConfirmationMode:p,depositAddress:Ie,chain:L,externalUserId:e,publishableKey:t,modalOpenedAt:Me,depositWalletId:Oe,depositExecutions:Be,trackedExecutions:Ge,setDepositExecutions:Ze,setTrackedExecutions:Ue,setLatestExecution:ke,setShowStatusSheet:ce,onDepositSuccess:w,onExecutionsChange:g,onDepositError:m});qi.useEffect(()=>{if(!ne.length)return;let H=ne.find(P=>P.symbol===h);if(!H||H.chains.length===0){let P=ne.find(b=>b.symbol==="USDC")||ne[0];P&&(D(P.symbol),P.chains.length>0&&V(Nl(P.chains[0].chain_id,P.chains[0].chain_type)));return}if(!H.chains.some(P=>Nl(P.chain_id,P.chain_type)===L)){let P=H.chains[0];V(Nl(P.chain_id,P.chain_type));}},[h,ne,L]);let wt=ne.find(H=>H.symbol===h),yt=xe(wt,"png")||void 0;qi.useEffect(()=>{I?.(yt);},[yt]);let We=(wt?.chains||[]).find(H=>Nl(H.chain_id,H.chain_type)===L),ve=async()=>{if(Ie)try{reactNative.Clipboard.setString(Ie),Y(!0),setTimeout(()=>Y(!1),2e3);}catch(H){console.error("Failed to copy:",H);}},$e=We?.estimated_price_impact_percent??0,ge=We?.max_slippage_percent??.25,Pe=We?.minimum_deposit_amount_usd??3;return $?jsxRuntime.jsxs(reactNative.View,{style:ee.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:x.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ee.loadingText,{color:x.foregroundMuted,fontFamily:d.regular}],children:"Loading currencies..."})]}):ot&&ne.length===0?jsxRuntime.jsxs(reactNative.View,{style:ee.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.errorText,{color:x.error,fontFamily:d.regular}],children:ot}),jsxRuntime.jsx(reactNative.Text,{style:[ee.errorHint,{color:x.foregroundMuted,fontFamily:d.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ee.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.selectorLabel,{color:c.card.labelColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),disabled:$||ne.length===0,style:[ee.tokenSelectorButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],activeOpacity:.7,children:$?jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.loadingIcon,{backgroundColor:x.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.loadingLine,{backgroundColor:x.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[ee.loadingLine,{backgroundColor:x.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ee.tokenIconWrapper,children:[wt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(wt,"png"))},style:ee.tokenMainIcon}),(We||Re)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(We||Re,"png"))},style:[ee.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSelectorSymbol,{color:c.card.titleColor,fontFamily:d.semibold}],children:wt?.symbol||h}),jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSelectorNetwork,{color:c.card.subtitleColor,fontFamily:d.regular}],numberOfLines:1,children:We?.chain_name||Re?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ee.minDepositText,{color:x.warning,fontFamily:d.medium}],children:["$",Pe," minimum"]}),jsxRuntime.jsx(Hr,{size:16,color:c.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Hp,{visible:ie,onClose:()=>Ye(false),tokens:ne,selectedToken:h,selectedChainKey:L,onSelect:(H,ue)=>{D(H),V(ue);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??_,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:ee.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ee.qrWrapper,{backgroundColor:x.background,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth>0?c.card.borderWidth:1,borderColor:c.card.borderColor}],children:U?jsxRuntime.jsxs(reactNative.View,{style:ee.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ee.loadingText,{color:x.foregroundMuted,fontFamily:d.regular}],children:"Loading..."})]}):Ie?jsxRuntime.jsx(Zi,{value:Ie,size:180,logoUri:re(xe(We,"png")||jt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:ee.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ee.errorText,{color:x.error,fontFamily:d.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:ee.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.addressLabel,{color:c.card.labelColor,fontFamily:d.medium}],children:"Deposit Address"}),Q&&jsxRuntime.jsxs(reactNative.View,{style:ee.copiedIndicator,children:[jsxRuntime.jsx(lt,{size:14,color:x.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ee.copiedText,{color:x.success,fontFamily:d.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Ir,{cardTokens:c.transferCrypto.depositAddress.card,onPress:!U&&Ie?ve:void 0,contentStyle:ee.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.addressText,{color:c.card.titleColor,fontFamily:d.regular}],numberOfLines:2,children:U?"Loading...":Ie||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:ee.addressCopyIcon,children:jsxRuntime.jsx(Go,{size:16,color:c.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ee.detailsCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(!we),style:ee.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ee.chevronContainer,children:we?jsxRuntime.jsx(fn,{size:16,color:c.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:16,color:c.card.actionColor,strokeWidth:2})})]}),we&&jsxRuntime.jsxs(reactNative.View,{style:ee.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:["Price impact: ",$e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ne(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:["Slippage: Auto \u2022 ",ge.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ne(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ud,{depositConfirmationMode:p,depositAddress:Ie,showWaitingUi:Ut,latestExecution:ye,onIveDeposited:Ht}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:ee.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[ee.termsText,{color:x.primary,fontFamily:d.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(_t,{visible:Xe,onClose:()=>Ne(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??_,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[ee.sheetHeader,{borderBottomColor:x.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ee.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ee.sheetTitle,{color:c.header.titleColor,fontFamily:d.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ne(false),style:ee.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ee.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardTitle,{color:c.card.titleColor,fontFamily:d.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.infoCardValue,{color:c.card.titleColor,fontFamily:d.medium}],children:[$e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardDescription,{color:c.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:[ee.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardTitle,{color:c.card.titleColor,fontFamily:d.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.infoCardValue,{color:c.card.titleColor,fontFamily:d.medium}],children:[ge.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardDescription,{color:c.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."})]})]})]})]})}var ee=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Ea=(e,t)=>`${t}:${e}`,Hw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},Nw=e=>e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`;function Fd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:w,onDepositError:m,onLatestExecution:f,onShowStatusSheet:T,onSelectedTokenIconUrl:I,onShowInfoSheet:k,onInfoSheetData:_,wallets:v,borderTopLeftRadius:S,borderTopRightRadius:x,sheetBorderRadius:d}){let{colors:c,fonts:C,components:h}=A(),D=a&&l?`${a}:${l}`:"solana:mainnet",[L,V]=qi.useState("USDC"),[R,E]=qi.useState(D),[U,q]=qi.useState([]),[Qe,ne]=qi.useState(!v?.length),Je=v?.length?v:U,[$,ae]=qi.useState([]),[Q,Y]=qi.useState(true),[we,G]=qi.useState(false),[ie,Ye]=qi.useState(false),[Be,Ze]=qi.useState(false),[Ge,Ue]=qi.useState([]),[Me,ot]=qi.useState(new Map),[De]=qi.useState(()=>new Date),[Ae,ce]=qi.useState(null),[ye,ke]=qi.useState(false),[Xe,Ne]=qi.useState(null),[dt,Nt]=qi.useState(false),[_e,Re]=qi.useState(false),[Ve,at]=qi.useState(""),[Ie,be]=qi.useState(""),Oe=qi.useRef(new reactNative.Animated.Value(0)).current;qi.useEffect(()=>{let Fe=reactNative.Animated.loop(reactNative.Animated.timing(Oe,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Fe.start(),()=>Fe.stop()},[Oe]);let Ut=Oe.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});qi.useEffect(()=>{Xe&&f?.(Xe);},[Xe]),qi.useEffect(()=>{ye&&(T?.(true),ke(false));},[ye]);let Ht=new Map;$.forEach(Fe=>{Fe.chains.forEach(Ft=>{let tt=`${Ft.chain_type}:${Ft.chain_id}`;Ht.has(tt)||Ht.set(tt,Ft);});});let wt=Array.from(Ht.values()),yt=Hw(R),rr=wt.find(Fe=>Fe.chain_type===yt.chainType&&Fe.chain_id===yt.chainId),We=rr?.chain_type||"ethereum",ve=Eo(Je,We),$e=ve?.address||"",ge=qi.useRef(false);qi.useEffect(()=>{async function Fe(){try{Y(!0),ce(null);let tt=await qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(ae(tt.data),tt.data.length>0&&!ge.current){ge.current=!0;let ze,Cr;if(a&&l)if(u)for(let Lt of tt.data){let ur=Lt.chains.find(wr=>wr.chain_type===a&&wr.chain_id===l&&wr.token_address.toLowerCase()===u.toLowerCase());if(ur){ze=Lt,Cr=ur;break}}else {let Lt=wr=>wr.chain_type===a&&wr.chain_id===l,ur=tt.data.find(wr=>wr.symbol==="USDC"&&wr.chains.some(Lt));if(ur)ze=ur,Cr=ur.chains.find(Lt);else for(let wr of tt.data){let Ns=wr.chains.find(Lt);if(Ns){ze=wr,Cr=Ns;break}}}if(!ze&&s)for(let Lt of tt.data){let ur=Lt.chains.find(wr=>wr.token_address.toLowerCase()===s.toLowerCase());if(ur){ze=Lt,Cr=ur;break}}if(ze||(ze=tt.data.find(Lt=>Lt.symbol==="USDC"),ze&&ze.chains.length>0&&(Cr=ze.chains[0])),ze||(ze=tt.data.find(Lt=>Lt.symbol==="USDT"),ze&&ze.chains.length>0&&(Cr=ze.chains[0])),ze||(ze=tt.data[0],ze.chains.length>0&&(Cr=ze.chains[0])),ze&&Cr&&ze.symbol!=="USDC"&&ze.symbol.startsWith("USDC")){let Lt=tt.data.find(ur=>ur.symbol==="USDC"&&ur.chains.some(wr=>wr.chain_type===Cr.chain_type&&wr.chain_id===Cr.chain_id));Lt&&(ze=Lt,Cr=Lt.chains.find(ur=>ur.chain_type===Cr.chain_type&&ur.chain_id===Cr.chain_id));}ze&&V(ze.symbol),Cr&&E(Ea(Cr.chain_id,Cr.chain_type));}}catch(Ft){console.error("Error fetching supported tokens:",Ft),ce("Failed to load supported tokens"),m?.({message:"Failed to load supported tokens",error:Ft});}finally{Y(false);}}Fe();},[t,s,n,o,a,l,u,m]),qi.useEffect(()=>{g&&g(Ge);},[Ge,g]),qi.useEffect(()=>{if(v?.length){ne(false);return}if(U.length>0){ne(false);return}let Fe=null,Ft=false,tt=async()=>{if(!Ft){ne(true);try{let ze=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Ft||(q(ze.data),ce(null),ne(!1));}catch(ze){console.error("Error fetching wallets, retrying in 5s:",ze),Ft||(ce(ze instanceof Error?ze.message:"Failed to load wallets"),ne(false),Fe=setTimeout(tt,5e3));}}};return tt(),()=>{Ft=true,Fe&&clearTimeout(Fe);}},[e,r,o,n,s,t,v,U.length]);let Pe=ve?.id??"",{showWaitingUi:H,handleIveDeposited:ue}=si({depositConfirmationMode:p,depositAddress:$e,chain:R,externalUserId:e,publishableKey:t,modalOpenedAt:De,depositWalletId:Pe,depositExecutions:Ge,trackedExecutions:Me,setDepositExecutions:Ue,setTrackedExecutions:ot,setLatestExecution:Ne,setShowStatusSheet:ke,onDepositSuccess:w,onExecutionsChange:g,onDepositError:m}),P=p==="manual"&&$e&&!H;qi.useEffect(()=>{if(!$.length)return;let Fe=$.find(tt=>tt.symbol===L);if(!Fe||Fe.chains.length===0){let tt=$.find(ze=>ze.symbol==="USDC")||$[0];tt&&(V(tt.symbol),tt.chains.length>0&&E(Ea(tt.chains[0].chain_id,tt.chains[0].chain_type)));return}if(!Fe.chains.some(tt=>Ea(tt.chain_id,tt.chain_type)===R)){let tt=Fe.chains[0];E(Ea(tt.chain_id,tt.chain_type));}},[L,$,R]);let b=$.find(Fe=>Fe.symbol===L),B=xe(b,"png")||void 0;qi.useEffect(()=>{I?.(B);},[B]);let O=b?.chains||[],J=O.find(Fe=>Ea(Fe.chain_id,Fe.chain_type)===R),M=async()=>{if($e)try{reactNative.Clipboard.setString($e),G(!0),setTimeout(()=>G(!1),2e3);}catch(Fe){console.error("Failed to copy:",Fe);}},je=J?.estimated_price_impact_percent??0,He=J?.max_slippage_percent??.25,Jr=J?.minimum_deposit_amount_usd??3,X=J?.chain_name||rr?.chain_name||"Network",Hs=qi.useMemo(()=>{if(!Ve.trim())return O;let Fe=Ve.toLowerCase();return O.filter(Ft=>Ft.chain_name.toLowerCase().includes(Fe))},[O,Ve]),Dt=qi.useMemo(()=>{if(!Ie.trim())return $;let Fe=Ie.toLowerCase();return $.filter(Ft=>Ft.symbol.toLowerCase().includes(Fe)||Ft.name?.toLowerCase().includes(Fe)||Ft.chains.some(tt=>tt.chain_name.toLowerCase().includes(Fe)))},[$,Ie]);return Q?jsxRuntime.jsxs(reactNative.View,{style:oe.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[oe.loadingText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Loading currencies..."})]}):Ae&&$.length===0?jsxRuntime.jsxs(reactNative.View,{style:oe.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.errorText,{color:c.error,fontFamily:C.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[oe.errorHint,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:oe.container,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.content,children:[jsxRuntime.jsx(reactNative.View,{style:oe.qrSection,children:jsxRuntime.jsx(reactNative.View,{style:[oe.qrCard,{backgroundColor:c.background,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth>0?h.card.borderWidth:1,borderColor:h.card.borderColor}],children:Qe?jsxRuntime.jsxs(reactNative.View,{style:oe.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[oe.loadingText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Loading..."})]}):$e?jsxRuntime.jsx(reactNative.View,{style:oe.qrWrapper,children:jsxRuntime.jsx(Zi,{value:$e,size:200,logoUri:re(xe(b,"png")||jt("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:re(xe(J,"png")||jt("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:oe.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.errorText,{color:c.error,fontFamily:C.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:oe.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{at(""),Re(true);},style:[oe.selectorPill,{backgroundColor:h.card.backgroundColor,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth,borderColor:h.card.borderColor}],activeOpacity:.7,children:[(J||rr)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(J||rr,"png"))},style:oe.selectorPillIcon}),jsxRuntime.jsx(Jt,{size:14,color:h.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{be(""),Ze(true);},disabled:Q||$.length===0,style:[oe.selectorPill,{backgroundColor:h.card.backgroundColor,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth,borderColor:h.card.borderColor}],activeOpacity:.7,children:[b&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(b,"png"))},style:oe.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[oe.selectorPillText,{color:h.card.titleColor,fontFamily:C.semibold}],children:b?.symbol||L}),jsxRuntime.jsx(Jt,{size:14,color:h.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:oe.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:M,style:[oe.addressPill,{backgroundColor:h.card.backgroundColor,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth,borderColor:h.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.addressPillText,{color:h.card.titleColor,fontFamily:C.regular}],numberOfLines:1,children:Qe?"Loading...":$e?Nw($e):"No address"}),we?jsxRuntime.jsx(lt,{size:14,color:c.success,strokeWidth:2}):jsxRuntime.jsx(Go,{size:14,color:h.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:H&&!Xe?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:Ut}]},children:jsxRuntime.jsx(Ga,{size:16,color:c.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:c.foregroundMuted,fontFamily:C.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_?.({priceImpact:je,maxSlippage:He,minDepositUsd:Jr,chainName:X}),k?.(true);},style:oe.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(hn,{size:14,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.infoFooterText,{color:h.card.subtitleColor,fontFamily:C.regular}],numberOfLines:1,children:["$",Jr," ",X," Minimum and ","<","1 min Processing"]})]}),P?jsxRuntime.jsxs(reactNative.View,{style:oe.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:oe.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:ue,activeOpacity:.8,style:[oe.ctaButton,{backgroundColor:c.primary,borderRadius:h.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.ctaText,{color:c.primaryForeground??"#FFF",fontFamily:C.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:oe.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[oe.ctaButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.button.borderRadius,borderWidth:1,borderColor:c.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.ctaText,{color:c.foreground,fontFamily:C.semibold}],children:we?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[oe.ctaButton,{backgroundColor:c.primary,borderRadius:h.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.ctaText,{color:"#FFFFFF",fontFamily:C.semibold}],children:we?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(_t,{visible:Be,onClose:()=>{Ze(false),be("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:d?.tokenSelector?.borderTopLeftRadius??S,borderTopRightRadius:d?.tokenSelector?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[oe.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:oe.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[oe.sheetTitle,{color:h.header.titleColor,fontFamily:C.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Ze(false),be("");},style:oe.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(ht,{size:20,color:h.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:oe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[oe.searchInput,{backgroundColor:h.search.backgroundColor,color:h.search.inputColor,fontFamily:C.regular,borderRadius:h.input.borderRadius,borderWidth:h.input.borderWidth,borderColor:h.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:h.search.placeholderColor,value:Ie,onChangeText:be,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Tt,{style:oe.sheetList,contentContainerStyle:oe.sheetListContent,showsVerticalScrollIndicator:false,children:Dt.length===0?jsxRuntime.jsx(reactNative.View,{style:oe.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.emptyText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"No tokens found"})}):Dt.map(Fe=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(Fe.symbol),Ze(false),be("");},activeOpacity:.7,style:[oe.sheetItem,{backgroundColor:L===Fe.symbol?h.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(Fe,"png"))},style:oe.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[oe.sheetItemTitle,{color:h.card.titleColor,fontFamily:C.medium}],children:Fe.symbol}),jsxRuntime.jsx(reactNative.View,{style:oe.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[oe.sheetItemBadge,{borderWidth:1,borderColor:c.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[oe.sheetItemBadgeText,{color:h.card.subtitleColor,fontFamily:C.medium}],children:[Fe.chains.length," chain",Fe.chains.length!==1?"s":""]})})]},Fe.symbol))})]}),jsxRuntime.jsxs(_t,{visible:_e,onClose:()=>{Re(false),at("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:d?.chainSelector?.borderTopLeftRadius??S,borderTopRightRadius:d?.chainSelector?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[oe.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:oe.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[oe.sheetTitle,{color:h.header.titleColor,fontFamily:C.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Re(false),at("");},style:oe.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(ht,{size:20,color:h.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:oe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[oe.searchInput,{backgroundColor:h.search.backgroundColor,color:h.search.inputColor,fontFamily:C.regular,borderRadius:h.input.borderRadius,borderWidth:h.input.borderWidth,borderColor:h.input.borderColor}],placeholder:"Search networks",placeholderTextColor:h.search.placeholderColor,value:Ve,onChangeText:at,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Tt,{style:oe.sheetList,contentContainerStyle:oe.sheetListContent,showsVerticalScrollIndicator:false,children:Hs.length===0?jsxRuntime.jsx(reactNative.View,{style:oe.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.emptyText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"No networks found"})}):Hs.map(Fe=>{let Ft=Ea(Fe.chain_id,Fe.chain_type),tt=R===Ft;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{E(Ft),Re(false),at("");},activeOpacity:.7,style:[oe.chainItem,{backgroundColor:tt?h.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(Fe,"png"))},style:oe.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:oe.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.chainItemName,{color:h.card.titleColor,fontFamily:C.medium}],children:Fe.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[oe.chainMinBadge,{backgroundColor:`${c.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[oe.chainMinBadgeText,{color:c.warning,fontFamily:C.medium}],children:["$",Fe.minimum_deposit_amount_usd," Minimum"]})})]},Ft)})})]})]})}var oe=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function ag(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Kw(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function Dd({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:u,useModal:p}){let {colors:g,fonts:w,components:m}=A(),[f,T]=qi.useState(false),I=t==="pending"||t==="waiting"||t==="delayed",k=t==="succeeded",v=()=>{o&&reactNative.Linking.openURL(o);},S=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(_t,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:k?.55:.4,borderTopLeftRadius:l,borderTopRightRadius:u,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:dr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:dr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:m.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:dr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:dr.container,children:[jsxRuntime.jsx(reactNative.View,{style:dr.iconContainer,children:I?jsxRuntime.jsx(St,{size:80,strokeWidth:4,iconSize:56,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:re(r)},style:dr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[dr.tokenIconFill,{backgroundColor:g.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:re(r)},style:dr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[dr.tokenIconLarge,{backgroundColor:g.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[dr.statusBadge,{backgroundColor:m.container.iconBackgroundColor}],children:jsxRuntime.jsx(lt,{size:16,color:m.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[dr.title,{color:m.container.titleColor,fontFamily:w.semibold}],children:I?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[dr.amount,{color:m.container.titleColor,fontFamily:w.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[dr.date,{color:m.container.subtitleColor,fontFamily:w.regular}],children:Kw(s)}),jsxRuntime.jsx(reactNative.Text,{style:[dr.subtitle,{color:m.container.subtitleColor,fontFamily:w.regular}],children:I?"This usually takes less than a minute.":"Your account has been credited successfully!"}),k&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:dr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[dr.divider,{backgroundColor:g.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:dr.detailsToggle,onPress:()=>T(!f),children:[jsxRuntime.jsx(reactNative.Text,{style:[dr.detailsToggleText,{color:m.container.actionTitle,fontFamily:w.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(fn,{size:18,color:m.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:18,color:m.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:dr.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[dr.txButton,{backgroundColor:m.card.backgroundColor,borderColor:g.border}],onPress:v,children:[jsxRuntime.jsx(reactNative.Text,{style:[dr.txLabel,{color:m.card.titleColor,fontFamily:w.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[dr.txHash,{color:m.card.subtitleColor,fontFamily:w.regular}],children:ag(o)}),jsxRuntime.jsx(mn,{size:16,color:m.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[dr.txButton,{backgroundColor:m.card.backgroundColor,borderColor:g.border}],onPress:S,children:[jsxRuntime.jsx(reactNative.Text,{style:[dr.txLabel,{color:m.card.titleColor,fontFamily:w.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[dr.txHash,{color:m.card.subtitleColor,fontFamily:w.regular}],children:ag(n)}),jsxRuntime.jsx(mn,{size:16,color:m.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var dr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function $p({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:u,fonts:p,components:g}=A(),w=[{icon:jsxRuntime.jsx(oo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(Jo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(Jo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(uo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:Ko.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ko.header,children:[jsxRuntime.jsxs(reactNative.View,{style:Ko.titleRow,children:[jsxRuntime.jsx(hn,{size:16,color:g.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ko.title,{color:g.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:Ko.closeButton,children:jsxRuntime.jsx(ht,{size:18,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ko.rows,children:[w.map((m,f)=>jsxRuntime.jsxs(reactNative.View,{style:Ko.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Ko.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:m.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ko.label,{color:g.card.titleColor,fontFamily:p.regular}],children:m.label})]},f)),jsxRuntime.jsxs(reactNative.View,{style:Ko.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Ko.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:14,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ko.label,{color:g.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var Ko=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var yi={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 eS(){let{colors:e,components:t}=A(),r=qi.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[os.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[os.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:os.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[os.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[os.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:os.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[os.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:os.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var os=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 tS({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,defaultChainType:p,defaultChainId:g,defaultTokenAddress:w,showBalance:m=false,hideDepositTracker:f=false,enableCashApp:T=false,enableStripeLinkPay:I=false,StripeOnrampComponent:k,stripeOnrampEmail:_,stripeOnrampPhone:v,stripeMerchantIdentifier:S,stripePaymentSelectorPosition:x,stripeSkipSuccessConfirmation:d,stripeTheme:c,depositConfirmationMode:C="auto_ui",transferInputVariant:h="double_input",initialScreen:D="main",onDepositSuccess:L,onDepositError:V,sheetBorderRadius:R}){let E=R?.globalBorderTopLeftRadius,U=R?.globalBorderTopRightRadius,{colors:q,fonts:Qe}=A(),[ne,Je]=qi.useState([]),[$,ae]=qi.useState(null),[Q,Y]=qi.useState("amount"),[we,G]=qi.useState(false),[ie,Ye]=qi.useState(null),[Be,Ze]=qi.useState(void 0),[Ge,Ue]=qi.useState(false),[Me,ot]=qi.useState(null),De=D==="tracker"&&!f?"tracker":D==="transfer"?"transfer":D==="card"?"card":D==="cashapp"&&T?"cashapp":"main",Ae=De==="main",[ce,ye]=qi.useState(De),{isAllowed:ke,isLoading:Xe}=Hl(o,e);qi.useEffect(()=>{if(!e||$)return;let ve=false;return nl(o).then(async $e=>{if(ve)return;let ge=[];for(let Pe of $e?.transfer_crypto?.networks??[]){let H=Pe.icon_urls.find(ue=>ue.format==="png")?.url||Pe.icon_urls.find(ue=>ue.format==="svg")?.url;H&&ge.push(re(H));}for(let Pe of $e?.payment_networks?.networks??[]){let H=Pe.icon_urls.find(ue=>ue.format==="png")?.url||Pe.icon_urls.find(ue=>ue.format==="svg")?.url;H&&ge.push(re(H));}ge.length>0&&await hp(ge),ve||ae($e);}).catch(console.error),()=>{ve=true;}},[e,$,o]);let Ne=()=>{t();};qi.useEffect(()=>{e&&(ye(De),Y("amount"),Ue(false),ot(null));},[e,De]);let dt=qi.useCallback(ve=>{ve.length!==0&&Je($e=>{let ge=new Map($e.map(Pe=>[Pe.id,Pe]));for(let Pe of ve)ge.set(Pe.id,Pe);return Array.from(ge.values())});},[]),Nt=qi.useCallback(()=>{Ue(false),ot(null),Ae?(ye("main"),Y("amount")):Ne();},[Ae,Ne]),_e=ne.filter(ve=>ve.status==="pending"||ve.status==="waiting").length,Ve=!!(i&&a&&l&&u&&o)&&m!==false&&!!$,at=Xe||e&&!$,Ie=ke===false,be=null;if(ce==="stripe"&&k){let ve=jsxRuntime.jsx(k,{publishableKey:o,email:_,phone:v,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,merchantIdentifier:S,paymentSelectorPosition:x,skipSuccessConfirmation:d,appName:$?.project_name??"",onClose:Nt});be=c?jsxRuntime.jsx(Gs,{...c,children:ve}):ve;}let Oe=ce==="stripe"||ce==="transfer"||ce==="card"||ce==="cashapp"?.9:ce==="tracker"?.6:ce==="main"?T?.6:.5:void 0,Ut=ce==="main"?.9:void 0,wt={main:R?.main,transfer:R?.transferCrypto,card:R?.buyWithCard,stripe:R?.stripeLinkPay,cashapp:R?.cashApp,tracker:R?.depositsTracker}[ce],yt=wt?.borderTopLeftRadius??E,rr=wt?.borderTopRightRadius??U,We=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ie&&jsxRuntime.jsx(Dd,{visible:we,useModal:false,status:ie.status,tokenIconUrl:ie.destination_token_metadata?.icon_urls?.find(ve=>ve.format==="png")?.url||ie.destination_token_metadata?.icon_url||Be,explorerUrl:ie.explorer_url,completionExplorerUrl:ie.destination_explorer_url,date:ie.created_at?new Date(ie.created_at):void 0,amountUsd:ie.source_amount_usd?parseFloat(ie.source_amount_usd):void 0,onClose:()=>G(false),borderTopLeftRadius:R?.depositStatus?.borderTopLeftRadius??E,borderTopRightRadius:R?.depositStatus?.borderTopRightRadius??U}),Me&&jsxRuntime.jsx($p,{visible:Ge,useModal:false,onClose:()=>Ue(false),priceImpact:Me.priceImpact,maxSlippage:Me.maxSlippage,minDepositUsd:Me.minDepositUsd,chainName:Me.chainName,borderTopLeftRadius:R?.infoSheet?.borderTopLeftRadius??E,borderTopRightRadius:R?.infoSheet?.borderTopRightRadius??U})]});return jsxRuntime.jsxs(_t,{visible:e,onClose:ce==="main"?Ne:Nt,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:Oe,maxHeightPercent:Ut,borderTopLeftRadius:yt,borderTopRightRadius:rr,overlay:We,children:[ce==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(to,{title:n,showBack:false,onClose:Ne,showBalance:Ve,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:$?.project_name}),at&&jsxRuntime.jsx(eS,{}),!at&&Ie&&jsxRuntime.jsxs(reactNative.View,{style:Qr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Qr.iconContainer,{backgroundColor:q.cardHover}],children:jsxRuntime.jsx(Ja,{size:32,color:q.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.blockedTitle,{color:q.foreground,fontFamily:Qe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.blockedDescription,{color:q.foreground,opacity:.7,fontFamily:Qe.regular}],children:"There are no supported tokens available from your current location."})]}),!at&&!Ie&&jsxRuntime.jsxs(reactNative.View,{style:Qr.optionsContainer,children:[jsxRuntime.jsx(Fl,{onPress:()=>ye("transfer"),title:yi.transferCrypto.title,subtitle:yi.transferCrypto.subtitle,featuredTokens:$?.transfer_crypto?.networks}),jsxRuntime.jsx(Dl,{onPress:()=>ye("card"),title:yi.depositWithCard.title,subtitle:yi.depositWithCard.subtitle,paymentNetworks:$?.payment_networks?.networks}),T&&jsxRuntime.jsx(Al,{onPress:()=>ye("cashapp")}),I&&k&&jsxRuntime.jsx(Bl,{onPress:()=>ye("stripe"),title:yi.stripeLinkPay.title,subtitle:yi.stripeLinkPay.subtitle}),!f&&jsxRuntime.jsx(Ol,{onPress:()=>ye("tracker"),title:yi.depositTracker.title,subtitle:yi.depositTracker.subtitle,badge:_e>0?_e:void 0})]})]}),ce==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(to,{title:yi.transferCrypto.title,showBack:false,onClose:Nt,showBalance:Ve,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:$?.project_name}),Xe&&jsxRuntime.jsx(reactNative.View,{style:[Qr.centeredContainer,Qr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:q.primary})}),!Xe&&Ie&&jsxRuntime.jsxs(reactNative.View,{style:[Qr.centeredContainer,Qr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Qr.iconContainer,{backgroundColor:q.cardHover}],children:jsxRuntime.jsx(Ja,{size:32,color:q.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.blockedTitle,{color:q.foreground,fontFamily:Qe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.blockedDescription,{color:q.foreground,opacity:.7,fontFamily:Qe.regular}],children:"There are no supported tokens available from your current location."})]}),!Xe&&!Ie&&jsxRuntime.jsx(Tt,{style:Qr.transferScrollContainer,contentContainerStyle:h==="compact"?Qr.scrollContentCompact:Qr.scrollContent,showsVerticalScrollIndicator:false,children:h==="compact"?jsxRuntime.jsx(Fd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:w,depositConfirmationMode:C,onExecutionsChange:dt,onDepositSuccess:L,onDepositError:V,onLatestExecution:Ye,onShowStatusSheet:G,onSelectedTokenIconUrl:Ze,onShowInfoSheet:Ue,onInfoSheetData:ot,borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:R?.tokenSelector,chainSelector:R?.chainSelector,infoSheet:R?.infoSheet,depositStatus:R?.depositStatus}}):h==="single_input"?jsxRuntime.jsx(Np,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:w,depositConfirmationMode:C,onExecutionsChange:dt,onDepositSuccess:L,onDepositError:V,onLatestExecution:Ye,onShowStatusSheet:G,onSelectedTokenIconUrl:Ze,borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:R?.tokenSelector,infoSheet:R?.infoSheet,depositStatus:R?.depositStatus}}):jsxRuntime.jsx(md,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:w,depositConfirmationMode:C,onExecutionsChange:dt,onDepositSuccess:L,onDepositError:V,onLatestExecution:Ye,onShowStatusSheet:G,onSelectedTokenIconUrl:Ze,borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:R?.tokenSelector,chainSelector:R?.chainSelector,infoSheet:R?.infoSheet,depositStatus:R?.depositStatus}})})]}),ce==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(to,{title:`Deposit ${s||"USDC"}`,showBack:Q==="onramp",onBack:()=>Y("amount"),onClose:Nt,showBalance:Ve,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:$?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Qr.buyWithCardContainer,children:jsxRuntime.jsx(Cd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,onDepositSuccess:L,onDepositError:V,onExecutionsChange:dt,onLatestExecution:Ye,onShowStatusSheet:G,onSelectedTokenIconUrl:Ze,view:Q,onViewChange:ve=>Y(ve),borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{providerModal:R?.providerModal,webView:R?.webView,currencyModal:R?.currencyModal}})})]}),ce==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:Qr.cashAppContainer,children:jsxRuntime.jsx(sd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,onBack:Nt,onClose:Nt,onDepositSuccess:L})}),ce==="stripe"&&be&&jsxRuntime.jsx(reactNative.View,{style:Qr.stripeLinkPayContainer,children:be}),ce==="tracker"&&jsxRuntime.jsx(Ep,{active:ce==="tracker",onClose:Nt,executions:ne,externalUserId:r,publishableKey:o})]})}function Ad({theme:e="auto",...t}){return jsxRuntime.jsx(tS,{...t})}var Qr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},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 Wd(e,t=true){return ti({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>mc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function qp(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return ti({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await qn(s),u=null,p=null,g=null,w=null,m,f,T,I=l.data.some(k=>k.chains.some(_=>{let v=_.chain_type===t&&_.chain_id===r&&_.token_address.toLowerCase()===o.toLowerCase();return v&&(u=_.minimum_deposit_amount_usd,p=_.estimated_processing_time,g=_.max_slippage_percent,w=_.estimated_price_impact_percent,T=_.chain_name,f=k),v}));if(f){let k=xe(f,"png");k&&(m=re(k));}return {isSupported:I,minimumAmountUsd:u,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:w,errorMessage:I?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:m,chainName:T}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Kp(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return ti({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await fc(t,r,o,n,s);if(l.balance){let u=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,w=BigInt(g),m=BigInt(10**u),f=w/m,I=(w%m).toString().padStart(u,"0").replace(/0+$/,""),k=I?`${f}.${I}`:f.toString();return {balanceBaseUnit:g,balanceHuman:k,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:u,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var oS=2500,nS=3e3,iS=6e4;function Qp({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=qi.useState([]),[l,u]=qi.useState(false),p=qi.useRef(new Date),g=qi.useRef(new Map),w=qi.useRef(false),m=qi.useRef(n),f=qi.useRef(s);return qi.useEffect(()=>{m.current=n;},[n]),qi.useEffect(()=>{f.current=s;},[s]),qi.useEffect(()=>{o&&!w.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),w.current=o;},[o]),qi.useEffect(()=>{if(!e||!o)return;let T=p.current,I=async()=>{try{let _=await Xo(e,t,"withdraw"),v=new Date(T.getTime()-iS),S=[..._.data].sort((C,h)=>{let D=C.created_at?new Date(C.created_at).getTime():0;return (h.created_at?new Date(h.created_at).getTime():0)-D}),x=["pending","waiting","delayed"],d=["succeeded","failed"],c=null;for(let C of S){let h=C.created_at?new Date(C.created_at):null;if(!h||h<v)continue;let D=g.current.get(C.id);if(!D){c=C;break}if(x.includes(D)&&d.includes(C.status)){c=C;break}}if(c){let C=c,h=C.created_at?new Date(C.created_at):null;if(!h||h<p.current)return;let D=g.current.get(C.id);g.current.set(C.id,C.status),a(L=>{let V=L.findIndex(R=>R.id===C.id);if(V>=0){let R=[...L];return R[V]=C,R}return [...L,C]}),C.status==="succeeded"&&(!D||x.includes(D))?m.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&D!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(_){console.error("Failed to fetch withdraw executions:",_),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:_});}};I();let k=setInterval(I,oS);return u(true),()=>{clearInterval(k),u(false);}},[e,t,o]),qi.useEffect(()=>{if(!o||!r)return;let T=async()=>{try{await mu({deposit_wallet_id:r},t);}catch{}};T();let I=setInterval(T,nS);return ()=>clearInterval(I)},[o,r,t]),{executions:i,isPolling:l}}var Yp=(e,t)=>`${t}:${e}`;function ql({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:u,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:w,fonts:m,components:f}=A(),[T,I]=qi.useState(false),[k,_]=qi.useState(false),v=f.card,S=t?e.find(C=>C.symbol===t):void 0,x=S?.chains||[],d=r?x.find(C=>Yp(C.chain_id,C.chain_type)===r):void 0,c={backgroundColor:v.backgroundColor,borderRadius:v.borderRadius,borderWidth:v.borderWidth||1,borderColor:v.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Pt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.label,{color:v.labelColor,fontFamily:m.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.selectButton,c],onPress:()=>!s&&e.length>0&&I(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[Pt.placeholder,{color:v.subtitleColor,fontFamily:m.regular}],children:"Loading..."}):S?jsxRuntime.jsxs(reactNative.View,{style:Pt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(S,"png"))},style:Pt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.selectedText,{color:v.titleColor,fontFamily:m.medium}],numberOfLines:1,children:S.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Pt.placeholder,{color:v.subtitleColor,fontFamily:m.regular}],children:"Select receive token"}),jsxRuntime.jsx(Jt,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Pt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.label,{color:v.labelColor,fontFamily:m.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.selectButton,c,(!S||x.length===0)&&Pt.disabled],onPress:()=>!s&&S&&x.length>0&&_(true),activeOpacity:.7,disabled:s||!S||x.length===0,children:[d?jsxRuntime.jsxs(reactNative.View,{style:Pt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(d,"png"))},style:Pt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.selectedText,{color:v.titleColor,fontFamily:m.medium}],numberOfLines:1,children:d.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Pt.placeholder,{color:v.subtitleColor,fontFamily:m.regular}],children:"Chain"}),jsxRuntime.jsx(Jt,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(_t,{visible:T,onClose:()=>I(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:u,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Pt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerTitle,{color:w.foreground,fontFamily:m.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Pt.pickerHeaderClose,onPress:()=>I(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:w.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Js,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Pt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.pickerItem,{backgroundColor:C.symbol===t?w.cardHover:"transparent"}],onPress:()=>{o(C.symbol),I(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(C,"png"))},style:Pt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerItemText,{color:w.foreground,fontFamily:m.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerItemSub,{color:w.foregroundMuted,fontFamily:m.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(lt,{size:18,color:w.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(_t,{visible:k,onClose:()=>_(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Pt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerTitle,{color:w.foreground,fontFamily:m.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Pt.pickerHeaderClose,onPress:()=>_(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:w.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Js,{data:x,keyExtractor:C=>Yp(C.chain_id,C.chain_type),contentContainerStyle:Pt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let h=Yp(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.pickerItem,{backgroundColor:h===r?w.cardHover:"transparent"}],onPress:()=>{n(h),_(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(C,"png"))},style:Pt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerItemText,{color:w.foreground,fontFamily:m.medium}],children:C.chain_name}),h===r&&jsxRuntime.jsx(lt,{size:18,color:w.primary,strokeWidth:2.5})]})}})]})]})}var Pt=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 Gp(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return ti({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>pu({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function cS(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function dS(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function uS(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Md({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:u,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:w,estimatedProcessingTime:m,maxSlippagePercent:f,priceImpactPercent:T,canWithdraw:I,onDepositWalletCreation:k,onWithdraw:_,onWithdrawError:v,onWithdrawSubmitted:S,onViewTracker:x}){let d="https://unifold.io/terms",c="https://unifold.io/support",{colors:C,fonts:h,components:D}=A(),[L,V]=qi.useState(a||""),[R,E]=qi.useState(""),[U,q]=qi.useState(false),[Qe,ne]=qi.useState(null),[Je,$]=qi.useState(false),[ae,Q]=qi.useState(""),Y=qi.useRef(null);qi.useEffect(()=>{V(a||""),E(""),ne(null);},[a]);let we=L.trim();qi.useEffect(()=>{let be=setTimeout(()=>Q(we),500);return ()=>clearTimeout(be)},[we]);let{data:G,isLoading:ie,error:Ye}=Gp({chainType:u?.chain_type,chainId:u?.chain_id,tokenAddress:u?.token_address,recipientAddress:ae,publishableKey:e,enabled:ae.length>5&&!!u}),Be=we!==ae,Ze=qi.useMemo(()=>!we||we.length<=5||Be||ie?null:Ye?"Invalid address":G&&!G.valid?G.failure_code==="account_not_found"?`Account not found on ${u?.chain_name}`:G.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${u?.chain_name}`:"Invalid address":null,[we,Be,ie,Ye,G,u,l]),Ge=!Be&&!!G?.valid&&!Ze,Ue=qi.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),Me=qi.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),ot=n||p?.symbol||"TOKEN",De=p?.decimals??6,Ae=qi.useMemo(()=>{let be=parseFloat(R);return !be||be<=0?0:be},[R]),ce=qi.useMemo(()=>{let be=parseFloat(R);return !be||be<=0?0:be*Ue},[R,Ue]),ye=qi.useCallback(async()=>{try{let Oe=await Pg("expo-clipboard").getStringAsync();Oe&&(V(Oe.trim()),ne(null));}catch{}},[]),ke=qi.useCallback(()=>{Me<=0||E(p?.balanceHuman??"0");},[Me,p]),Xe=w!==null&&ce>0&&ce<w,Ne=Ae>0&&Me>0&&Ae>Me,dt=we.length>0&&R.trim().length>0&&Ae>0&&Ge&&!Xe&&!Ne&&!!p,Nt=qi.useCallback(async()=>{if(!(!l||!u||!dt||!I)){q(true),ne(null);try{let be=await k({destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,recipientAddress:we}),Oe=dS(Ae,De),Ut=uS(Ae,De),Ht={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ot,sourceTokenIconUrl:i,destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,destinationTokenSymbol:l.symbol,destinationChainName:u.chain_name,destinationTokenIconUrl:l?re(xe(l,"png")):void 0,amount:Ut,amountBaseUnit:Oe,submittedAt:new Date,withdrawIntentAddress:be.address,recipientAddress:we};await _(Ht),S(Ht);}catch(be){let Oe=be instanceof Error?be.message:"Withdrawal failed. Please try again.",Ut=Oe.length>120?"Withdrawal failed. Please try again.":Oe;ne(Ut),v?.({message:Oe,error:be,code:"WITHDRAW_FAILED"});}finally{q(false);}}},[l,u,dt,I,we,t,r,o,ot,i,R,Me,p,Ae,De,ce,k,_,v,S]),_e=D.input,Re=D.card,Ve=D.button,at=Ze?C.error:_e.borderColor,Ie=qi.useMemo(()=>U?"Processing...":Ne?"Insufficient balance":Xe?`Minimum $${w?.toFixed(2)}`:Qe?"Withdrawal failed \u2014 try again":"Withdraw",[U,Ne,Xe,w,Qe]);return jsxRuntime.jsxs(reactNative.View,{style:Rt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Rt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Rt.label,{color:Re.labelColor,fontFamily:h.medium}],children:"Recipient address"}),(Be||ie)&&we.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:ye,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(lm,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Rt.inputRow,{backgroundColor:_e.backgroundColor,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth,borderColor:at}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Rt.textInput,{color:_e.textColor,fontFamily:h.regular}],placeholder:"Enter wallet address",placeholderTextColor:_e.placeholderColor,value:L,onChangeText:be=>{V(be),ne(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Y.current?.focus()})}),Ze?jsxRuntime.jsx(reactNative.Text,{style:[Rt.errorText,{color:C.error,fontFamily:h.regular}],children:Ze}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Rt.label,{color:Re.labelColor,fontFamily:h.medium,paddingBottom:8}],children:["Amount",w!=null&&w>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:h.regular},children:` ($${w.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Rt.amountRow,{backgroundColor:_e.backgroundColor,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth,borderColor:_e.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[Rt.amountInput,{color:_e.textColor,fontFamily:h.regular}],placeholder:"0.00",placeholderTextColor:_e.placeholderColor,value:R,onChangeText:be=>{(be===""||/^\d*\.?\d*$/.test(be))&&(E(be),ne(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.unitLabel,{color:C.foregroundMuted,fontFamily:h.medium}],children:ot}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Rt.maxButton,{backgroundColor:`${C.primary}20`}],onPress:ke,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Rt.maxText,{color:C.primary,fontFamily:h.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Rt.detailsCard,{marginTop:24,backgroundColor:Re.backgroundColor,borderRadius:Re.borderRadius,borderWidth:Re.borderWidth||1,borderColor:Re.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Rt.detailsToggle,onPress:()=>$(!Je),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Rt.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Rt.detailsLabel,{color:Re.titleColor,fontFamily:h.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:h.medium},children:cS(m)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:Je?"180deg":"0deg"}]},children:jsxRuntime.jsx(Jt,{size:16,color:Re.actionColor,strokeWidth:2})})]})}),Je&&jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Rt.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Rt.detailsLabel,{color:Re.titleColor,fontFamily:h.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:h.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Rt.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Rt.detailsLabel,{color:Re.titleColor,fontFamily:h.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:h.medium},children:[(T??0).toFixed(2),"%"]})]})]})]})]}),Qe&&jsxRuntime.jsx(reactNative.Text,{style:[Rt.errorText,{color:C.error,fontFamily:h.regular,textAlign:"center"}],children:Qe}),jsxRuntime.jsxs(reactNative.View,{style:Rt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Rt.withdrawButton,{backgroundColor:Ve.primaryBackground,borderRadius:Ve.borderRadius,borderWidth:Ve.borderWidth,borderColor:Ve.borderColor,opacity:!dt||!I||U?.5:1}],onPress:Nt,disabled:!dt||!I||U,activeOpacity:.8,children:[U&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Ve.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.withdrawButtonText,{color:Ve.primaryText,fontFamily:h.medium}],children:Ie})]}),jsxRuntime.jsxs(reactNative.View,{style:Rt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Rt.historyLink,onPress:x,activeOpacity:.7,children:[jsxRuntime.jsx(oo,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.historyText,{color:C.foregroundMuted,fontFamily:h.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Rt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(d),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Rt.legalText,{color:C.foregroundMuted,fontFamily:h.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.legalSeparator,{color:C.foregroundMuted,fontFamily:h.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(c),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Rt.legalText,{color:C.foregroundMuted,fontFamily:h.regular}],children:"Help"})})]})]})]})]})}var Rt=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 fS(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 hS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Hd({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,u=re(xe(e.destination_token_metadata,"png")||jt("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=fS(e.created_at||new Date().toISOString()),w=hS(e.source_amount_usd);return jsxRuntime.jsxs(Ir,{cardTokens:s,onPress:t,contentStyle:Ci.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ci.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:Ci.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ci.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(Ys,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Ci.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.amount,{color:s.textRightColor,fontFamily:o.medium}],children:w}),jsxRuntime.jsx(Hr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Ci=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function Xp(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let u=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${u} ${l}`}catch{return e}}function wg(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 yS(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 Sg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Tg(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Kl({label:e,value:t,isLast:r}){let{fonts:o,components:n}=A(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ft.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[ft.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[ft.divider,{backgroundColor:s.borderColor}]})]})}function tm({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=A(),[u,p]=qi.useState([]),[g,w]=qi.useState(!!n),m=l.card,f=l.button,T=l.header,I=l.container;qi.useEffect(()=>{uu().then(q=>p(q.data)).catch(()=>{});},[]),qi.useEffect(()=>{w(!!n);},[e?.id]);let k=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,_=e?e.status==="failed"||e.status==="refunded":false,v=_?i.error:k?i.warning:i.success,S=_?"Failed":k?"Processing":"Completed",x=e?.destination_token_metadata?re(xe(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?re(t.destinationTokenIconUrl):re(jt("/icons/tokens/png/usdc.png")),d=e?.created_at?Xp(e.created_at):t.submittedAt?Xp(t.submittedAt.toISOString()):Xp(new Date().toISOString()),c=e?`${wg(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Sg(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${wg(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Sg(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,h=e?yS(e.source_amount_usd,e.source_amount_base_unit):"$0.00",D=e?pc(u,e.source_chain_type,e.source_chain_id):t.sourceChainId,L=e?pc(u,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,R=e?.explorer_url,E=e?.destination_transaction_hashes?.[0],U=e?.destination_explorer_url;return jsxRuntime.jsxs(Tt,{style:ft.scroll,contentContainerStyle:ft.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ft.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ks,{size:22,color:T.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ft.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ft.headerTitle,{color:T.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:ft.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:T.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ft.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:x},style:ft.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ft.statusBadge,{backgroundColor:v}],children:_?jsxRuntime.jsx(Ya,{size:10,color:"#FFFFFF",strokeWidth:3}):k?jsxRuntime.jsx(reactNative.View,{style:ft.spinnerDot}):jsxRuntime.jsx(lt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ft.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ft.statusDot,{backgroundColor:v}]}),jsxRuntime.jsx(reactNative.Text,{style:[ft.statusText,{color:v,fontFamily:a.medium}],children:S})]}),jsxRuntime.jsx(reactNative.Text,{style:[ft.dateText,{color:I.subtitleColor,fontFamily:a.regular}],children:d}),jsxRuntime.jsxs(reactNative.View,{style:[ft.detailsCard,{backgroundColor:m.backgroundColor,borderRadius:m.borderRadius,borderWidth:m.borderWidth??1,borderColor:m.borderColor}],children:[jsxRuntime.jsx(Kl,{label:"Amount Sent",value:c}),jsxRuntime.jsx(Kl,{label:"Amount Received",value:C}),jsxRuntime.jsx(Kl,{label:"USD Value",value:h}),jsxRuntime.jsx(Kl,{label:"Source Network",value:D}),jsxRuntime.jsx(Kl,{label:"Destination Network",value:L,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ft.moreDetailsRow,onPress:()=>w(q=>!q),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.moreDetailsText,{color:I.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(fn,{size:16,color:I.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:16,color:I.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[ft.detailsCard,{backgroundColor:m.backgroundColor,borderRadius:m.borderRadius,borderWidth:m.borderWidth??1,borderColor:m.borderColor}],children:V&&R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ft.txRow,onPress:()=>reactNative.Linking.openURL(R),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.txLabel,{color:m.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ft.txHash,{color:m.titleColor,fontFamily:a.regular}],children:Tg(V)}),jsxRuntime.jsx(mn,{size:14,color:m.actionColor,strokeWidth:2})]}),!k&&E&&U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[ft.divider,{backgroundColor:m.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ft.txRow,onPress:()=>reactNative.Linking.openURL(U),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.txLabel,{color:m.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ft.txHash,{color:m.titleColor,fontFamily:a.regular}],children:Tg(E)}),jsxRuntime.jsx(mn,{size:14,color:m.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:ft.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.detailLabel,{color:m.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:ft.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ft.button,ft.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ft.button,ft.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var ft=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 kg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Nd({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=A(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",u=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:tr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tr.closeButton,onPress:r,children:jsxRuntime.jsx(ht,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[tr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(lt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[tr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[tr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",kg(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:tr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tr.button,tr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[tr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tr.button,tr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[tr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):u?jsxRuntime.jsxs(reactNative.View,{style:tr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tr.closeButton,onPress:r,children:jsxRuntime.jsx(ht,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[tr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(ht,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[tr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[tr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tr.button,tr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[tr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:tr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tr.closeButton,onPress:r,children:jsxRuntime.jsx(ht,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(St,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:re(e.sourceTokenIconUrl)},style:tr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[tr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[tr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[tr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",kg(e.recipientAddress)]})]})}var tr=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 kS(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:re(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:re(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 xg=(e,t)=>`${t}:${e}`;function xS(){let{colors:e}=A(),t=qi.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return qi.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function qd({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:u="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:w,heightPercent:m=.94,sheetBorderRadius:f,sourceChainType:T,sourceChainId:I,sourceTokenAddress:k,sourceTokenSymbol:_,sourceChainName:v,sourceTokenIconUrl:S}){let{colors:x,fonts:d}=A(),[c,C]=qi.useState("form"),[h,D]=qi.useState(T),[L,V]=qi.useState(I),[R,E]=qi.useState(k),[U,q]=qi.useState(_),[Qe,ne]=qi.useState(v),[Je,$]=qi.useState(S),[ae,Q]=qi.useState(null),[Y,we]=qi.useState(null),[G,ie]=qi.useState(null),[Ye,Be]=qi.useState(),[Ze,Ge]=qi.useState([]),[Ue,Me]=qi.useState(null),[ot,De]=qi.useState("form"),Ae=qi.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,ce=qi.useRef(null),ye=!!h&&!!L&&!!R,{data:ke,isLoading:Xe}=Wd(r,e&&c==="form"),Ne=ke?.data??[],{data:dt,isLoading:Nt}=qp({sourceChainType:h,sourceChainId:L,sourceTokenAddress:R,sourceTokenSymbol:U,publishableKey:r,enabled:e&&ye&&c==="form"}),{data:_e,isLoading:Re}=Kp({address:n,chainType:h,chainId:L,tokenAddress:R,publishableKey:r,enabled:e&&ye}),{executions:Ve}=Qp({userId:o,publishableKey:r,depositWalletId:Ye,enabled:!!Ye&&e,onWithdrawSuccess:g,onWithdrawError:w});qi.useEffect(()=>{if(!e||c!=="tracker")return;let O=false;return Xo(o,r,"withdraw").then(J=>{O||Ge(J.data);}).catch(console.error),()=>{O=true;}},[e,c,o,r]),qi.useEffect(()=>{e&&(ce.current&&(clearTimeout(ce.current),ce.current=null),C("form"),D(T),V(I),E(k),q(_),ne(v),$(S),Q(null),we(null),ie(null),Be(void 0),Ge([]),Me(null),De("form"),Ae.setValue(reactNative.Dimensions.get("window").width));},[e]),qi.useEffect(()=>()=>{ce.current&&clearTimeout(ce.current);},[]),qi.useEffect(()=>{Je||dt?.iconUrl&&$(dt.iconUrl);},[dt?.iconUrl,Je]),qi.useEffect(()=>{Qe||dt?.chainName&&ne(dt.chainName);},[dt?.chainName,Qe]),qi.useEffect(()=>{if(!Ne.length||ae)return;let O,J;if(i&&a)if(l)for(let M of Ne){let je=M.chains.find(He=>He.chain_type===i&&He.chain_id===a&&He.token_address.toLowerCase()===l.toLowerCase());if(je){O=M,J=je;break}}else for(let M of Ne){let je=M.chains.find(He=>He.chain_type===i&&He.chain_id===a);if(je){O=M,J=je;break}}O||(O=Ne[0]),O&&(Q(O),we(J??O.chains[0]??null));},[Ne,ae,i,a,l]),qi.useEffect(()=>{c==="confirming"&&Ve.length>0&&C("details");},[c,Ve]);let at=qi.useCallback(()=>{t(),ce.current=setTimeout(()=>{C("form"),D(T),V(I),E(k),q(_),ne(v),$(S),Q(null),we(null),ie(null),Be(void 0),Ge([]),Me(null),De("form"),ce.current=null;},300);},[t,T,I,k,_,v,S]),Ie=qi.useCallback(O=>{let J=Ne.find(M=>M.symbol===O);J&&(Q(J),J.chains.length>0&&we(J.chains[0]));},[Ne]),be=qi.useCallback(O=>{if(!ae)return;let J=ae.chains.find(M=>xg(M.chain_id,M.chain_type)===O);J&&we(J);},[ae]),Oe=qi.useCallback(async O=>{let J=await Zo({external_user_id:o,destination_chain_type:O.destinationChainType,destination_chain_id:O.destinationChainId,destination_token_address:O.destinationTokenAddress,recipient_address:O.recipientAddress,action_type:"withdraw"},r),M=Eo(J.data,h??"");if(!M)throw new Error(`No deposit wallet found for chain type: ${h}`);return Be(M.id),{id:M.id,address:M.address}},[o,r,h]),Ut=qi.useCallback(O=>{ie(O),C("confirming");},[]),Ht=qi.useCallback(O=>{Me(O),Ae.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ae,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ae]),wt=qi.useCallback(()=>{reactNative.Animated.timing(Ae,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Me(null));},[Ae]),yt=Xe||Nt,rr=dt?.isSupported??null,We=c==="confirming"?"Withdrawal Status":u,ve=f?.globalBorderTopLeftRadius,$e=f?.globalBorderTopRightRadius,ge=f?.main?.borderTopLeftRadius??ve,Pe=f?.main?.borderTopRightRadius??$e,H=f?.tokenSelector?.borderTopLeftRadius??ve,ue=f?.tokenSelector?.borderTopRightRadius??$e,P=f?.chainSelector?.borderTopLeftRadius??ve,b=f?.chainSelector?.borderTopRightRadius??$e,B=(()=>{if(c!=="form"||!ye||Re||!_e)return;let O=U||_e.symbol,J=_e.balanceUsd;if(J!=null){let He=`$${parseFloat(J).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return O?`Balance: ${He} ${O}`:`Balance: ${He}`}let M=_e.balanceHuman;if(!(!M||M==="0"))return O?`Balance: ${M} ${O}`:`Balance: ${M}`})();return jsxRuntime.jsx(_t,{visible:e,onClose:at,closeOnBackdropPress:false,enablePanDownToClose:c==="tracker"||c==="form",showHandle:c==="tracker"||c==="form",heightPercent:c==="confirming"?.3:c==="details"?.7:c==="tracker"?.9:m,borderTopLeftRadius:ge,borderTopRightRadius:Pe,children:c==="confirming"&&G?jsxRuntime.jsx(Nd,{txInfo:G,executions:Ve,onClose:at,onViewTracker:()=>{De("confirming"),C("tracker");}}):c==="details"&&G?jsxRuntime.jsx(tm,{execution:Ve.length>0?Ve[Ve.length-1]:null,txInfo:G,onClose:at,onViewHistory:()=>{De("details"),C("tracker");},onHeaderClose:()=>C("form")}):c==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:zn.trackerContainer,children:[jsxRuntime.jsx(to,{title:"Withdrawal History",onClose:()=>C(ot)}),Ze.length===0?jsxRuntime.jsx(reactNative.View,{style:zn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[zn.emptyText,{color:x.foregroundMuted,fontFamily:d.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Js,{data:Ze,keyExtractor:O=>O.id,contentContainerStyle:zn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:O})=>jsxRuntime.jsx(Hd,{execution:O,onPress:()=>Ht(O)})}),Ue&&jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.historyDetailOverlay,{backgroundColor:x.background,transform:[{translateX:Ae}]}],children:jsxRuntime.jsx(tm,{execution:Ue,txInfo:kS(Ue),onClose:at,onBack:wt,onViewHistory:wt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(to,{title:We,subtitle:B,onClose:at}),yt?jsxRuntime.jsx(xS,{}):rr===false?jsxRuntime.jsxs(reactNative.View,{style:zn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[zn.unsupportedTitle,{color:x.foreground,fontFamily:d.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[zn.unsupportedMessage,{color:x.foregroundMuted,fontFamily:d.regular}],children:dt?.errorMessage})]}):jsxRuntime.jsx(RS,{publishableKey:r,sourceChainType:h??"",sourceChainId:L??"",sourceTokenAddress:R??"",sourceTokenSymbol:U,sourceChainName:Qe,sourceTokenIconUrl:Je,recipientAddressProp:s,destinationTokens:Ne,selectedToken:ae,selectedChain:Y,selectedChainKey:Y?xg(Y.chain_id,Y.chain_type):null,onTokenChange:Ie,onChainChange:be,tokensLoading:Xe,balanceData:_e??null,isLoadingBalance:Re,sourceValidation:dt??null,onDepositWalletCreation:Oe,onWithdraw:p,onWithdrawError:w,onWithdrawSubmitted:Ut,onViewTracker:()=>{De("form"),C("tracker");},tokenSelectorLeft:H,tokenSelectorRight:ue,chainSelectorLeft:P,chainSelectorRight:b})]})})}function RS({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:u,selectedChain:p,selectedChainKey:g,onTokenChange:w,onChainChange:m,tokensLoading:f,balanceData:T,isLoadingBalance:I,sourceValidation:k,onDepositWalletCreation:_,onWithdraw:v,onWithdrawError:S,onWithdrawSubmitted:x,onViewTracker:d,tokenSelectorLeft:c,tokenSelectorRight:C,chainSelectorLeft:h,chainSelectorRight:D}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Tt,{style:{flex:1,paddingTop:16},contentContainerStyle:zn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:zn.doubleInputWrapper,children:jsxRuntime.jsx(ql,{tokens:l,selectedTokenSymbol:u?.symbol??null,selectedChainKey:g,onTokenChange:w,onChainChange:m,isLoading:f,tokenPickerBorderTopLeftRadius:c,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:h,chainPickerBorderTopRightRadius:D})}),jsxRuntime.jsx(Md,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:u,selectedChain:p,balanceData:T,isLoadingBalance:I,minimumWithdrawAmountUsd:k?.minimumAmountUsd??null,estimatedProcessingTime:k?.estimatedProcessingTime??null,maxSlippagePercent:k?.maxSlippagePercent??null,priceImpactPercent:k?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:_,onWithdraw:v,onWithdrawError:S,onWithdrawSubmitted:x,onViewTracker:d})]})})}var zn=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 Ig=qi.createContext(null);function BS({children:e,publishableKey:t,config:r}){let[o]=qi.useState(()=>new lp({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=qi.useState(false),[i,a]=qi.useState(null),[l,u]=qi.useState(false),[p,g]=qi.useState(null),w=reactNative.useColorScheme(),m=qi.useRef(false);m.current||(lc({publishableKey:t}),m.current=true);let f=qi.useMemo(()=>{let R=r?.appearance||"dark";return R==="auto"?w==="dark"?"dark":"light":R},[r?.appearance,w]);qi.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),lc({publishableKey:t});},[t]),qi.useEffect(()=>()=>{I.current&&clearTimeout(I.current),d.current&&clearTimeout(d.current);},[]);let T=qi.useRef(null),I=qi.useRef(null),k=qi.useCallback(R=>{I.current&&(clearTimeout(I.current),I.current=null),T.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),T.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),T.current=null);let E=new Promise((U,q)=>{T.current={resolve:U,reject:q};});return a(R),s(true),E},[]),_=qi.useCallback(()=>{T.current&&(T.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),T.current=null),s(false),I.current=setTimeout(()=>{a(null),I.current=null;},200);},[]),v=qi.useCallback(R=>{i?.onSuccess&&i.onSuccess(R),T.current&&(T.current.resolve(R),T.current=null);},[i]),S=qi.useCallback(R=>{console.error("[UnifoldProvider] Deposit error:",R),i?.onError&&i.onError(R),T.current&&(T.current.reject(R),T.current=null);},[i]),x=qi.useRef(null),d=qi.useRef(null),c=qi.useRef(void 0),C=qi.useCallback(R=>{d.current&&(clearTimeout(d.current),d.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let E=new Promise((U,q)=>{x.current={resolve:U,reject:q};});return c.current=R.onClose,g(R),u(true),E},[]),h=qi.useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),c.current?.(),c.current=void 0,u(false),d.current=setTimeout(()=>{g(null),d.current=null;},200);},[]),D=qi.useCallback(R=>{p?.onSuccess&&p.onSuccess(R),x.current&&(x.current.resolve(R),x.current=null);},[p]),L=qi.useCallback(R=>{console.error("[UnifoldProvider] Withdraw error:",R),p?.onError&&p.onError(R),x.current&&(x.current.reject(R),x.current=null);},[p]),V=qi.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:_,beginWithdraw:C,closeWithdraw:h}),[t,k,_,C,h]);return jsxRuntime.jsx(up,{client:o,children:jsxRuntime.jsx(Ig.Provider,{value:V,children:jsxRuntime.jsxs(Gs,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Ad,{visible:n,onClose:_,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,enableCashApp:r?.enableCashApp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?kf():void 0,onDepositSuccess:v,onDepositError:S,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(qd,{visible:l,onClose:h,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:D,onWithdrawError:L,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function AS(){let e=qi.useContext(Ig);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
1
|
+
'use strict';var qi=require('react'),reactNative=require('react-native'),Gt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),fm=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Mu=require('@react-native-async-storage/async-storage'),Nb=require('expo-constants'),NC=require('react-native-qrcode-svg/src/genMatrix'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var qi__namespace=/*#__PURE__*/_interopNamespace(qi);var Gt__default=/*#__PURE__*/_interopDefault(Gt);var fm__default=/*#__PURE__*/_interopDefault(fm);var Mu__default=/*#__PURE__*/_interopDefault(Mu);var Nb__default=/*#__PURE__*/_interopDefault(Nb);var NC__default=/*#__PURE__*/_interopDefault(NC);var nm=e=>{throw TypeError(e)};var Pg=(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 Jd=(e,t,r)=>t.has(e)||nm("Cannot "+r);var y=(e,t,r)=>(Jd(e,t,"read from private field"),r?r.call(e):t.get(e)),pe=(e,t,r)=>t.has(e)?nm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),j=(e,t,r,o)=>(Jd(e,t,"write to private field"),t.set(e,r),r),pt=(e,t,r)=>(Jd(e,t,"access private method"),r);var qa=(e,t,r,o)=>({set _(n){j(e,t,n);},get _(){return y(e,t,o)}});var Zd={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)"}},Xd=Zd;function tc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Ka(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,T)=>{let h=o?.[p]?.[g];if(h!==void 0)return h;let m=t?.[p]?.[g];return m!==void 0?m:T},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,u=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:tc(s,i)},transferCrypto:{depositAddress:{card:tc(s,a)}},depositCard:{quoteProvider:{card:tc(s,l)}},depositTracker:{executionRow:{card:tc(s,u)}}}}function eu(e,t,r){let n={...Zd[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var tu=qi.createContext(null);function A(){let e=qi.useContext(tu);if(!e){let t=Xd.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Ka(t,void 0,"dark"),isDark:true}}return e}function St({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=A(),l=s??a.primary,u=i??a.primary,p=qi.useRef(new reactNative.Animated.Value(0)).current,g=qi.useId(),T=qi.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),h=(e-t)/2,m=2*Math.PI*h,w=e/2,x=o??Math.max(0,Math.round(e-t*2-8)),k=(e-x)/2;qi.useEffect(()=>{let v=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),S=requestAnimationFrame(()=>v.start());return ()=>{cancelAnimationFrame(S),v.stop();}},[p]);let _=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:_}]},children:jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Gt.Defs,{children:jsxRuntime.jsxs(Gt.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Gt.Stop,{offset:"100%",stopColor:u})]})}),jsxRuntime.jsx(Gt.Circle,{cx:w,cy:w,r:h,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${m*.75} ${m*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:k+1.5,left:k,width:x,height:x},children:r}):null]})}function ou({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function qs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ht({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ur({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ks({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Jt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Go({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.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 Qs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Gt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ys({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.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 hn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function uo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.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 Ja({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.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(Gt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Gt.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Gt.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function dm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Gt.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function um({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Gt__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Gt.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(Gt.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Gt.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 Gs({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=qi.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),u=qi.useMemo(()=>{let h=o?.[l];return eu(l,h,r)},[l,o,r]),p=qi.useMemo(()=>Ka(u,i,l),[u,i,l]),g=qi.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),T=qi.useMemo(()=>({mode:l,colors:u,fonts:g,components:p,isDark:l==="dark"}),[l,u,g,p]);return jsxRuntime.jsx(tu.Provider,{value:T,children:e})}var tl={damping:28,stiffness:300,mass:.8},ny=80,iy=500;function _t({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:u=false,borderTopLeftRadius:p=24,borderTopRightRadius:g=24,marginHorizontal:T,marginBottom:h,overlay:m,useModal:w=true}){let{colors:x}=A(),{height:k}=reactNative.useWindowDimensions(),[_,v]=qi.useState(false),S=qi.useRef(e);S.current=e;let R=qi.useRef(0),d=i!=null&&i>=1,c=d||u?0:reactNative.Platform.OS==="ios"?34:24,C=a!=null&&i!=null&&a>i,f=i!=null?(C?a:i)*k:void 0,D=C?(a-i)*k:0,L=l?0:D,V=fm.useSharedValue(k),I=qi.useRef(null),E=qi.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null),S.current||v(false);},[]);qi.useEffect(()=>{e?(I.current&&(clearTimeout(I.current),I.current=null),v(true),V.value=fm.withSpring(L,tl)):_&&(V.value=fm.withTiming(k,{duration:250},$=>{$&&fm.runOnJS(E)();}),I.current=setTimeout(()=>{I.current=null,E();},350));},[e]),qi.useEffect(()=>()=>{I.current&&clearTimeout(I.current);},[]),qi.useEffect(()=>{_&&e&&(V.value=fm.withSpring(L,tl));},[L,C]);let U=qi.useCallback(()=>{o&&t();},[o,t]),q=qi.useMemo(()=>{if(!(!n&&!C))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{R.current=V.value;},onPanResponderMove:($,le)=>{if(Math.abs(le.dy)<4)return;let Q=R.current+le.dy;V.value=Math.max(0,Q);},onPanResponderRelease:($,le)=>{if(!(Math.abs(le.dy)<4)){if(n&&(le.dy>ny||le.vy>iy)){t();return}if(C){let Q=D/2,Y=V.value<Q?0:D;V.value=fm.withSpring(Y,tl);}else V.value=fm.withSpring(L,tl);}},onPanResponderTerminate:()=>{V.value=fm.withSpring(L,tl);}}).panHandlers},[n,C,D,L,V,t]),Ke=fm.useAnimatedStyle(()=>({transform:[{translateY:V.value}]})),ie=fm.useAnimatedStyle(()=>({opacity:fm.interpolate(V.value,[0,k*.5,k],[.5,.25,0],fm.Extrapolation.CLAMP)}));if(!_)return null;let Ge=jsxRuntime.jsxs(reactNative.View,{style:[jn.root,!w&&jn.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(fm__default.default.View,{style:[jn.backdrop,ie],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:U})}),jsxRuntime.jsxs(fm__default.default.View,{style:[jn.sheet,Ke,{height:f,backgroundColor:x.background,borderTopLeftRadius:d?0:p,borderTopRightRadius:d?0:g,...T?{marginHorizontal:T,marginBottom:h??T+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:p,borderBottomRightRadius:g}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:f!=null?jn.gestureRoot:jn.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:jn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[jn.handle,{backgroundColor:x.foreground+"33"}]})}),r,c>0&&jsxRuntime.jsx(reactNative.View,{style:{height:c}})]}),q&&jsxRuntime.jsx(reactNative.View,{...q,style:jn.dragOverlay})]})]});return w?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[Ge,m]}):Ge}var jn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...reactNative.StyleSheet.absoluteFillObject,zIndex:9999},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),Tt=qi__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Tt.displayName="BottomSheetScrollView";function Js(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var sy="https://api.unifold.io",su="__UnifoldDevApiBaseUrl__",Hr="pk_test_123",ac={};function ay(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[su];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function fr(){return ay()??sy}function lc(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&&(ac=e.defaultConfig);}function gm(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[su]=t:delete globalThis[su];}function rl(){return fr()}function cc(){return Hr}function no(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function $t(e){let t=e.startsWith("/")?e:`/${e}`;return `${fr()}/api/public${t}`}function re(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 Zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||ac.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||ac.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ac.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Hr;no(n);let s=await fetch(`${fr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Eo(e,t){return e.find(r=>r.chain_type===t)}async function Xo(e,t,r){let o=t||Hr;no(o);let n=await fetch(`${fr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function dc(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function 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 qn(e,t){let r=e||Hr;no(r);let o=`${fr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function au(e,t){let r=t||Hr;no(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${fr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function uc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function lu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function cu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function du(e,t){let r=t||Hr;no(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${fr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function ol(e){let t=e||Hr;no(t);let r=await fetch(`${fr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function _i(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function nl(e){let t=e||Hr;no(t);let r=await fetch(`${fr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function uu(){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 pc(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function il(){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 mc(e){let t=e||Hr;no(t);let r=await fetch(`${fr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function pu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function mu(e,t){return dc(e.deposit_wallet_id,t)}async function fc(e,t,r,o,n){let s=n||Hr;no(s);let i=await fetch(`${fr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function fu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function hu(e="usd",t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function gu(e,t){let r=t||Hr;no(r);let o=await fetch(`${fr()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}function bm({size:e=28}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Gt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Gt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Gt.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 wm({size:e=28}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Gt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Gt.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(Gt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Gt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Gt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Gt.Defs,{children:jsxRuntime.jsx(Gt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Gt.Rect,{width:28,height:28,fill:"white"})})})]})}function km({size:e=28}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Gt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.Defs,{children:jsxRuntime.jsx(Gt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Gt.Rect,{width:28,height:28,fill:"white"})})})]})}function xm({size:e=28}){return jsxRuntime.jsxs(Gt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Gt.Defs,{children:[jsxRuntime.jsxs(Gt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Gt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Gt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Gt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Gt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Gt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Gt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Gt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Gt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Gt.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(Gt.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(Gt.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 Rm({size:e=28}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Gt.G,{children:[jsxRuntime.jsx(Gt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Gt.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 hc=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:bm},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:wm},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:km},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:xm},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Rm}];function gc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function yc(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ea(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=hc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=hc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function jt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=A(),i=r==="back",a=i?jsxRuntime.jsx(Ks,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(ht,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ii.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:Ii.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Ii.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Ii.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Ii.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Ii.headerWithTitle:Ii.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Ii.headerSpacer}),!i&&l]})}var bc={paddingTop:8,paddingBottom:8},Ii=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...bc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...bc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function po({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=A();return e?jsxRuntime.jsx(reactNative.Text,{style:[_m.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[_m.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var _m=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function en({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(qi.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function Tu({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=qi.useState(false),{colors:a,components:l}=A(),u=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=gc(r);return jsxRuntime.jsxs(qi.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:u,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(lt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(Go,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Cc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ta({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=A(),s=e.toLowerCase(),i=Cc[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function wc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=A(),u=$t(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ea(r);return jsxRuntime.jsxs(reactNative.View,{style:[Mo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:Mo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:Mo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Ur,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Mo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Mo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Mo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Mo.tokenIcon,{backgroundColor:Cc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Mo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Mo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Mo=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 bn(){let{colors:e,fonts:t,components:r}=A(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return qi.useMemo(()=>{let l=i.borderRadius,u={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},g={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),h={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:T,borderBottomRightRadius:T,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},m={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:u,quote:g,pm:h,wallet:m,flow:w,amount:p}},[e,t,o,n,s,i,a])}var Pm="",Fm;function Sc(e){Pm=e;}function Tc(e){Fm=e;}function ho(){let e=Pm||cc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function go(){return Fm??rl()}async function kc(){let e=`${go()}/v1/public/onramps/headless/stripe/config`,t=ho(),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 ku(e){let t=await fetch(`${go()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Vm(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":ho(),"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 xu(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Dm(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(`${go()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Om(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":ho(),"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 Kn(e,t){let r=`${go()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":ho(),"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 Lm(e){let t=`${go()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":ho(),"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 Bm(e,t){let r=`${go()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":ho(),"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 Ru(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":ho(),"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 _u(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(`${go()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":ho(),"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 Iu(e,t){let r=await fetch(`${go()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":ho(),"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 Am(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(`${go()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":ho(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function vi(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Wm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${go()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":ho()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function Ly({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Gt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Gt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Gt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Gt.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(Gt.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(Gt.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 By({size:e=24}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Gt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Gt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Gt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Ay({size:e=24}){return jsxRuntime.jsx(Gt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Gt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Gt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Gt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Gt.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(Gt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Gt.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 Pu({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(qs,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(Ly,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(By,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Ay,{size:t}):jsxRuntime.jsx(qs,{size:t*.75,color:r,strokeWidth:1.75})}function xc(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var Vu={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Du(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 Hm({status:e,colors:t,fontFamily:r}){let o=Du(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Vu[e]??e})})}function Nm({count:e=4}){let{colors:t,components:r}=A(),o=qi.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ra.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ra.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ra.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ra.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ra.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ra.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ra=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 $m({active:e,interval:t=15e3,color:r}){let o=qi.useRef(new reactNative.Animated.Value(0)).current;return qi.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function jm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=A(),[s,i]=qi.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,u=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=Du(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",h=(l?.destination_currency??"").toUpperCase(),m=e.destination_token_metadata,w=vi(m?.icon_urls,m?.icon_url),x=ea(l?.destination_network??""),k=l?.wallet_address?gc(l.wallet_address):null,_=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,v=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,S=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,d=>d.toUpperCase()):null,R=[{label:"Amount",value:g},{label:"Received",value:`${T} ${h}`},...S?[{label:"Payment",value:S}]:[],{label:"Network",value:x},...k?[{label:"Wallet",value:k}]:[],..._?[{label:"Network Fee",value:_}]:[],...v?[{label:"Transaction Fee",value:v}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(jt,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Tt,{style:Ar.scroll,contentContainerStyle:Ar.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ar.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ta,{currency:h||"USD",tokenIconUrl:w,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Ar.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:u?jsxRuntime.jsx(oo,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(ht,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ar.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ar.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Vu[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Ar.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:xc(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ar.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ar.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(lt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Go,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),R.map(d=>jsxRuntime.jsx(qi__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Ar.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:d.label}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:d.value})]})},d.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Ar.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Ar.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Ar=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function Km({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=A(),[i,a]=qi.useState(false),l=u=>{a(false),e(u);};return jsxRuntime.jsxs(reactNative.View,{style:wn.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wn.trigger,onPress:()=>a(u=>!u),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(cm,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:wn.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[wn.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wn.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(oo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[wn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wn.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(uo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[wn.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wn.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(dm,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[wn.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var wn=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 Gy=[50,100,500],Jy=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Ym(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Zy(e){return e.card?`${Ym(e.card.brand)} ${Ym(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function vc({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:u,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:T,onConfirm:h,onCancel:m,sheetBorderTopLeftRadius:w,sheetBorderTopRightRadius:x,accessToken:k,showHistoryProgressBar:_=true,onLogout:v,onRequestKYC:S,showSwitchAccount:R=true,inputDisabled:d=false}){let c=bn(),{colors:C,components:f,fonts:D}=A(),L=w??f.card.borderRadius,V=x??f.card.borderRadius,[I,E]=qi.useState(e),[U,q]=qi.useState(r?"apple_pay":g.length>0?g[0].id:null),Ke=qi.useRef(false),ie=P=>{Ke.current=true,q(P);};qi.useEffect(()=>{Ke.current||r||g.length>0&&q(g[0].id);},[g,r]);let[Ge,$]=qi.useState(false),[le,Q]=qi.useState("select"),[Y,we]=qi.useState(null),G=qi.useRef(false);qi.useEffect(()=>{l&&u&&/saving/i.test(u)&&Q("card");},[l,u]);let se=s,Qe=se!=null&&se>0,Be=qi.useMemo(()=>{if(o)return [];let P=Gy.map(b=>({label:`$${b}`,amount:String(b),disabled:false}));return P.push({label:"MAX",amount:Qe?String(se):"0",disabled:!Qe}),P},[o,Qe,se]),Je=P=>{if(P==="\u232B"){E(b=>b.slice(0,-1));return}if(P==="."){if(I.includes("."))return;E(b=>b===""?"0.":b+".");return}E(b=>{let B=b.indexOf(".");return B!==-1&&b.length-B>2?b:b==="0"&&P!=="."?P:b+P});},Ye=I===""?"0":I,ze=parseFloat(I),Me=n!=null&&!isNaN(ze)&&ze>0&&ze<n,rt=se!=null&&se>0&&!isNaN(ze)&&ze>se,De=I!==""&&!isNaN(ze)&&ze>0&&!Me&&!rt,Ae=r||g.length>0,ne=i==="header",ye=qi.useMemo(()=>{let P=[];r&&P.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let b of g)P.push({id:b.id,label:Zy(b),hint:b.card?`Expires ${b.card.exp_month}/${b.card.exp_year}`:b.type,brand:b.card?.brand,isApplePay:false});return P},[r,g]),ke=ye.find(P=>P.id===U),He=U!=null&&U!=="apple_pay",dt=ke?ke.label:He&&Y?Y:He?"Card":"Pay With",Ht=ke?!ke.isApplePay:He,_e=ke?.brand??Y??void 0,[Re,Ve]=qi.useState(false),[at,Ie]=qi.useState([]),[be,Oe]=qi.useState(false),[zt,Ut]=qi.useState(null),[wt,yt]=qi.useState(null),rr=qi.useRef(null);rr.current=wt;let We=qi.useRef(false);We.current=Re;let ve=qi.useCallback(async(P=false)=>{if(k){P||(Oe(true),Ut(null));try{let b=await Lm(k);if(!We.current)return;let B=Array.isArray(b.data)?b.data:Array.isArray(b)?b:[];Ie(B),P||Ut(null);let O=rr.current?.id;if(O){let J=B.find(M=>M.id===O);J&&yt(J);}}catch(b){if(!We.current)return;P||Ut(b?.message??"Failed to load history");}finally{!P&&We.current&&Oe(false);}}},[k]),Ne=qi.useCallback(()=>{Ve(true),ve();},[ve]);qi.useEffect(()=>{if(!Re||!k)return;let P=setInterval(()=>ve(true),15e3);return ()=>clearInterval(P)},[Re,k,ve]);let ge=qi.useCallback(P=>{switch(P){case "history":Ne();break;case "kyc":S?.();break;case "logout":v?.();break}},[Ne,S,v]),H=!!k||!!S||!!v?jsxRuntime.jsx(Km,{onSelect:ge,showKycOption:!!S,showSwitchAccount:R&&!!v}):void 0,ue=Ae?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ne?c.amount.paymentRowHeader:c.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(Q("select"),$(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:c.amount.paymentLeft,children:[ke?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):Ht?jsxRuntime.jsx(Pu,{sublabel:_e,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:c.amount.paymentLabel,children:dt}),jsxRuntime.jsx(Jt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:c.form.screen,children:[jsxRuntime.jsx(jt,{onPress:m,title:"Enter amount",leftAction:H}),ne&&ue,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,Ye==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Ye]}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.currencyLabel,children:t.toUpperCase()}),Me&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.minAmountText,{color:C.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),rt&&se!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.minAmountText,{color:C.warning}],children:["Maximum amount is $",se.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!ne&&ue,Be.length>0&&jsxRuntime.jsx(reactNative.View,{style:c.amount.quickRow,children:Be.map(P=>{let b=!P.disabled&&I===P.amount&&I!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,b&&{backgroundColor:C.primary},P.disabled&&{opacity:.4}],activeOpacity:.7,disabled:P.disabled||l,onPress:()=>E(P.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.quickPillText,b&&{color:C.primaryForeground}],children:P.label})},P.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:Jy.map((P,b)=>jsxRuntime.jsx(reactNative.View,{style:c.amount.numpadRow,children:P.map(B=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.numpadKey,(l||d)&&{opacity:.3}],onPress:()=>Je(B),activeOpacity:.6,disabled:l||d,children:jsxRuntime.jsx(reactNative.Text,{style:B==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:B})},B))},b))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.form.continueBtn,(!De||l||d)&&c.form.continueBtnDisabled],onPress:()=>De&&!l&&!d&&h(I,U),disabled:!De||l||d,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,(!De||d)&&c.form.continueBtnTextDisabled],children:"Continue"})}),!Ge&&p?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:p}):!Ge&&l&&u&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:u}):null]}),jsxRuntime.jsx(_t,{visible:Ge,onClose:()=>{l||($(false),Q("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetContent,children:le==="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:()=>$(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(ht,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Tt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[ye.map(P=>{let b=U===P.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[c.amount.sheetOption,b&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{ie(P.id),we(P.isApplePay?null:P.label),$(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetOptionIcon,children:P.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Pu,{sublabel:P.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:P.label}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:P.hint})]})]}),b&&jsxRuntime.jsx(lt,{size:18,color:C.primary,strokeWidth:2.5})]},P.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!G.current){G.current=true;try{let P=await T?.();P&&(ie(P.token),we(P.sublabel),$(!1));}finally{G.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||Q("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Ks,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:u||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{a&&De&&a(false,I);},children:jsxRuntime.jsx(reactNative.Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(_t,{visible:Re,onClose:()=>{Ve(false),yt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:wt?jsxRuntime.jsx(jm,{session:wt,onBack:()=>yt(null)}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetContent,children:[jsxRuntime.jsx(jt,{onPress:()=>Ve(false),title:"Purchase History"}),_&&jsxRuntime.jsx($m,{active:Re&&!be&&at.length>0,color:C.primary}),be?jsxRuntime.jsx(Nm,{}):zt?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:zt})}):at.length===0?jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.sheetStatusText,{color:C.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Tt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:at.map(P=>{let b=P.transaction_details,B=b?.source_amount?`$${parseFloat(b.source_amount).toFixed(2)}`:"\u2014",O=(b?.destination_currency??"").toUpperCase(),J=b?.destination_amount?`${parseFloat(b.destination_amount).toFixed(2)} ${O}`:"",M=xc(P.created),$e=P.destination_token_metadata,Ue=vi($e?.icon_urls,$e?.icon_url),Gr=vi($e?.chain?.icon_urls,$e?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:c.amount.sheetOption,activeOpacity:.7,onPress:()=>yt(P),children:[jsxRuntime.jsx(ta,{currency:O||"USD",tokenIconUrl:Ue,networkIconUrl:Gr,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:B}),J?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:J}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(Hm,{status:P.status,colors:C,fontFamily:D.regular}),M?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:C.foregroundMuted,fontFamily:D.regular},children:M}):null]}),jsxRuntime.jsx(Ur,{size:14,color:C.foregroundMuted,strokeWidth:2})]})]},P.id)})})]})})]})}function Pc({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=bn(),{colors:i,fonts:a,components:l}=A(),u=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[T,h]=qi.useState(1),[m,w]=qi.useState(e.firstName??""),[x,k]=qi.useState(e.lastName??""),[_,v]=qi.useState(e.dobMonth??""),[S,R]=qi.useState(e.dobDay??""),[d,c]=qi.useState(e.dobYear??""),[C,f]=qi.useState(e.addressLine1??""),[D,L]=qi.useState(e.addressLine2??""),[V,I]=qi.useState(e.city??""),[E,U]=qi.useState(e.state??""),[q,Ke]=qi.useState(e.postalCode??""),[ie,Ge]=qi.useState(e.country??"US"),[$,le]=qi.useState(e.idNumber??""),Q=qi.useRef(null),Y=qi.useRef(null),we=qi.useRef(null),G=qi.useRef(null),se=qi.useRef(null),Qe=qi.useRef(null),Be=qi.useRef(null),Je=qi.useRef(null),Ye=p[T-1],ze=()=>{switch(Ye){case "name":return m.trim().length>0&&x.trim().length>0;case "dob":return _.length===2&&S.length===2&&d.length===4;case "address":return C.trim().length>0&&V.trim().length>0&&E.trim().length>0&&q.trim().length>0;case "ssn":return $.trim().length>0;default:return false}},Me=()=>{ze()&&(T<g?h(ye=>ye+1):o({firstName:m,lastName:x,idNumber:$,dobMonth:_,dobDay:S,dobYear:d,addressLine1:C,addressLine2:D,city:V,state:E,postalCode:q,country:ie}));},rt=()=>{T>1?h(ye=>ye-1):n();},De={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:Ae}=De[Ye],ne=[wr.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:wr.header,children:[jsxRuntime.jsx(reactNative.View,{style:wr.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wr.iconButton,onPress:rt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(Qa,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:wr.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:ne,children:[T," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:wr.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(ht,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:wr.progressTrack,children:Array.from({length:g}).map((ye,ke)=>jsxRuntime.jsx(reactNative.View,{style:[wr.progressSegment,{backgroundColor:ke<T||ke+1===T?i.primary:i.border}]},ke))}),jsxRuntime.jsx(Tt,{style:s.form.flex,contentContainerStyle:wr.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:Ae}),Ye==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yn,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:u,value:m,onChangeText:w,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Q.current?.focus()})}),jsxRuntime.jsx(Yn,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Q,style:s.form.input,placeholder:"Doe",placeholderTextColor:u,value:x,onChangeText:k,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Me})})]}),Ye==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:wr.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:wr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,wr.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,wr.dobInput],placeholder:"MM",placeholderTextColor:u,value:_,onChangeText:ye=>{let ke=ye.replace(/\D/g,"").slice(0,2);v(ke),ke.length===2&&Y.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,wr.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[s.form.input,wr.dobInput],placeholder:"DD",placeholderTextColor:u,value:S,onChangeText:ye=>{let ke=ye.replace(/\D/g,"").slice(0,2);R(ke),ke.length===2&&we.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,wr.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:we,style:[s.form.input,wr.dobInput],placeholder:"YYYY",placeholderTextColor:u,value:d,onChangeText:ye=>{let ke=ye.replace(/\D/g,"").slice(0,4);c(ke);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Me})]})]}),Ye==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yn,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:u,value:C,onChangeText:f,returnKeyType:"next",onSubmitEditing:()=>G.current?.focus()})}),jsxRuntime.jsx(Yn,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:u,value:D,onChangeText:L,returnKeyType:"next",onSubmitEditing:()=>se.current?.focus()})}),jsxRuntime.jsx(Yn,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:se,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:u,value:V,onChangeText:I,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Qe.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:wr.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Yn,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Qe,style:s.form.input,placeholder:"CA",placeholderTextColor:u,value:E,onChangeText:ye=>U(ye.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Be.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(Yn,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Be,style:s.form.input,placeholder:"94001",placeholderTextColor:u,value:q,onChangeText:Ke,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Je.current?.focus()})})})]}),jsxRuntime.jsx(Yn,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Je,style:s.form.input,placeholder:"US",placeholderTextColor:u,value:ie,onChangeText:ye=>Ge(ye.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Me})})]}),Ye==="ssn"&&jsxRuntime.jsxs(Yn,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:u,value:$,onChangeText:le,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Me}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,wr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&T>=g?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!ze()&&s.form.continueBtnDisabled],onPress:Me,disabled:!ze(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!ze()&&s.form.continueBtnTextDisabled],children:T>=g?"Submit":"Continue"})})})]})})}function Yn({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var wr=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var zu="@unifold/stripe_oauth";async function Jm(){try{let e=await Mu__default.default.getItem(zu);return e?JSON.parse(e):null}catch{return null}}async function Uu(e){try{await Mu__default.default.setItem(zu,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ia(){try{await Mu__default.default.removeItem(zu);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var sb=5,Bi=null,Hu=false,Nu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Fc(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:u,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[h,m]=qi.useState(r),[w,x]=qi.useState(!!e?.externalUserId),[k,_]=qi.useState(false),[v,S]=qi.useState(false),[R,d]=qi.useState(""),[c,C]=qi.useState(null),[f,D]=qi.useState(e?.email??""),[L,V]=qi.useState(e?.phone??""),[I,E]=qi.useState(""),[U,q]=qi.useState("US"),[Ke,ie]=qi.useState(""),[Ge,$]=qi.useState(""),le=qi.useRef(""),Q=qi.useRef(""),Y=qi.useRef(""),[we,G]=qi.useState(false),[se,Qe]=qi.useState(false),Be=qi.useRef(0),Je=qi.useRef(false),Ye=qi.useRef(false),ze=qi.useRef(false),Me=qi.useRef(false),rt=qi.useRef(e?.email??""),De=qi.useRef(false),Ae=qi.useRef(null),ne=qi.useRef(""),ye=qi.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ke=qi.useRef(null),[Ze,He]=qi.useState(0),[dt,Ht]=qi.useState(Nu),[_e,Re]=qi.useState(e?.defaultWalletAddress??""),[Ve,at]=qi.useState(""),[Ie,be]=qi.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Oe,zt]=qi.useState(e?.defaultSourceAmount??"100"),[Ut,wt]=qi.useState(e?.defaultSourceCurrency??"usd"),[yt,rr]=qi.useState(e?.defaultDestinationCurrency??"usdc"),[We,ve]=qi.useState(null),[Ne,ge]=qi.useState(),[Pe,H]=qi.useState(),[ue,P]=qi.useState(false),b=qi.useRef(null),B=qi.useRef(false),O=qi.useRef(0),J=qi.useRef(e?.onComplete),M=qi.useRef(e?.onError),$e=qi.useRef(e?.onStepChange),Ue=qi.useRef(r);qi.useEffect(()=>{J.current=e?.onComplete;},[e?.onComplete]),qi.useEffect(()=>{M.current=e?.onError;},[e?.onError]),qi.useEffect(()=>{$e.current=e?.onStepChange;},[e?.onStepChange]);let Gr=qi.useRef(r);qi.useEffect(()=>{h!==Gr.current&&($e.current?.(h,Gr.current),Gr.current=h),Ue.current=h;},[h]),qi.useEffect(()=>{v&&h!=="email"&&S(false);},[v,h]),qi.useEffect(()=>{w&&h!==r&&x(false);},[w,h,r]);let X=qi.useCallback((F,W,ae)=>{let Te={code:F,message:W,step:Ue.current,stripeErrorCode:ae};C(Te),d(""),M.current?.(Te);},[]),Hs=qi.useCallback(F=>{let W={sessionId:F.id,status:F.status,sourceAmount:F.transaction_details.source_amount,sourceCurrency:F.transaction_details.source_currency,destinationAmount:F.transaction_details.destination_amount,destinationCurrency:F.transaction_details.destination_currency,destinationNetwork:F.transaction_details.destination_network,walletAddress:F.transaction_details.wallet_address,fees:{networkFee:F.transaction_details.fees.network_fee_amount,transactionFee:F.transaction_details.fees.transaction_fee_amount}};return J.current?.(W),W},[]),Dt=qi.useCallback(()=>C(null),[]),Fe=F=>F.refresh_token??F.refresh?.refresh_token??"",Ft=qi.useCallback((F,W,ae,Te,Se)=>{Q.current=W,le.current=ae,e?.externalUserId&&Uu({accessToken:W,refreshToken:ae,customerId:F,externalUserId:e.externalUserId,email:Se||f,expiresAt:Date.now()+Te*1e3});},[e?.externalUserId,f]),ot=qi.useCallback(async()=>{let F=le.current;if(!F)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let W=await xu(F,Y.current??void 0),ae=W.access_token,Te=Fe(W)||F;return $(ae),Ft(Y.current,ae,Te,W.expires_in??3600),ae}catch(W){return console.error("[tryRefreshAccessToken] refresh failed:",W?.message),await ia(),Bi=null,ke.current=null,Q.current="",le.current="",Y.current="",$(""),ie(""),null}},[Ft]),Xe=qi.useCallback(async F=>{try{return await F(Q.current)}catch(W){let ae=W?.message??"";if(ae.includes("stripe_onramp_forbidden")||ae.includes("403")){let Te=await ot();if(!Te)throw X("authorization_error","Session expired. Please sign in again."),m("email"),W;return await F(Te)}throw W}},[ot,X]);qi.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){P(false);return}let W=false;return stripeReactNative.isPlatformPaySupported().then(ae=>{W||P(ae);}),()=>{W=true;}},[e?.merchantIdentifier]),qi.useEffect(()=>(B.current=false,()=>{B.current=true,b.current&&clearTimeout(b.current);}),[]);let ro=qi.useRef(false);qi.useEffect(()=>{if(ro.current)return;if(!e?.externalUserId){ia(),Bi=null,ke.current=null,x(false);return}let F=false;return (async()=>{try{let W=await Jm();if(F||!W){F||x(!1);return}if(W.externalUserId!==e.externalUserId){await ia(),Bi=null,ke.current=null,F||x(!1);return}let ae=Date.now()>=W.expiresAt,Te=W.accessToken,Se=W.refreshToken;if(ae)try{let ut=await xu(W.refreshToken,W.customerId);if(F)return;Te=ut.access_token,Se=ut.refresh_token??ut.refresh?.refresh_token??W.refreshToken,await Uu({accessToken:Te,refreshToken:Se,customerId:W.customerId,externalUserId:e.externalUserId,email:W.email,expiresAt:Date.now()+(ut.expires_in??3600)*1e3});}catch(ut){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",ut?.message),await ia(),Bi=null,ke.current=null,F||x(!1);return}if(F)return;if(ro.current=!0,ie(W.customerId),Y.current=W.customerId,$(Te),Q.current=Te,le.current=Se,W.email&&(D(W.email),rt.current=W.email),Bi===W.customerId)ke.current=Promise.resolve({error:void 0});else {let ut=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:W.customerId});ut.error?console.error("[useStripeOnramp] restore configureSDK error:",ut.error.message):Bi=W.customerId,ke.current=Promise.resolve(ut);}if(F)return;let nt=()=>new Promise(ut=>{let or=()=>{De.current&&ne.current?ut():setTimeout(or,200);};or();});try{if(await Promise.race([nt(),new Promise((or,bt)=>setTimeout(()=>bt(new Error("timeout")),1e4))]),F)return;let ut=ne.current.toLowerCase();await p(ut,ye.current);}catch(ut){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",ut?.message);}if(F)return;try{let or=(await Kn(Y.current,Q.current)).kyc_tiers??[],bt=or.find(Ro=>Ro.tier==="l0"),Fr=or.find(Ro=>Ro.tier==="l1"),Jr=or.find(Ro=>Ro.tier==="l2"),zr=bt?.verification_status==="verified",Yo=Fr?.verification_status==="verified",nr=Jr?.verification_status==="verified",Nn=!!bt?.verification_status&&bt.verification_status!=="not_started";m(zr||Yo||nr?"session_params":Nn?"kyc_offer":"kyc");}catch{m("kyc");}}finally{F||x(false);}})(),()=>{F=true;}},[]),qi.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||we)return;let F=false;Qe(true);async function W(){try{let[ae,Te]=await Promise.all([Am({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?Wm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(nr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",nr?.message),null)):Promise.resolve(null)]);if(F)return;let Se=e?.destinationChainType??"ethereum",nt=ae.data.find(nr=>nr.chain_type===Se);if(nt?.address){let nr=nt.address.toLowerCase();Re(nr),ne.current=nr,nt.recipient_address&&at(nt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",Se,"in",ae.data?.length,"wallets");let ut={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},or={8453:"base",1:"ethereum",137:"polygon"},bt=Te?.destination_network,Fr="none";if(bt&&ut[bt])be(ut[bt]),ye.current=ut[bt],Fr=bt+" (from default_token API)";else if(e?.destinationChainId&&or[e.destinationChainId]){let nr=or[e.destinationChainId];ut[nr]&&(be(ut[nr]),ye.current=ut[nr]),Fr=nr+" (from chain_id "+e.destinationChainId+")";}else ut[Se]&&(be(ut[Se]),ye.current=ut[Se],Fr=Se+" (from chain_type fallback)");Te?.destination_currency&&rr(Te.destination_currency.toLowerCase());let Jr=Te?.destination_token_metadata,zr=vi(Jr?.icon_urls,Jr?.icon_url),Yo=vi(Jr?.chain?.icon_urls,Jr?.chain?.icon_url);zr&&ge(zr),Yo&&H(Yo),G(!0),De.current=!0;}catch(ae){if(F)return;console.error("[resolveWallet] Failed to resolve wallet:",ae?.message),G(true),De.current=true;}finally{F||Qe(false);}}return Ae.current=W(),()=>{F=true;}},[e?.publishableKey,e?.externalUserId,Ze]);let Kt=qi.useCallback(async()=>{if(ke.current)return ke.current;let F=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(W=>(W.error&&(console.error("[useStripeOnramp] configureSDK error:",W.error.message,W.error.code),ke.current=null),W)).catch(W=>{throw console.error("[useStripeOnramp] configureSDK threw:",W?.message??W),ke.current=null,W});return ke.current=F,F},[o,e?.merchantDisplayName]);qi.useEffect(()=>{e?.externalUserId||Kt();},[]);let Mr=qi.useCallback(async F=>{if(!Je.current){Je.current=true,_(true),Dt(),d("Creating auth intent...");try{let W=await ku(F);d("Waiting for authorization...");let ae=await i(W);if(ae?.error){X("authorization_error","Something went wrong during authorization. Please try again."),m("email");return}if(ae?.status==="Denied"){X("authorization_error","Authorization denied by user."),m("email");return}if(ae?.status!=="Consented"||!ae.customerId){X("authorization_error","Authorization was canceled."),m("email");return}d("Exchanging tokens...");let Te=ae.customerId,Se=await Vm(W,Te),nt=Se.access_token,ut=Fe(Se);D(F),rt.current=F,ie(Te),Y.current=Te,Bi=Te,$(nt),Ft(Te,nt,ut,Se.expires_in??3600,F),d("Checking verification status...");try{let bt=(await Kn(Te,nt)).kyc_tiers??[],Fr=bt.find(co=>co.tier==="l0"),Jr=bt.find(co=>co.tier==="l1"),zr=bt.find(co=>co.tier==="l2"),Yo=Fr?.verification_status==="verified",nr=Jr?.verification_status==="verified",Nn=zr?.verification_status==="verified",Ro=!!Fr?.verification_status&&Fr.verification_status!=="not_started";if(d(""),Yo||nr||Nn){Ae.current&&(d("Resolving wallet..."),await Ae.current,d(""));let co=ne.current;if(co)try{let xi=co.toLowerCase(),ec=ye.current,$n=await p(xi,ec);$n?.error?(console.warn("[proceedToAuthorize] wallet registration error:",$n.error.message),X("wallet_error",$n.error.message,$n.error.code),m("wallet")):m("session_params");}catch(xi){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",xi?.message),m("wallet");}else m("wallet");}else Ro?(await Hn(),d(""),m("kyc_offer")):m("kyc");}catch(or){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",or?.message),d(""),m("kyc");}}catch(W){X("authorization_error",W?.message??String(W)),m("email");}finally{Je.current=false,_(false);}}},[i,Dt,X,Ft,p,Ie]),Br=qi.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!f){X("validation_error","Please enter an email address.");return}_(true),Dt(),d("");try{d("Configuring...");let F=await Kt();if(F.error){X("configuration_error",F.error.message,F.error.code);return}d("Checking Link account...");let W=await n(f);if(W.error){X("authorization_error",W.error.message,W.error.code);return}W.hasLinkAccount?await Mr(f):(d(""),m("disclaimer"));}catch(F){X("unknown_error",F?.message??String(F));}finally{_(false);}},[Dt,Kt,f,X,n,Mr]),Ns=qi.useCallback(async()=>{if(!ze.current){if(!L){X("validation_error","Please enter your phone number.");return}ze.current=true,_(true),Dt(),d("");try{d("Creating Link account...");let F=await s({email:f,phone:L,fullName:I||f,country:U||"US"});if(F.error){X("registration_error",F.error.message,F.error.code);return}await Mr(f);}catch(F){X("registration_error",F?.message??String(F));}finally{ze.current=false,_(false);}}},[Dt,U,f,X,I,L,s,Mr]);qi.useEffect(()=>{if(h!=="email")return;let F=Me.current||Hu;if(F&&(Me.current=false,Hu=false),!e?.email||w)return;if(F){S(true);return}let W=++Be.current,ae=false,Te=()=>ae||Be.current!==W;return e?.phone?(async()=>{_(true),Dt();try{d("Configuring...");let Se=await Kt();if(Te())return;if(Se.error){X("configuration_error",Se.error.message,Se.error.code);return}d("Checking Link account...");let nt=await n(e.email);if(Te())return;if(nt.error){X("authorization_error",nt.error.message,nt.error.code);return}if(nt.hasLinkAccount){if(Te())return;await Mr(e.email);}else {if(Te())return;d(""),m("disclaimer");}}catch(Se){Te()||X("unknown_error",Se?.message??String(Se));}finally{_(false);}})():(async()=>{_(true),Dt();try{d("Configuring...");let Se=await Kt();if(Te())return;if(Se.error){X("configuration_error",Se.error.message,Se.error.code);return}d("Checking Link account...");let nt=await n(e.email);if(Te())return;if(nt.error){X("authorization_error",nt.error.message,nt.error.code);return}if(nt.hasLinkAccount){if(Te())return;await Mr(e.email);}else {if(Te())return;d(""),m("disclaimer");}}catch(Se){Te()||X("unknown_error",Se?.message??String(Se));}finally{_(false);}})(),()=>{ae=true;}},[h,e?.email,e?.phone,w]);let Hn=qi.useCallback(async()=>{Ae.current&&(d("Resolving wallet..."),await Ae.current);let F=ne.current;if(F)try{d("Registering wallet...");let W=F.toLowerCase(),ae=ye.current;await p(W,ae);}catch(W){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",W?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Gl=qi.useCallback(async(F,W)=>{_(true),Dt(),d(""),Ht(nt=>({...nt,...F}));let ae=!W,Te=W??"kyc_offer",Se=W?"kyc_l1":"kyc";try{let nt=F.dobDay&&F.dobMonth&&F.dobYear,ut=F.firstName&&F.lastName,or={};ut&&(or.firstName=F.firstName,or.lastName=F.lastName),F.addressLine1&&(or.address={line1:F.addressLine1,line2:F.addressLine2||void 0,city:F.city,state:F.state,postalCode:F.postalCode,country:F.country}),F.idNumber&&(or.idNumber=F.idNumber),nt&&(or.dateOfBirth={day:parseInt(F.dobDay,10),month:parseInt(F.dobMonth,10),year:parseInt(F.dobYear,10)});let bt=await a(or);if(bt?.error?.message&&(/no active link consumer/i.test(bt.error.message)||/not be verified/i.test(bt.error.message))){if(d("Verifying identity..."),!await ss()){X("kyc_error","Please verify your identity to continue."),m(Se);return}bt=await a(or);}if(bt?.error){let nr=ae?"l0":"l1";try{let Ro=(await Kn(Y.current,Q.current)).kyc_tiers?.find(co=>co.tier===nr);if(Ro?.verification_status==="verified"){let co=ae?"session_params":Te;await Hn(),d(""),m(co);return}if(Ro?.verification_status==="rejected"){if(ae){await Hn(),d(""),m(Te);return}X("kyc_error","Something went wrong. Please try again."),m(Se);return}}catch(Nn){console.warn("[attachKyc] could not fetch verification status:",Nn?.message);}if(ae){await Hn(),d(""),m(Te);return}X("kyc_error",bt.error.message,bt.error.stripeErrorCode??bt.error.code),m(Se);return}if(!(bt&&Object.keys(bt).length>0&&!bt.error)){let nr=ae?"l0":"l1";if(d("Verifying identity..."),(!Y.current||!Q.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${nr} \u2014 missing customerIdRef or accessTokenRef`),!ae)){X("kyc_error","Unable to verify identity. Please try again."),m(Se);return}let Nn=Y.current,Ro=Q.current,co=10,xi=!1;if(Nn&&Ro)for(let ec=0;ec<co;ec++){try{let Gd=(await Kn(Nn,Ro)).kyc_tiers?.find(vg=>vg.tier===nr);if(Gd?.verification_status==="verified"){xi=!0;break}if(Gd?.verification_status==="rejected"){if(ae)break;console.warn(`[attachKyc] \u274C ${nr} rejected:`,Gd?.verification_errors),X("kyc_error","KYC verification was rejected. Please try again."),m(Se);return}}catch($n){console.warn(`[attachKyc] ${nr} poll error:`,$n?.message);}await new Promise($n=>setTimeout($n,2e3));}if(!xi&&!ae){console.warn(`[attachKyc] \u274C ${nr} verification timed out after`,co,"attempts"),X("kyc_error","Identity verification is taking longer than expected. Please try again."),m(Se);return}await Hn(),d(""),m(ae&&xi?"session_params":Te);return}d("Please review your KYC information...");let zr=await l(null);if(zr?.error){X("kyc_error",zr.error.message,zr.error.stripeErrorCode??zr.error.code),m(Se);return}if(zr?.status==="UpdateAddress"){X("kyc_error","Please update your address and resubmit."),m(Se);return}await Hn(),d(""),m(ae?"session_params":Te);}catch(nt){X("kyc_error",nt?.message??String(nt)),m(Se);}finally{_(false);}},[a,Dt,X,l,Hn]),ss=qi.useCallback(async()=>{let F=rt.current||e?.email;if(!F)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(rt.current),"config.email:",e?.email),false;try{let W=await ku(F),ae=await i(W);return ae?.status==="Consented"&&ae.customerId?(Y.current=ae.customerId,ie(ae.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",ae?.status),!1)}catch(W){return console.warn("[reestablishLinkSession] failed:",W?.message),false}},[i,e?.email]),Jl=qi.useCallback(async()=>{if(!Ye.current){Ye.current=true,_(true),Dt(),d("Launching identity verification...");try{let F=await u();if(F?.error?.message&&(/no active link consumer/i.test(F.error.message)||/not be verified/i.test(F.error.message))){if(d("Verifying identity..."),!await ss()){X("identity_error","Please verify your identity to continue.");return}F=await u();}if(F?.error){let ae=F.error.message??"";if(/cancel/i.test(ae)){d("");return}X("identity_error",ae,F.error.code);return}d(""),as.current?(as.current=!1,m("session_params")):m("wallet");}catch(F){X("identity_error",F?.message??String(F));}finally{Ye.current=false,_(false);}}},[Dt,X,ss,u]),as=qi.useRef(false);qi.useEffect(()=>{h==="identity"&&!k&&Jl();},[h]);let Zl=qi.useCallback(async()=>{if(!_e){X("validation_error","Please enter a wallet address.");return}_(true),Dt(),d("");try{let F=_e.toLowerCase(),W=await p(F,Ie);if(W?.error){console.warn("[registerWallet] error:",W.error.message),X("wallet_error",W.error.message,W.error.code);return}d(""),m("kyc_offer");}catch(F){console.error("[registerWallet] exception:",F?.message??String(F)),X("wallet_error",F?.message??String(F));}finally{_(false);}},[Dt,X,_e,Ie,p]);qi.useEffect(()=>{h==="wallet"&&we&&_e&&Zl();},[h,we,_e]);let $s=qi.useCallback(F=>{B.current=false,O.current=0;let W=0,ae=async()=>{W+=1;let Te=Q.current;try{let Se=await Bm(F,Te);if(B.current)return;O.current=0,Se.status==="fulfillment_complete"?(ve(Se),m("success")):b.current=setTimeout(ae,3e3);}catch(Se){if(B.current)return;let nt=Se?.message??"";if((nt.includes("stripe_onramp_forbidden")||nt.includes("403"))&&await ot()&&!B.current){b.current=setTimeout(ae,1e3);return}if(O.current+=1,console.error(`[pollSessionStatus] poll #${W} error:`,nt),O.current>=sb){X("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}b.current=setTimeout(ae,5e3);}};b.current=setTimeout(ae,3e3);},[X,ot]),Qd=qi.useCallback(()=>{if(Ue.current==="processing"&&We?.id){if(!Q.current){X("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Dt(),O.current=0,b.current&&(clearTimeout(b.current),b.current=null),$s(We.id);}},[Dt,X,$s,We?.id]),Ti=qi.useCallback(async F=>{_(true),Dt(),d("");try{d("Confirming purchase...");let W=await Xe(ae=>Om(F,ae));ve(W),m("processing"),d(""),$s(W.id);}finally{_(false);}},[Dt,$s,Xe]),ja=qi.useRef(false),Yd=qi.useCallback(async()=>{if(!(!We||ja.current)){ja.current=true;try{_(!0),Dt(),d("Refreshing quote...");let F=await Xe(W=>Ru(We.id,W));ve(F),await Ti(F.id);}catch{X("session_error","Something went wrong. Please try again."),m("quote");}finally{_(false),ja.current=false;}}},[Dt,X,Ti,We,Xe]),de=qi.useCallback(async(F=false,W,ae)=>{let Te=W??Oe;if(!Te||isNaN(Number(Te))||Number(Te)<=0){X("validation_error","Please enter a valid amount.");return}W&&zt(W),_(true),Dt(),d("");try{let Se=await Kt();if(Se.error){X("configuration_error",Se.error.message,Se.error.code);return}let nt;if(ae)nt=ae;else if(F){if(!e?.merchantIdentifier?.trim()){X("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),m("session_params");return}d("Opening Apple Pay...");let bt={applePay:{merchantCountryCode:"US",currencyCode:Ut.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${yt.toUpperCase()} purchase + fees`,amount:Te}]}},Fr=await g("PlatformPay",bt);if(Fr?.error){let zr=Fr.error.message??"",Yo=Fr.error.code??"";/cancel/i.test(zr)||/cancel/i.test(Yo)||(X("payment_error",zr,Yo),m("session_params"));return}if(!Fr?.displayData)return;d("Creating payment token...");let Jr=await T();if(Jr?.error){X("payment_error",Jr.error.message,Jr.error.code),m("session_params");return}nt=Jr.cryptoPaymentToken;}else {d("Select a payment method...");let bt=await g("Card");if(bt?.error){let Jr=bt.error.message??"",zr=bt.error.code??"";/cancel/i.test(Jr)||/cancel/i.test(zr)||(X("payment_error",Jr,zr),m("session_params"));return}if(!bt?.displayData)return;d("Creating payment token...");let Fr=await T();if(Fr?.error){X("payment_error",Fr.error.message,Fr.error.code),m("session_params");return}nt=Fr.cryptoPaymentToken;}d("Creating onramp session...");let ut=ne.current||_e;if(!ut){X("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let or=await Xe(bt=>Dm({cryptoCustomerId:Y.current,paymentToken:nt,sourceAmount:Number(Te),sourceCurrency:Ut,destinationCurrency:yt,walletAddress:ut,destinationNetwork:Ie},bt));ve(or),d(""),F?await Ti(or.id):m("quote");}catch{X("session_error","Something went wrong. Please try again."),m("session_params");}finally{_(false),d("");}},[Dt,Kt,g,T,yt,X,Ti,zt,Oe,Ut,_e,Ie,Xe,e?.merchantIdentifier]),Ee=qi.useCallback(async()=>{_(true),Dt(),d("Select a payment method...");try{let F=await Kt();if(F.error)return X("configuration_error",F.error.message,F.error.code),null;let W=await g("Card");if(W?.error?.message&&(/no active link consumer/i.test(W.error.message)||/not be verified/i.test(W.error.message))){if(!await ss())return X("authorization_error","Please verify your identity to add a payment method."),null;W=await g("Card");}if(W?.error){let nt=W.error.message??"",ut=W.error.code??"";return /cancel/i.test(nt)||/cancel/i.test(ut)||X("payment_error",nt,ut),null}if(!W?.displayData)return null;let Te=W.displayData;d("Saving payment method...");let Se=await T();return Se?.error?(X("payment_error",Se.error.message,Se.error.code),null):{token:Se.cryptoPaymentToken,sublabel:Te.sublabel??""}}catch(F){return X("session_error",F?.message??String(F)),null}finally{_(false),d("");}},[Dt,Kt,g,T,X,ss]),mr=qi.useCallback(async()=>{if(We){_(true),Dt(),d("");try{let F=await Xe(W=>Ru(We.id,W));ve(F);}catch{X("session_error","Something went wrong. Please try again.");}finally{_(false);}}},[Dt,X,We,Xe]),pn=qi.useCallback(()=>{B.current=true,O.current=0,b.current&&(clearTimeout(b.current),b.current=null),m(r),_(false),S(false),d(""),C(null),D(e?.email??""),rt.current=e?.email??"",V(e?.phone??""),E(""),q("US"),ie(""),Y.current="",$(""),Q.current="",le.current="",G(false),Qe(false),Ae.current=null,He(F=>F+1),Ht(Nu),Re(""),ne.current="",De.current=false,be(stripeReactNative.Onramp.CryptoNetwork.ethereum),zt(e?.defaultSourceAmount??"100"),wt(e?.defaultSourceCurrency??"usd"),rr(e?.defaultDestinationCurrency??"usdc"),at(""),ge(void 0),H(void 0),ve(null),Be.current+=1,Je.current=false,Ye.current=false,ze.current=false;},[e,r]),Xl=qi.useCallback(()=>{as.current=true,m("kyc_offer");},[]),ki=qi.useCallback(async()=>{await ia(),Bi=null,ke.current=null,Hu=true,Me.current=true,B.current=true,O.current=0,b.current&&(clearTimeout(b.current),b.current=null),Be.current+=1,Je.current=false,Ye.current=false,ze.current=false,Q.current="",le.current="",Y.current="",ne.current="",De.current=false,Ae.current=null,$(""),ie(""),D(e?.email??""),rt.current=e?.email??"",V(e?.phone??""),E(""),q("US"),ve(null),C(null),_(false),S(false),d(""),Ht(Nu),Re(""),G(false),Qe(false),He(F=>F+1),at(""),ge(void 0),H(void 0),m(r);},[e?.email,e?.phone,r]);return {step:h,restoring:w,loading:k,status:R,error:c,email:f,phone:L,fullName:I,country:U,customerId:Ke,accessToken:Ge,session:We,kycData:dt,walletAddress:_e,resolvedRecipientAddress:Ve,walletNetwork:Ie,sourceAmount:Oe,sourceCurrency:Ut,destinationCurrency:yt,tokenIconUrl:Ne,networkIconUrl:Pe,applePaySupported:ue,walletReady:we,walletLoading:se,setStep:m,setStatus:d,setEmail:D,setPhone:V,setFullName:E,setCountry:q,setWalletAddress:Re,setWalletNetwork:be,setSourceAmount:zt,setSourceCurrency:wt,setDestinationCurrency:rr,checkEmail:Br,register:Ns,attachKyc:Gl,verifyIdentity:Jl,requestKYCUpgrade:Xl,kycUpgradeMode:as,logout:ki,registerWallet:Zl,collectPaymentMethod:de,addPaymentMethod:Ee,refreshQuote:mr,confirmCheckout:Yd,reset:pn,clearError:Dt,emitComplete:Hs,resumeFulfillmentPolling:Qd,amountFirst:t,switchingAccount:v}}function Zm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=bn(),{colors:a,fonts:l,components:u}=A(),p=u.input.placeholderColor,[g,T]=qi.useState(e.dobMonth??""),[h,m]=qi.useState(e.dobDay??""),[w,x]=qi.useState(e.dobYear??""),[k,_]=qi.useState(e.idNumber??""),[v,S]=qi.useState(null),R=qi.useRef(null),d=qi.useRef(null),c=qi.useRef(null),C=g.length===2&&h.length===2&&w.length===4&&k.trim().length>0,f=()=>{if(!C)return;let L=parseInt(g,10),V=parseInt(h,10),I=parseInt(w,10),E=new Date().getFullYear();if(L<1||L>12){S("Please enter a valid month (01\u201312).");return}if(V<1||V>31){S("Please enter a valid day (01\u201331).");return}if(I<1900||I>E){S(`Please enter a valid year (1900\u2013${E}).`);return}S(null),o({dobMonth:g,dobDay:h,dobYear:w,idNumber:k});},D=v||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(jt,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Tt,{style:i.form.flex,contentContainerStyle:kn.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:kn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:kn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:kn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,kn.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);T(V),V.length===2&&R.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:kn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:R,style:[i.form.input,kn.dobInput],placeholder:"DD",placeholderTextColor:p,value:h,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);m(V),V.length===2&&d.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:kn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:d,style:[i.form.input,kn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:w,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,4);x(V),V.length===4&&c.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:kn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:c,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:k,onChangeText:_,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:f,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),D?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:D}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!C&&i.form.continueBtnDisabled],onPress:f,disabled:!C,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!C&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var kn=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 Xm({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=qi.useRef(new reactNative.Animated.Value(.3)).current;return qi.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Vt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:Vt.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Vt.skeletonLine,{width:"60%"}]})]})}function ef({onRefresh:e,colors:t,fonts:r}){let[o,n]=qi.useState(10),s=qi.useRef(null);qi.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=qi.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:Vt.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(Ys,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[Vt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function nf({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:u="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:T=false,currentLimit:h}){let m=bn(),{colors:w,fonts:x,components:k}=A(),_=[Vt.card,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius??12,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],v=[..._,{opacity:.5}],S=l==="verified",R=l==="pending",d=l==="rejected",c=u==="verified",C=u==="pending",f=S&&c,D=!S,L=!c,V=S,I=(T||S)&&!f,E=U=>`$${U.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx(jt,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Vt.content,children:[h!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[Vt.limitBadge,{backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth,borderRadius:k.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.limitLabel,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.limitValue,{color:w.foreground,fontFamily:x.semibold}],children:[E(h)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.subtitle,{color:w.foregroundMuted,fontFamily:x.regular}],children:i?"Checking your verification status...":f?"All verification levels have been completed. Your limits are at the maximum available.":T?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xm,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth}),jsxRuntime.jsx(Xm,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&(R?jsxRuntime.jsxs(reactNative.View,{style:_,children:[jsxRuntime.jsxs(reactNative.View,{style:Vt.pendingHeader,children:[jsxRuntime.jsx(uo,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:w.foreground,fontFamily:x.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(ef,{onRefresh:n,colors:w,fonts:x}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Vt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(St,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[_,Vt.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(uo,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Vt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:w.foreground,fontFamily:x.semibold}],children:d?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:d?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Ur,{size:18,color:w.foregroundMuted,strokeWidth:2})]})),L&&(C?jsxRuntime.jsxs(reactNative.View,{style:_,children:[jsxRuntime.jsxs(reactNative.View,{style:Vt.pendingHeader,children:[jsxRuntime.jsx(oc,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:w.foreground,fontFamily:x.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(ef,{onRefresh:n,colors:w,fonts:x}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Vt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(St,{size:18,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[_,Vt.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(oc,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Vt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:w.foreground,fontFamily:x.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Ur,{size:18,color:w.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[v,Vt.cardRow],children:[jsxRuntime.jsx(oc,{size:20,color:w.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Vt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardTitle,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.cardBody,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Vt.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[m.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:Vt.loaderRow,children:[jsxRuntime.jsx(St,{size:24,strokeWidth:2,gradientFrom:w.primary,gradientTo:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[m.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):f?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Done"})}):I?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Vt=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var Oc={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 af({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=A(),a=[nn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:nn.logoRow,children:jsxRuntime.jsx(um,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:nn.scroll,contentContainerStyle:nn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[nn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[nn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[nn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[nn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Oc.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:nn.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 nn=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 lf({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:u}){let{colors:p}=A();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(St,{size:56,strokeWidth:3}),jsxRuntime.jsx(po,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(po,{error:n,progress:s,loading:o})]})]})})}function df({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(St,{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(po,{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 pf({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:u,onRetryStatusCheck:p}){let{colors:g}=A(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx(jt,{onPress:u}):jsxRuntime.jsx(reactNative.View,{style:bc}),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(St,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
+
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(wc,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(po,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function mf({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:u}){let{colors:p}=A(),g=t.transaction_details,T=yc(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:u??l,title:"Review your purchase",variant:u?"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(ta,{currency:g.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(en,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"You receive",value:`${T} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(en,{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(St,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]})}function ff({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:u}){let p=A(),{colors:g,fonts:T,components:h}=p,[m,w]=qi.useState("");qi.useEffect(()=>{if(t)return;let _=m?`+1${m}`:"";a(_);},[m,a,t]);let x=qi.useCallback(_=>{w(_.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(St,{size:56,strokeWidth:3}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]});let k=m.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:u}),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:bl.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[bl.countryPrefix,{backgroundColor:h.card.backgroundColor,borderColor:h.input.borderColor,borderRadius:h.input.borderRadius,borderWidth:h.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:bl.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[bl.dialCode,{color:g.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,bl.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:m,onChangeText:x,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>k&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!k&&e.form.continueBtnDisabled],onPress:l,disabled:!k,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!k&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]})})}var bl=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 Bb({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=A(),n=e.toLowerCase(),s=Cc[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:[In.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[In.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[In.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(lt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function hf({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:u}=A(),p=t.transaction_details,g=yc(p.destination_amount,p.destination_currency),T=r||o||"";ea(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Tt,{style:e.form.flex,contentContainerStyle:In.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:In.iconSection,children:[jsxRuntime.jsx(Bb,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:In.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[In.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[In.statusText,{color:a.foreground,fontFamily:u.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[In.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(wc,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},In.detailCard],children:[jsxRuntime.jsx(en,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(en,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Tu,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(Tu,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(en,{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 In=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 gf({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:u,registerWallet:p,onClose:g}){let{colors:T,components:h}=A();if(t){let m=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!m&&jsxRuntime.jsx(St,{size:56,strokeWidth:3}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]}),m&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(jt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:h.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:hc.map(m=>{let w=i===m.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,w&&e.wallet.rowSelected],onPress:()=>{l(m.value),u(m.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(m.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,w&&e.wallet.rowTextSelected],children:m.label}),w&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(lt,{size:14,color:h.container.buttonTitleColor,strokeWidth:2.5})})]},m.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(St,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(po,{error:o,progress:n,loading:r})]})]})})}function Mc({config:e,onClose:t}){let r=A(),o=bn(),{step:n,restoring:s,loading:i,status:a,error:l,email:u,phone:p,session:g,kycData:T,walletAddress:h,resolvedRecipientAddress:m,walletNetwork:w,sourceAmount:x,sourceCurrency:k,destinationCurrency:_,tokenIconUrl:v,networkIconUrl:S,applePaySupported:R,setStep:d,setEmail:c,setPhone:C,setWalletAddress:f,setWalletNetwork:D,setSourceAmount:L,setDestinationCurrency:V,checkEmail:I,register:E,attachKyc:U,verifyIdentity:q,registerWallet:Ke,collectPaymentMethod:ie,addPaymentMethod:Ge,confirmCheckout:$,reset:le,emitComplete:Q,resumeFulfillmentPolling:Y,amountFirst:we,customerId:G,accessToken:se,requestKYCUpgrade:Qe,kycUpgradeMode:Be,logout:Je,clearError:Ye,switchingAccount:ze}=Fc(e),Me=!!e?.email&&!ze,rt=!!e?.phone,De=!!e?.publishableKey&&!!e?.externalUserId,[Ae,ne]=qi.useState(void 0),[ye,ke]=qi.useState(void 0),[Ze,He]=qi.useState([]),[dt,Ht]=qi.useState(false),[_e,Re]=qi.useState(false),[Ve,at]=qi.useState(null),[Ie,be]=qi.useState(null),[Oe,zt]=qi.useState(null),[Ut,wt]=qi.useState(false),yt=qi.useCallback(async()=>{await Je(),t?.();},[Je,t]);qi.useEffect(()=>{n!=="kyc_offer"||!G||!se||(wt(true),Kn(G,se).then(ge=>{let Pe=ge.kyc_tiers??[],H=Pe.find(b=>b.tier==="l0"),ue=Pe.find(b=>b.tier==="l1"),P=Pe.find(b=>b.tier==="l2");H?.verification_status&&at(H.verification_status),ue?.verification_status&&be(ue.verification_status),P?.verification_status&&zt(P.verification_status);}).catch(ge=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",ge?.message);}).finally(()=>wt(false)),h&&_u({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:se,cryptoCustomerId:G}).then(ge=>{let Pe=ge.limits?.usd;if(Pe?.card?.length){let H=Math.max(...Pe.card.map(ue=>ue.limit));ne(H);}}).catch(ge=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",ge?.message);}));},[n,G,se,h,w]),qi.useEffect(()=>{if(s||n!=="session_params"||!G||!se)return;let ge=H=>{let ue=H?.message??"";return ue.includes("stripe_onramp_forbidden")||ue.includes("403")},Pe=H=>{ge(H)&&yt();};Kn(G,se).then(H=>{let ue=H.kyc_tiers??[],P=ue.find(M=>M.tier==="l0"),b=ue.find(M=>M.tier==="l1"),B=ue.find(M=>M.tier==="l2"),O=!!b?.verification_status&&b.verification_status!=="not_started",J=B?.verification_status==="verified";Ht(O),Re(!!J),P?.verification_status&&at(P.verification_status),b?.verification_status&&be(b.verification_status),B?.verification_status&&zt(B.verification_status);}).catch(H=>{console.warn("[OnrampScreen] customer fetch error:",H?.message),Pe(H);}),Iu(G,se).then(H=>{He(H.data??[]);}).catch(H=>{console.warn("[OnrampScreen] payment_tokens error:",H?.message),Pe(H);}),h&&_u({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:se,cryptoCustomerId:G}).then(H=>{let ue=H.limits?.usd;if(ue?.card?.length){let P=Math.max(...ue.card.map(b=>b.limit));ne(P);}}).catch(H=>{console.warn("[OnrampScreen] transaction_limits error:",H?.message),Pe(H);}),ol(e?.publishableKey).then(H=>{let ue=H.data?.find(P=>P.currency_code==="usd");ue&&ke(ue.minimum_amount);}).catch(H=>{console.warn("[OnrampScreen] fiat_currencies error:",H?.message);});},[s,n,G,se,h,w,le,yt]);let rr=async()=>{if(!(!G||!se))try{let ge=await Iu(G,se);He(ge.data??[]);}catch(ge){console.warn("[OnrampScreen] payment_tokens refresh error:",ge?.message);let Pe=ge?.message??"";(Pe.includes("stripe_onramp_forbidden")||Pe.includes("403"))&&yt();}},We=async()=>{let ge=await Ge();return ge&&await rr(),ge},ve=e?.skipSuccessConfirmation===true;qi.useEffect(()=>{n==="success"&&ve&&g&&(Q(g),le(),t?.());},[n,ve,g,Q,le,t]),qi.useEffect(()=>{n==="register"&&rt&&E();},[n,rt,E]);let Ne=()=>{le(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[Hb.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(St,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(af,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>d("register"),onClose:()=>d("email")});if(n==="email")return jsxRuntime.jsx(lf,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Me,loading:i,error:l,status:a,email:u,setEmail:c,checkEmail:I,onClose:Ne});if(n==="register")return jsxRuntime.jsx(ff,{styles:o,hasPrefilledPhone:rt,loading:i,error:l,status:a,email:u,phone:p,setPhone:C,register:E,onClose:Ne});if(n==="kyc")return jsxRuntime.jsx(Pc,{initialData:T,loading:i,onComplete:U,onCancel:Ne});if(n==="kyc_offer"){let H=Ve==="verified"||Ie==="verified"||Oe==="verified",ue=()=>{Be.current&&(Be.current=false),d("session_params");};return jsxRuntime.jsx(nf,{onSelectL1:()=>d("kyc_l1"),onSelectL2:()=>{Be.current=true,d("identity");},onSkip:ue,onClose:()=>{Be.current?(Be.current=false,d("session_params")):H?ue():Ne();},onRefresh:()=>{!G||!se||(wt(true),Kn(G,se).then(B=>{let O=B.kyc_tiers??[],J=O.find(Ue=>Ue.tier==="l0"),M=O.find(Ue=>Ue.tier==="l1"),$e=O.find(Ue=>Ue.tier==="l2");J?.verification_status&&at(J.verification_status),M?.verification_status&&be(M.verification_status),$e?.verification_status&&zt($e.verification_status);}).catch(B=>{console.warn("[OnrampScreen] refresh customer fetch error:",B?.message);}).finally(()=>wt(false)));},loading:i,loadingTiers:Ut,error:l?.message,l1Status:Ie??"not_started",l2Status:Oe??"not_started",l1Completed:dt,l2Completed:_e,canPurchase:H,currentLimit:H?Ae:void 0})}if(n==="kyc_l1"){let ge=Be.current?"session_params":"wallet";return jsxRuntime.jsx(Zm,{initialData:T,loading:i,error:l?.message,onComplete:Pe=>{Be.current&&(Be.current=false),U(Pe,ge);},onCancel:()=>{Ye(),d("kyc_offer");},onClose:Ne})}return n==="identity"?jsxRuntime.jsx(df,{styles:o,loading:i,status:a,error:l,verifyIdentity:q,onClose:()=>{Be.current?(Be.current=false,d("session_params")):Ne();}}):n==="wallet"?jsxRuntime.jsx(gf,{styles:o,hasAutoWallet:De,loading:i,error:l,status:a,walletAddress:h,walletNetwork:w,setWalletAddress:f,setWalletNetwork:D,setDestinationCurrency:V,registerWallet:Ke,onClose:Ne}):n==="session_params"?jsxRuntime.jsx(vc,{initialAmount:x,currency:k,applePaySupported:R,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:ye,maxAmount:Ae,paymentTokens:Ze,onAddPaymentMethod:We,onCollectPayment:(ge,Pe)=>{ie(ge,Pe);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(ge,Pe)=>{if(we&&!G)L(ge),d("email");else {let H=Pe==="apple_pay";ie(H,ge,!H&&Pe?Pe:void 0);}},onCancel:Ne,accessToken:se,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:yt,onRequestKYC:Qe,showSwitchAccount:!Me,inputDisabled:(Ve!==null||Ie!==null)&&Ve!=="verified"&&Ie!=="verified"&&Oe!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(mf,{styles:o,session:g,loading:i,error:l,status:a,confirmCheckout:$,tokenIconUrl:v,networkIconUrl:S,onClose:Ne,onBack:()=>d("session_params")}):n==="processing"?jsxRuntime.jsx(pf,{styles:o,error:l,status:a,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??_,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:v,networkIconUrl:S,onClose:Ne,onRetryStatusCheck:Y}):n==="success"&&g&&!ve?jsxRuntime.jsx(hf,{styles:o,session:g,resolvedRecipientAddress:m,recipientFromConfig:e?.recipientAddress,tokenIconUrl:v,networkIconUrl:S,onDone:()=>{Q(g),le(),t?.();}}):null}var Hb=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function yf(){try{let e=Nb__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let s=n.trim();if(s.length>0)return s}}}catch{}}function zc({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:u,onError:p,onStepChange:g,onClose:T,merchantIdentifier:h="",urlScheme:m="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:x=false,appName:k}){let{colors:_,fonts:v,components:S}=A(),R=e||cc(),d=qi.useMemo(()=>{let V=h.trim();return V.length>0?V:yf()??""},[h]),[c,C]=qi.useState("loading"),[f,D]=qi.useState(null);qi.useEffect(()=>{let V=false;async function I(){try{R&&(Sc(R),Tc(rl()));let E=await kc();if(V)return;let U=d.trim();if(await stripeReactNative.initStripe({publishableKey:E,urlScheme:m,...U?{merchantIdentifier:U}:{}}),V)return;C("ready");}catch(E){if(V)return;console.error("[StripeOnramp] Init failed:",E),D(E?.message??"Failed to load Stripe configuration"),C("error");}}return I(),()=>{V=true;}},[R,d,m]);let L=qi.useMemo(()=>{let V={publishableKey:R,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:u,onError:p,onStepChange:g};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),w&&(V.paymentSelectorPosition=w),V.skipSuccessConfirmation=x,V.merchantIdentifier=d,k&&(V.merchantDisplayName=k),V},[R,o,s,i,a,l,t,r,n,w,x,d,k,u,p,g]);return c==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ua.centered,{backgroundColor:_.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ua.errorText,{color:_.error,fontFamily:v.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ua.errorDetail,{color:_.foregroundMuted,fontFamily:v.regular}],children:f}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ua.retryBtn,{backgroundColor:S.button.primaryBackground,borderRadius:S.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[ua.retryBtnText,{color:S.button.primaryText,fontFamily:v.medium}],children:"Go Back"})})]}):c==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ua.centered,{backgroundColor:_.background}],children:jsxRuntime.jsx(St,{size:56,strokeWidth:3,gradientFrom:_.primary,gradientTo:_.primary})}):jsxRuntime.jsx(Mc,{config:L,onClose:T})}var ua=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 Sf(){let{configure:e}=stripeReactNative.useOnramp(),t=qi.useRef(false);return qi.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var Tf="__unifold_stripe_onramp__";function Uc(e){globalThis[Tf]=e;}function kf(){return globalThis[Tf]}Uc(zc);var vn=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 hs,Ei,pa,xf,Zb=(xf=class extends vn{constructor(){super();pe(this,hs);pe(this,Ei);pe(this,pa);j(this,pa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Ei)||this.setEventListener(y(this,pa));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ei))==null||t.call(this),j(this,Ei,void 0));}setEventListener(t){var r;j(this,pa,t),(r=y(this,Ei))==null||r.call(this),j(this,Ei,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,hs)!==t&&(j(this,hs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,hs)=="boolean"?y(this,hs):globalThis.document?.visibilityState!=="hidden"}},hs=new WeakMap,Ei=new WeakMap,pa=new WeakMap,xf),ma=new Zb;var Xb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Pn,gs,Rf,eC=(Rf=class{constructor(){pe(this,Pn,Xb);pe(this,gs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,gs)&&e!==y(this,Pn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,Pn),provider:e}),j(this,Pn,e),process.env.NODE_ENV!=="production"&&j(this,gs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,gs,true),y(this,Pn).setTimeout(e,t)}clearTimeout(e){y(this,Pn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,gs,true),y(this,Pn).setInterval(e,t)}clearInterval(e){y(this,Pn).clearInterval(e);}},Pn=new WeakMap,gs=new WeakMap,Rf),Fn=new eC;function _f(e){setTimeout(e,0);}var Qu=typeof window>"u"||"Deno"in globalThis;function Or(){}function Pf(e,t){return typeof e=="function"?e(t):e}function Cl(e){return typeof e=="number"&&e>=0&&e!==1/0}function Nc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function sn(e,t){return typeof e=="function"?e(t):e}function wo(e,t){return typeof e=="function"?e(t):e}function $c(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==wl(i,t.options))return false}else if(!Cs(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function jc(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(ys(t.options.mutationKey)!==ys(s))return false}else if(!Cs(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function wl(e,t){return (t?.queryKeyHashFn||ys)(e)}function ys(e){return JSON.stringify(e,(t,r)=>Ku(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Cs(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Cs(e[r],t[r])):false}var tC=Object.prototype.hasOwnProperty;function Hc(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=If(e)&&If(t);if(!o&&!(Ku(e)&&Ku(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},u=0;for(let p=0;p<a;p++){let g=o?p:i[p],T=e[g],h=t[g];if(T===h){l[g]=T,(o?p<s:tC.call(e,g))&&u++;continue}if(T===null||h===null||typeof T!="object"||typeof h!="object"){l[g]=h;continue}let m=Hc(T,h,r+1);l[g]=m,m===T&&u++;}return s===a&&u===s?e:l}function qc(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 If(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ku(e){if(!vf(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!vf(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vf(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ff(e){return new Promise(t=>{Fn.setTimeout(t,e);})}function Sl(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 Hc(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 Hc(e,t)}return t}function Vf(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Df(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var bs=Symbol();function Kc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===bs&&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===bs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qc(e,t){return typeof e=="function"?e(...t):!!e}function Of(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var Vn=(()=>{let e=()=>Qu;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Tl(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Lf=_f;function rC(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Lf,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var ar=rC();var fa,Mi,ha,Bf,oC=(Bf=class extends vn{constructor(){super();pe(this,fa,true);pe(this,Mi);pe(this,ha);j(this,ha,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){y(this,Mi)||this.setEventListener(y(this,ha));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Mi))==null||t.call(this),j(this,Mi,void 0));}setEventListener(t){var r;j(this,ha,t),(r=y(this,Mi))==null||r.call(this),j(this,Mi,t(this.setOnline.bind(this)));}setOnline(t){y(this,fa)!==t&&(j(this,fa,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,fa)}},fa=new WeakMap,Mi=new WeakMap,ha=new WeakMap,Bf),ga=new oC;function nC(e){return Math.min(1e3*2**e,3e4)}function Yu(e){return (e??"online")==="online"?ga.isOnline():true}var Yc=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Gc(e){let t=false,r=0,o,n=Tl(),s=()=>n.status!=="pending",i=w=>{if(!s()){let x=new Yc(w);T(x),e.onCancel?.(x);}},a=()=>{t=true;},l=()=>{t=false;},u=()=>ma.isFocused()&&(e.networkMode==="always"||ga.isOnline())&&e.canRun(),p=()=>Yu(e.networkMode)&&e.canRun(),g=w=>{s()||(o?.(),n.resolve(w));},T=w=>{s()||(o?.(),n.reject(w));},h=()=>new Promise(w=>{o=x=>{(s()||u())&&w(x);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),m=()=>{if(s())return;let w,x=r===0?e.initialPromise:void 0;try{w=x??e.fn();}catch(k){w=Promise.reject(k);}Promise.resolve(w).then(g).catch(k=>{if(s())return;let _=e.retry??(Vn.isServer()?0:3),v=e.retryDelay??nC,S=typeof v=="function"?v(r,k):v,R=_===true||typeof _=="number"&&r<_||typeof _=="function"&&_(r,k);if(t||!R){T(k);return}r++,e.onFail?.(r,k),Ff(S).then(()=>u()?void 0:h()).then(()=>{t?T(k):m();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?m():h().then(m),n)}}var ws,Af,Jc=(Af=class{constructor(){pe(this,ws);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Cl(this.gcTime)&&j(this,ws,Fn.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vn.isServer()?1/0:300*1e3));}clearGcTimeout(){y(this,ws)!==void 0&&(Fn.clearTimeout(y(this,ws)),j(this,ws,void 0));}},ws=new WeakMap,Af);var Ss,ya,jo,Ts,qr,kl,ks,Do,Uf,Zn,Mf,zf=(Mf=class extends Jc{constructor(t){super();pe(this,Do);pe(this,Ss);pe(this,ya);pe(this,jo);pe(this,Ts);pe(this,qr);pe(this,kl);pe(this,ks);j(this,ks,false),j(this,kl,t.defaultOptions),this.setOptions(t.options),this.observers=[],j(this,Ts,t.client),j(this,jo,y(this,Ts).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,j(this,Ss,Ef(this.options)),this.state=t.state??y(this,Ss),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return y(this,qr)?.promise}setOptions(t){if(this.options={...y(this,kl),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Ef(this.options);r.data!==void 0&&(this.setState(Wf(r.data,r.dataUpdatedAt)),j(this,Ss,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,jo).remove(this);}setData(t,r){let o=Sl(this.state.data,t,this.options);return pt(this,Do,Zn).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){pt(this,Do,Zn).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=y(this,qr)?.promise;return y(this,qr)?.cancel(t),r?r.then(Or).catch(Or):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return y(this,Ss)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>wo(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===bs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>sn(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:!Nc(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),y(this,qr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),y(this,qr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,jo).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(y(this,qr)&&(y(this,ks)||pt(this,Do,Uf).call(this)?y(this,qr).cancel({revert:true}):y(this,qr).cancelRetry()),this.scheduleGc()),y(this,jo).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pt(this,Do,Zn).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&y(this,qr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(y(this,qr))return y(this,qr).continueRetry(),y(this,qr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(u=>u.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:()=>(j(this,ks,true),o.signal)});},s=()=>{let l=Kc(this.options,r),p=(()=>{let g={client:y(this,Ts),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return j(this,ks,false),this.options.persister?this.options.persister(l,p,this):l(p)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:y(this,Ts),state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(a,this),j(this,ya,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&pt(this,Do,Zn).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),j(this,qr,Gc({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Yc&&l.revert&&this.setState({...y(this,ya),fetchStatus:"idle"}),o.abort();},onFail:(l,u)=>{pt(this,Do,Zn).call(this,{type:"failed",failureCount:l,error:u});},onPause:()=>{pt(this,Do,Zn).call(this,{type:"pause"});},onContinue:()=>{pt(this,Do,Zn).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await y(this,qr).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),y(this,jo).config.onSuccess?.(l,this),y(this,jo).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Yc){if(l.silent)return y(this,qr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw pt(this,Do,Zn).call(this,{type:"error",error:l}),y(this,jo).config.onError?.(l,this),y(this,jo).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Ss=new WeakMap,ya=new WeakMap,jo=new WeakMap,Ts=new WeakMap,qr=new WeakMap,kl=new WeakMap,ks=new WeakMap,Do=new WeakSet,Uf=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Zn=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,...Gu(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Wf(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return j(this,ya,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),ar.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),y(this,jo).notify({query:this,type:"updated",action:t});});},Mf);function Gu(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Yu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wf(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Ef(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 So,kt,Rl,mo,xs,ba,Xn,zi,_l,Ca,wa,Rs,_s,Ui,Sa,Wt,xl,Ju,Zu,Xu,ep,tp,rp,op,jf,$f,ip=($f=class extends vn{constructor(t,r){super();pe(this,Wt);pe(this,So);pe(this,kt);pe(this,Rl);pe(this,mo);pe(this,xs);pe(this,ba);pe(this,Xn);pe(this,zi);pe(this,_l);pe(this,Ca);pe(this,wa);pe(this,Rs);pe(this,_s);pe(this,Ui);pe(this,Sa,new Set);this.options=r,j(this,So,t),j(this,zi,null),j(this,Xn,Tl()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(y(this,kt).addObserver(this),Hf(y(this,kt),this.options)?pt(this,Wt,xl).call(this):this.updateResult(),pt(this,Wt,ep).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return np(y(this,kt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return np(y(this,kt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pt(this,Wt,tp).call(this),pt(this,Wt,rp).call(this),y(this,kt).removeObserver(this);}setOptions(t){let r=this.options,o=y(this,kt);if(this.options=y(this,So).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wo(this.options.enabled,y(this,kt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pt(this,Wt,op).call(this),y(this,kt).setOptions(this.options),r._defaulted&&!qc(this.options,r)&&y(this,So).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,kt),observer:this});let n=this.hasListeners();n&&Nf(y(this,kt),o,this.options,r)&&pt(this,Wt,xl).call(this),this.updateResult(),n&&(y(this,kt)!==o||wo(this.options.enabled,y(this,kt))!==wo(r.enabled,y(this,kt))||sn(this.options.staleTime,y(this,kt))!==sn(r.staleTime,y(this,kt)))&&pt(this,Wt,Ju).call(this);let s=pt(this,Wt,Zu).call(this);n&&(y(this,kt)!==o||wo(this.options.enabled,y(this,kt))!==wo(r.enabled,y(this,kt))||s!==y(this,Ui))&&pt(this,Wt,Xu).call(this,s);}getOptimisticResult(t){let r=y(this,So).getQueryCache().build(y(this,So),t),o=this.createResult(r,t);return sC(this,o)&&(j(this,mo,o),j(this,ba,this.options),j(this,xs,y(this,kt).state)),o}getCurrentResult(){return y(this,mo)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&y(this,Xn).status==="pending"&&y(this,Xn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){y(this,Sa).add(t);}getCurrentQuery(){return y(this,kt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=y(this,So).defaultQueryOptions(t),o=y(this,So).getQueryCache().build(y(this,So),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return pt(this,Wt,xl).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),y(this,mo)))}createResult(t,r){let o=y(this,kt),n=this.options,s=y(this,mo),i=y(this,xs),a=y(this,ba),u=t!==o?t.state:y(this,Rl),{state:p}=t,g={...p},T=false,h;if(r._optimisticResults){let f=this.hasListeners(),D=!f&&Hf(t,r),L=f&&Nf(t,o,r,n);(D||L)&&(g={...g,...Gu(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:m,errorUpdatedAt:w,status:x}=g;h=g.data;let k=false;if(r.placeholderData!==void 0&&h===void 0&&x==="pending"){let f;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(f=s.data,k=true):f=typeof r.placeholderData=="function"?r.placeholderData(y(this,wa)?.state.data,y(this,wa)):r.placeholderData,f!==void 0&&(x="success",h=Sl(s?.data,f,r),T=true);}if(r.select&&h!==void 0&&!k)if(s&&h===i?.data&&r.select===y(this,_l))h=y(this,Ca);else try{j(this,_l,r.select),h=r.select(h),h=Sl(s?.data,h,r),j(this,Ca,h),j(this,zi,null);}catch(f){j(this,zi,f);}y(this,zi)&&(m=y(this,zi),h=y(this,Ca),w=Date.now(),x="error");let _=g.fetchStatus==="fetching",v=x==="pending",S=x==="error",R=v&&_,d=h!==void 0,C={status:x,fetchStatus:g.fetchStatus,isPending:v,isSuccess:x==="success",isError:S,isInitialLoading:R,isLoading:R,data:h,dataUpdatedAt:g.dataUpdatedAt,error:m,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>u.dataUpdateCount||g.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:S&&!d,isPaused:g.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:S&&d,isStale:sp(t,r),refetch:this.refetch,promise:y(this,Xn),isEnabled:wo(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let f=C.data!==void 0,D=C.status==="error"&&!f,L=E=>{D?E.reject(C.error):f&&E.resolve(C.data);},V=()=>{let E=j(this,Xn,C.promise=Tl());L(E);},I=y(this,Xn);switch(I.status){case "pending":t.queryHash===o.queryHash&&L(I);break;case "fulfilled":(D||C.data!==I.value)&&V();break;case "rejected":(!D||C.error!==I.reason)&&V();break}}return C}updateResult(){let t=y(this,mo),r=this.createResult(y(this,kt),this.options);if(j(this,xs,y(this,kt).state),j(this,ba,this.options),y(this,xs).data!==void 0&&j(this,wa,y(this,kt)),qc(r,t))return;j(this,mo,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!y(this,Sa).size)return true;let i=new Set(s??y(this,Sa));return this.options.throwOnError&&i.add("error"),Object.keys(y(this,mo)).some(a=>{let l=a;return y(this,mo)[l]!==t[l]&&i.has(l)})};pt(this,Wt,jf).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pt(this,Wt,ep).call(this);}},So=new WeakMap,kt=new WeakMap,Rl=new WeakMap,mo=new WeakMap,xs=new WeakMap,ba=new WeakMap,Xn=new WeakMap,zi=new WeakMap,_l=new WeakMap,Ca=new WeakMap,wa=new WeakMap,Rs=new WeakMap,_s=new WeakMap,Ui=new WeakMap,Sa=new WeakMap,Wt=new WeakSet,xl=function(t){pt(this,Wt,op).call(this);let r=y(this,kt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Or)),r},Ju=function(){pt(this,Wt,tp).call(this);let t=sn(this.options.staleTime,y(this,kt));if(Vn.isServer()||y(this,mo).isStale||!Cl(t))return;let o=Nc(y(this,mo).dataUpdatedAt,t)+1;j(this,Rs,Fn.setTimeout(()=>{y(this,mo).isStale||this.updateResult();},o));},Zu=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,kt)):this.options.refetchInterval)??false},Xu=function(t){pt(this,Wt,rp).call(this),j(this,Ui,t),!(Vn.isServer()||wo(this.options.enabled,y(this,kt))===false||!Cl(y(this,Ui))||y(this,Ui)===0)&&j(this,_s,Fn.setInterval(()=>{(this.options.refetchIntervalInBackground||ma.isFocused())&&pt(this,Wt,xl).call(this);},y(this,Ui)));},ep=function(){pt(this,Wt,Ju).call(this),pt(this,Wt,Xu).call(this,pt(this,Wt,Zu).call(this));},tp=function(){y(this,Rs)!==void 0&&(Fn.clearTimeout(y(this,Rs)),j(this,Rs,void 0));},rp=function(){y(this,_s)!==void 0&&(Fn.clearInterval(y(this,_s)),j(this,_s,void 0));},op=function(){let t=y(this,So).getQueryCache().build(y(this,So),this.options);if(t===y(this,kt))return;let r=y(this,kt);j(this,kt,t),j(this,Rl,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},jf=function(t){ar.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(y(this,mo));}),y(this,So).getQueryCache().notify({query:y(this,kt),type:"observerResultsUpdated"});});},$f);function iC(e,t){return wo(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function Hf(e,t){return iC(e,t)||e.state.data!==void 0&&np(e,t,t.refetchOnMount)}function np(e,t,r){if(wo(t.enabled,e)!==false&&sn(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&sp(e,t)}return false}function Nf(e,t,r,o){return (e!==t||wo(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&sp(e,r)}function sp(e,t){return wo(t.enabled,e)!==false&&e.isStaleByTime(sn(t.staleTime,e))}function sC(e,t){return !qc(e.getCurrentResult(),t)}function ap(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,u=async()=>{let p=false,g=m=>{Of(m,()=>t.signal,()=>p=true);},T=Kc(t.options,t.fetchOptions),h=async(m,w,x)=>{if(p)return Promise.reject();if(w==null&&m.pages.length)return Promise.resolve(m);let _=(()=>{let d={client:t.client,queryKey:t.queryKey,pageParam:w,direction:x?"backward":"forward",meta:t.options.meta};return g(d),d})(),v=await T(_),{maxPages:S}=t.options,R=x?Df:Vf;return {pages:R(m.pages,v,S),pageParams:R(m.pageParams,w,S)}};if(n&&s.length){let m=n==="backward",w=m?aC:qf,x={pages:s,pageParams:i},k=w(o,x);a=await h(x,k,m);}else {let m=e??s.length;do{let w=l===0?i[0]??o.initialPageParam:qf(o,a);if(l>0&&w==null)break;a=await h(a,w),l++;}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u;}}}function qf(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 aC(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Il,Dn,io,Is,On,Hi,Kf,Qf=(Kf=class extends Jc{constructor(t){super();pe(this,On);pe(this,Il);pe(this,Dn);pe(this,io);pe(this,Is);j(this,Il,t.client),this.mutationId=t.mutationId,j(this,io,t.mutationCache),j(this,Dn,[]),this.state=t.state||lC(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){y(this,Dn).includes(t)||(y(this,Dn).push(t),this.clearGcTimeout(),y(this,io).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){j(this,Dn,y(this,Dn).filter(r=>r!==t)),this.scheduleGc(),y(this,io).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){y(this,Dn).length||(this.state.status==="pending"?this.scheduleGc():y(this,io).remove(this));}continue(){return y(this,Is)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{pt(this,On,Hi).call(this,{type:"continue"});},o={client:y(this,Il),meta:this.options.meta,mutationKey:this.options.mutationKey};j(this,Is,Gc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{pt(this,On,Hi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{pt(this,On,Hi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,io).canRun(this)}));let n=this.state.status==="pending",s=!y(this,Is).canStart();try{if(n)r();else {pt(this,On,Hi).call(this,{type:"pending",variables:t,isPaused:s}),y(this,io).config.onMutate&&await y(this,io).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&pt(this,On,Hi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await y(this,Is).start();return await y(this,io).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await y(this,io).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),pt(this,On,Hi).call(this,{type:"success",data:i}),i}catch(i){try{await y(this,io).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await y(this,io).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw pt(this,On,Hi).call(this,{type:"error",error:i}),i}finally{y(this,io).runNext(this);}}},Il=new WeakMap,Dn=new WeakMap,io=new WeakMap,Is=new WeakMap,On=new WeakSet,Hi=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),ar.batch(()=>{y(this,Dn).forEach(o=>{o.onMutationUpdate(t);}),y(this,io).notify({mutation:this,type:"updated",action:t});});},Kf);function lC(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ei,an,vl,Yf,Gf=(Yf=class extends vn{constructor(t={}){super();pe(this,ei);pe(this,an);pe(this,vl);this.config=t,j(this,ei,new Set),j(this,an,new Map),j(this,vl,0);}build(t,r,o){let n=new Qf({client:t,mutationCache:this,mutationId:++qa(this,vl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){y(this,ei).add(t);let r=Zc(t);if(typeof r=="string"){let o=y(this,an).get(r);o?o.push(t):y(this,an).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(y(this,ei).delete(t)){let r=Zc(t);if(typeof r=="string"){let o=y(this,an).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&y(this,an).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Zc(t);if(typeof r=="string"){let n=y(this,an).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Zc(t);return typeof r=="string"?y(this,an).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ar.batch(()=>{y(this,ei).forEach(t=>{this.notify({type:"removed",mutation:t});}),y(this,ei).clear(),y(this,an).clear();});}getAll(){return Array.from(y(this,ei))}find(t){let r={exact:true,...t};return this.getAll().find(o=>jc(r,o))}findAll(t={}){return this.getAll().filter(r=>jc(t,r))}notify(t){ar.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return ar.batch(()=>Promise.all(t.map(r=>r.continue().catch(Or))))}},ei=new WeakMap,an=new WeakMap,vl=new WeakMap,Yf);function Zc(e){return e.options.scope?.id}var Ln,Jf,Zf=(Jf=class extends vn{constructor(t={}){super();pe(this,Ln);this.config=t,j(this,Ln,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??wl(n,r),i=this.get(s);return i||(i=new zf({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){y(this,Ln).has(t.queryHash)||(y(this,Ln).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=y(this,Ln).get(t.queryHash);r&&(t.destroy(),r===t&&y(this,Ln).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){ar.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return y(this,Ln).get(t)}getAll(){return [...y(this,Ln).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>$c(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>$c(t,o)):r}notify(t){ar.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){ar.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){ar.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Ln=new WeakMap,Jf);var kr,Ni,$i,Ta,ka,ji,xa,Ra,Xf,lp=(Xf=class{constructor(e={}){pe(this,kr);pe(this,Ni);pe(this,$i);pe(this,Ta);pe(this,ka);pe(this,ji);pe(this,xa);pe(this,Ra);j(this,kr,e.queryCache||new Zf),j(this,Ni,e.mutationCache||new Gf),j(this,$i,e.defaultOptions||{}),j(this,Ta,new Map),j(this,ka,new Map),j(this,ji,0);}mount(){qa(this,ji)._++,y(this,ji)===1&&(j(this,xa,ma.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,kr).onFocus());})),j(this,Ra,ga.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,kr).onOnline());})));}unmount(){var e,t;qa(this,ji)._--,y(this,ji)===0&&((e=y(this,xa))==null||e.call(this),j(this,xa,void 0),(t=y(this,Ra))==null||t.call(this),j(this,Ra,void 0));}isFetching(e){return y(this,kr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Ni).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,kr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=y(this,kr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(sn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return y(this,kr).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=y(this,kr).get(o.queryHash)?.state.data,i=Pf(t,s);if(i!==void 0)return y(this,kr).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return ar.batch(()=>y(this,kr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,kr).get(t.queryHash)?.state}removeQueries(e){let t=y(this,kr);ar.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=y(this,kr);return ar.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=ar.batch(()=>y(this,kr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Or).catch(Or)}invalidateQueries(e,t={}){return ar.batch(()=>(y(this,kr).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=ar.batch(()=>y(this,kr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Or)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Or)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=y(this,kr).build(this,t);return r.isStaleByTime(sn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Or).catch(Or)}fetchInfiniteQuery(e){return e.behavior=ap(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Or).catch(Or)}ensureInfiniteQueryData(e){return e.behavior=ap(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ga.isOnline()?y(this,Ni).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,kr)}getMutationCache(){return y(this,Ni)}getDefaultOptions(){return y(this,$i)}setDefaultOptions(e){j(this,$i,e);}setQueryDefaults(e,t){y(this,Ta).set(ys(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...y(this,Ta).values()],r={};return t.forEach(o=>{Cs(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){y(this,ka).set(ys(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...y(this,ka).values()],r={};return t.forEach(o=>{Cs(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...y(this,$i).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=wl(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===bs&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...y(this,$i).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){y(this,kr).clear(),y(this,Ni).clear();}},kr=new WeakMap,Ni=new WeakMap,$i=new WeakMap,Ta=new WeakMap,ka=new WeakMap,ji=new WeakMap,xa=new WeakMap,Ra=new WeakMap,Xf);var cp=qi__namespace.createContext(void 0),dp=e=>{let t=qi__namespace.useContext(cp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},up=({client:e,children:t})=>(qi__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(cp.Provider,{value:e,children:t}));var eh=qi__namespace.createContext(false),th=()=>qi__namespace.useContext(eh);eh.Provider;function dC(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var uC=qi__namespace.createContext(dC()),rh=()=>qi__namespace.useContext(uC);var nh=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Qc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},ih=e=>{qi__namespace.useEffect(()=>{e.clearReset();},[e]);},sh=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Qc(r,[e.error,o]));var ah=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));}},lh=(e,t)=>e.isLoading&&e.isFetching&&!t,ch=(e,t)=>e?.suspense&&t.isPending,pp=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function dh(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=th(),n=rh(),s=dp(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",ah(i),nh(i,n,a),ih(n);let l=!s.getQueryCache().get(i.queryHash),[u]=qi__namespace.useState(()=>new t(s,i)),p=u.getOptimisticResult(i),g=!o&&e.subscribed!==false;if(qi__namespace.useSyncExternalStore(qi__namespace.useCallback(T=>{let h=g?u.subscribe(ar.batchCalls(T)):Or;return u.updateResult(),h},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),qi__namespace.useEffect(()=>{u.setOptions(i);},[i,u]),ch(i,p))throw pp(i,u,n);if(sh({result:p,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw p.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,p),i.experimental_prefetchInRender&&!Vn.isServer()&&lh(p,o)&&(l?pp(i,u,n):a?.promise)?.catch(Or).finally(()=>{u.updateResult();}),i.notifyOnChangeProps?p:u.trackResult(p)}function ti(e,t){return dh(e,ip)}var va=new Map;function uh({width:e,height:t,borderRadius:r,color:o}){let n=qi.useRef(new reactNative.Animated.Value(.3)).current;return qi.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ri({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=A(),[u,p]=qi.useState(false),[g,T]=qi.useState(false),[h,m]=qi.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let R=va.get(e);return R?{uri:e,xml:R}:null}),w=e?.toLowerCase().endsWith(".svg"),x=w&&e&&h?.uri===e?h.xml:null;qi.useEffect(()=>{p(false),T(false);},[e]),qi.useEffect(()=>{if(!w||!e)return;if(va.has(e)){m({uri:e,xml:va.get(e)});return}let R=false;return fetch(e).then(d=>{if(!d.ok)throw new Error(`HTTP ${d.status}`);return d.text()}).then(d=>{R||(va.set(e,d),m({uri:e,xml:d}));}).catch(()=>{R||p(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},a]});let _={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},v=t-n*2,S=r-n*2;return u?jsxRuntime.jsx(reactNative.View,{style:[_,{backgroundColor:i||k}]}):w?jsxRuntime.jsxs(reactNative.View,{style:_,children:[!!!x&&jsxRuntime.jsx(uh,{width:v,height:S,borderRadius:o,color:k}),x?jsxRuntime.jsx(Gt.SvgXml,{xml:x,width:v,height:S,onError:()=>p(true)}):jsxRuntime.jsx(Gt.SvgUri,{uri:e,width:v,height:S,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:_,children:[!g&&jsxRuntime.jsx(uh,{width:v,height:S,borderRadius:o,color:k}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:v,height:S},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function hp(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(va.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{va.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function eo({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:u,balanceChainId:p,balanceTokenAddress:g,publishableKey:T,projectName:h,leftIcon:m,onLeftAction:w}){let{colors:x,fonts:k,components:_}=A(),[v,S]=qi.useState(null),[R,d]=qi.useState(false),c=qi.useState(()=>new reactNative.Animated.Value(0))[0];qi.useEffect(()=>{if(!R)return;let f=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(c,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(c,{toValue:0,duration:700,useNativeDriver:true})]));return f.start(),()=>f.stop()},[R,c]),qi.useEffect(()=>{if(!a||!l||!u||!p||!g||!T){S(null),d(false);return}let f=false;return d(true),fc(l,u,p,g,T).then(D=>{if(f)return;let L=D.balance,V=null;L&&(L.amount_usd!=null&&L.amount_usd!==""?V=`$${L.amount_usd}`:V="$0.00"),S(V);}).catch(()=>{f||S(null);}).finally(()=>{f||d(false);}),()=>{f=true;}},[a,l,u,p,g,T]);let C=c.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:so.header,children:[jsxRuntime.jsx(reactNative.View,{style:so.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Qa,{size:20,color:_.header.buttonColor,strokeWidth:2})}):m&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:m}):jsxRuntime.jsx(reactNative.View,{style:so.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:so.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:so.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[so.title,{color:_.header.titleColor,fontFamily:k.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[so.titleBadge,{backgroundColor:x.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[so.titleBadgeText,{color:x.foregroundMuted,fontFamily:k.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[so.balanceText,{color:x.foregroundMuted,fontFamily:k.regular}],children:t}):null,a&&(R?jsxRuntime.jsx(reactNative.Animated.View,{style:[so.balanceSkeleton,{backgroundColor:x.cardHover,opacity:C}]}):v!=null?jsxRuntime.jsxs(reactNative.Text,{style:[so.balanceText,{color:x.foregroundMuted,fontFamily:k.regular}],children:[h?`${h} `:"","Balance: ",v]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:so.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[so.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:_.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:so.spacer})})]})}var so=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function xr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=A(),a=s??i.card,l=a.backShadowColor!=="transparent",u={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[hh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[u,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[hh.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 hh=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Fl({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card,a=o?[...o].sort((l,u)=>l.position-u.position):[];return jsxRuntime.jsxs(xr,{cardTokens:i,onPress:e,style:Bn.wrapper,contentStyle:Bn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Bn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Bn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(ou,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Bn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Bn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Bn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Bn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Bn.networkIcons,children:a.map((l,u)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Bn.networkIconWrapper,{marginLeft:u===0?0:-6,zIndex:a.length-u}],children:jsxRuntime.jsx(ri,{uri:re(p),width:20,height:20})},l.name)})})})]})}var Bn=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 Dl({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsxs(xr,{cardTokens:i,onPress:e,style:oi.wrapper,contentStyle:oi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:oi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[oi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(qs,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:oi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[oi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[oi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:oi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:oi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(u=>u.format==="png")?.url||a.icon_urls.find(u=>u.format==="svg")?.url;return jsxRuntime.jsx(ri,{uri:re(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var oi=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 Ol({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsx(xr,{cardTokens:i,onPress:e,style:ni.wrapper,contentStyle:ni.container,children:jsxRuntime.jsxs(reactNative.View,{style:ni.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ni.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(oo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[ni.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ni.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:ni.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ni.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ni.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var ni=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 Bl({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=A(),s=n.depositMenu.card;return jsxRuntime.jsxs(xr,{cardTokens:s,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:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(nc,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:An.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[An.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[An.subtitle,{color:s.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 _C="#00D632";function Al({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=A(),s=n.depositMenu.card,[i,a]=qi.useState(false),l=$t("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(xr,{cardTokens:s,onPress:e,style:Wn.wrapper,contentStyle:Wn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Wn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Wn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[Wn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Wn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Wn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Wn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Wn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:_C,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var Vs="#00D632",kh=5,FC=[25,50,100,500],Da=120,VC=5e3,DC=2e3,OC=300;function Wl(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function xh(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function LC(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function Rh(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function BC(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function _h(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function AC(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function WC(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function id({size:e,faded:t=false,withBackground:r=false}){let[o,n]=qi.useState(false),s=$t("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Vs,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Vs}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function sd({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:u,fonts:p,components:g}=A();qi.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,h]=qi.useState("amountInput"),[m,w]=qi.useState("25"),[x,k]=qi.useState(null),[_,v]=qi.useState(null),[S,R]=qi.useState(true),[d,c]=qi.useState(null),[C,f]=qi.useState(false),[D,L]=qi.useState(null),[V,I]=qi.useState(Da),[E,U]=qi.useState(null),[q,Ke]=qi.useState(false),[ie,Ge]=qi.useState("pending"),$=qi.useRef(null),le=qi.useRef(null),Q=qi.useRef(null),Y=qi.useRef("pending"),we=qi.useRef(null),G=qi.useRef("amountInput"),se=qi.useRef(Da),Qe=qi.useRef(null),Be=qi.useRef(null),Je=qi.useRef(false),Ye=qi.useRef(true),ze=_?.minimum_amount??kh,Me=_?.maximum_amount,rt=parseFloat(m)||0,De=!isNaN(rt)&&rt>=ze&&(Me==null||rt<=Me),Ae=Me?`$${Wl(ze)} \u2013 $${Wl(Me)}`:`$${Wl(ze)} minimum`,ne=T==="amountInput"?"Pay with Cash App":`Pay $${xh(m)} via Cash App`,ye=T==="waitingForPayment";qi.useEffect(()=>(Ye.current=true,R(true),hu("usd",t).then(b=>{Ye.current&&v(b);}).catch(()=>{}).finally(()=>{Ye.current&&R(false);}),()=>{Ye.current=false,Ze();}),[t]);function ke(b,B=_){if(L(null),!b){k(null);return}let O=parseFloat(b);if(isNaN(O)){k("Enter a valid number");return}let J=B?.minimum_amount??kh,M=B?.maximum_amount;O<J?k(`$${Wl(J)} minimum`):M!=null&&O>M?k(`$${Wl(M)} maximum`):k(null);}function Ze(){$.current&&clearInterval($.current),le.current&&clearInterval(le.current),Q.current&&clearInterval(Q.current),$.current=null,le.current=null,Q.current=null;}function He(){Ze(),c(null),we.current=null,U(null),Ke(false),L(null),Y.current="pending",Ge("pending"),I(Da),se.current=Da,Qe.current=null,Je.current=false,h("amountInput"),G.current="amountInput";}async function dt(){if(!(!De||C)){f(true),L(null),Ze(),Qe.current=null;try{let b=await fu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:m},t);we.current=b,Y.current=b.status,c(b),f(!1),h("waitingForPayment"),G.current="waitingForPayment",Ht(),_e(),reactNative.Linking.openURL(b.url).catch(()=>{});}catch(b){f(false),L(b instanceof Error?b.message:"Failed to create session");}}}function Ht(){se.current=Da,I(Da),Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{se.current-=1,I(se.current),se.current<=0&&(clearInterval(Q.current),Q.current=null,Y.current==="pending"&&(h("softExpired"),G.current="softExpired"));},1e3);}function _e(){$.current&&clearInterval($.current),$.current=setInterval(()=>{Re();},VC);}async function Re(){if(!Ye.current)return;let b=we.current;if(!b)return;let B=b.external_id??b.id;try{let O=await gu(B,t),J=Y.current;switch(Y.current=O.status,Ge(O.status),O.status){case "processing":(G.current==="amountInput"||G.current==="softExpired"||G.current==="waitingForPayment")&&(h("paymentReceived"),G.current="paymentReceived",Q.current&&(clearInterval(Q.current),Q.current=null));break;case "completed":$.current&&(clearInterval($.current),$.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),J!=="completed"&&(h("paymentReceived"),G.current="paymentReceived",at());break;case "failed":$.current&&(clearInterval($.current),$.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),G.current!=="amountInput"&&(h("failed"),G.current="failed");break;case "expired":$.current&&(clearInterval($.current),$.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),G.current!=="amountInput"&&(h("softExpired"),G.current="softExpired");break;default:break}}catch{}}let Ve=6e5;function at(){le.current&&clearInterval(le.current);let b=Date.now()+Ve;le.current=setInterval(()=>{if(Date.now()>b){clearInterval(le.current),le.current=null;let B=Y.current;B==="completed"||B==="processing"?(h("paymentReceived"),G.current="paymentReceived"):(h("failed"),G.current="failed");return}Ie();},DC);}async function Ie(){if(Ye.current)try{let b=await Xo(e,t,"deposit"),B=Date.now(),O=[...b.data].sort(($e,Ue)=>{let Gr=$e.created_at?new Date($e.created_at).getTime():0;return (Ue.created_at?new Date(Ue.created_at).getTime():0)-Gr}),J=Qe.current,M=J?O.find($e=>$e.id===J):O.find($e=>{if(!$e.created_at)return !1;let Ue=new Date($e.created_at).getTime();return B-Ue<OC*1e3});M&&(Qe.current||(Qe.current=M.id),M.status==="succeeded"?(le.current&&(clearInterval(le.current),le.current=null),U(M),h("depositComplete"),G.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:M.id,transaction:M})):(M.status==="failed"||M.status==="refunded")&&(le.current&&(clearInterval(le.current),le.current=null),U(M),h("failed"),G.current="failed"));}catch{}}function be(){if(T==="waitingForPayment"){Q.current&&(clearInterval(Q.current),Q.current=null),h("amountInput"),G.current="amountInput";return}i();}function Oe(){Ze(),a();}function zt(){let b=we.current??d;b&&reactNative.Linking.openURL(b.url).catch(()=>{});}function Ut(b){let B=b.destination_amount_base_unit;if(!B)return "\u2014";let O=b.destination_token_metadata?.decimals??6;return LC(B,O)}function wt(b){return BC(b.destination_currency)}function yt(b){let B=b.destination_token_metadata;return B?B.icon_urls&&B.icon_urls.length>0?_i(B.icon_urls,"png")??B.icon_url??null:B.icon_url??null:null}function rr(){return jsxRuntime.jsxs(reactNative.View,{style:N.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.poweredByText,{color:u.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.poweredByBold,{color:u.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[N.poweredByBold,{color:u.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function We(b,B){return jsxRuntime.jsxs(reactNative.View,{style:N.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.detailLabel,{color:u.foregroundMuted,fontFamily:p.regular}],children:b}),jsxRuntime.jsx(reactNative.Text,{style:[N.detailValue,{color:u.foreground,fontFamily:p.medium}],children:B})]},b)}function ve(b,B,O){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.txRow,{backgroundColor:u.card,borderColor:u.cardHover}],onPress:()=>reactNative.Linking.openURL(O).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txLabel,{color:u.foreground,fontFamily:p.medium}],children:b}),jsxRuntime.jsxs(reactNative.View,{style:N.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txHash,{color:u.foregroundMuted}],children:B}),jsxRuntime.jsx(reactNative.Text,{style:[N.txArrow,{color:u.foregroundMuted}],children:"\u2197"})]})]},b)}function Ne(){let b=Math.max(60-m.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:N.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:N.flex,contentContainerStyle:N.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{Je.current||(Je.current=true,setTimeout(()=>Be.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:N.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:N.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.amountDollar,{color:u.foreground,fontSize:b}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Be,value:m,onChangeText:B=>{w(B),ke(B);},keyboardType:"decimal-pad",style:[N.amountInput,{color:u.foreground,fontSize:b}],placeholderTextColor:u.foregroundMuted,placeholder:"0"})]}),x?jsxRuntime.jsx(reactNative.Text,{style:[N.amountError,{color:u.warning,fontFamily:p.regular}],children:x}):S?jsxRuntime.jsx(reactNative.View,{style:[N.limitsSkeleton,{backgroundColor:u.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[N.limitsSubtitle,{color:u.foregroundMuted,fontFamily:p.regular}],children:Ae})]}),jsxRuntime.jsx(reactNative.View,{style:N.quickAmountsRow,children:FC.map(B=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.quickAmountButton,{backgroundColor:u.card}],onPress:()=>{let O=String(B);w(O),ke(O);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[N.quickAmountText,{color:u.foreground,fontFamily:p.medium}],children:["$",B]})},B))}),D&&jsxRuntime.jsxs(reactNative.View,{style:[N.errorBanner,{backgroundColor:u.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:N.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[N.errorBannerText,{color:u.foreground,fontFamily:p.regular}],children:D})]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius,opacity:!De||C?.4:1}],onPress:dt,disabled:!De||C,activeOpacity:.8,children:[C&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:N.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:C?"Loading...":"Continue"})]})})]})}function ge(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(id,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:u.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:u.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
|
|
3
|
+
This page will update automatically.`}),V>0&&jsxRuntime.jsxs(reactNative.Text,{style:[N.expiryText,{color:V<=30?u.warning:u.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",WC(V)]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:zt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:N.cashAppButtonIcon,children:jsxRuntime.jsx(id,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function Pe(){let b=ie==="processing",B=b?"Payment processing":"Payment received",O=b?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:N.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(St,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(id,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:u.foreground,fontFamily:p.semibold}],children:B}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:u.foregroundMuted,fontFamily:p.regular}],children:O})]})})}function H(){if(!E)return Pe();let b=E,B=["pending","waiting","delayed"].includes(b.status),O=yt(b),J=AC(b.created_at);return jsxRuntime.jsxs(reactNative.View,{style:N.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:N.flex,contentContainerStyle:N.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:N.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:O?jsxRuntime.jsx(reactNative.Image,{source:{uri:O,cache:"force-cache"},style:N.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[N.tokenIconFallback,{backgroundColor:u.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.tokenIconFallbackText,{color:u.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[N.statusBadge,{backgroundColor:B?u.warning:u.success}],children:jsxRuntime.jsx(reactNative.Text,{style:N.statusBadgeText,children:B?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:N.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[N.statusDot,{backgroundColor:B?u.warning:u.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[N.statusText,{color:u.foreground,fontFamily:p.semibold}],children:B?"In Progress":"Completed"})]}),J?jsxRuntime.jsx(reactNative.Text,{style:[N.dateText,{color:u.foregroundMuted,fontFamily:p.regular}],children:J}):null,jsxRuntime.jsxs(reactNative.View,{style:[N.detailCard,{backgroundColor:u.card,borderColor:u.cardHover}],children:[We("Amount Sent",`$${xh(m)} USD`),We("Amount Received",`${Ut(b)} ${wt(b)}`),b.source_amount_usd?We("USD Value",`$${parseFloat(b.source_amount_usd).toFixed(2)}`):null,b.source_chain_id?We("Source Network",Rh(b.source_chain_type??"",b.source_chain_id)):null,b.destination_chain_id?We("Destination Network",Rh(b.destination_chain_type??"",b.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:N.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),Ke(M=>!M);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.seeMoreText,{color:u.foreground,fontFamily:p.medium}],children:q?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[N.seeMoreChevron,{color:u.foregroundMuted}],children:q?"\u25B2":"\u25BC"})]}),q&&jsxRuntime.jsxs(reactNative.View,{style:N.txHashSection,children:[b.explorer_url?ve("Deposit Tx",_h(b.transaction_hash),b.explorer_url):null,!B&&b.destination_explorer_url&&b.destination_transaction_hashes?.[0]?ve("Completion Tx",_h(b.destination_transaction_hashes[0]),b.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:Oe,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function ue(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(id,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:u.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.stateDescription,{color:u.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
|
|
4
|
+
`,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:N.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:He,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function P(){return jsxRuntime.jsxs(reactNative.View,{style:N.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:N.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[N.failedIconCircle,{backgroundColor:u.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.failedIconText,{color:u.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateTitle,{color:u.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[N.stateDescription,{color:u.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:N.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[N.continueButton,{backgroundColor:Vs,borderRadius:g.button.borderRadius}],onPress:He,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),rr()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[N.root,{backgroundColor:u.background}],children:[jsxRuntime.jsx(eo,{title:ne,showBack:ye,onBack:be,onClose:Oe}),T==="amountInput"&&Ne(),T==="waitingForPayment"&&ge(),T==="paymentReceived"&&Pe(),T==="depositComplete"&&H(),T==="softExpired"&&ue(),T==="failed"&&P()]})}var N=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var Fh=5e3,Vh=2500,Dh=5e3,Oh=6e4;function si(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:u,trackedExecutions:p,setDepositExecutions:g,setTrackedExecutions:T,setLatestExecution:h,setShowStatusSheet:m,onDepositSuccess:w,onExecutionsChange:x,onDepositError:k}=e,[_,v]=qi.useState(false),[S,R]=qi.useState(false);return qi.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;v(false),t==="auto_ui"&&R(false);let c=setTimeout(()=>{v(true),t==="auto_ui"&&R(true);},Fh);return ()=>clearTimeout(c)},[r,t,o,n]),qi.useEffect(()=>{if(!r||!s||!a)return;let c=new Date(a.getTime()-Oh),C=setInterval(async()=>{try{let L=[...(await Xo(s,i,"deposit")).data??[]].sort((I,E)=>{let U=I.created_at?new Date(I.created_at).getTime():0;return (E.created_at?new Date(E.created_at).getTime():0)-U}),V=null;for(let I of L){let E=I.created_at?new Date(I.created_at):null;if(!E||E<=c)continue;let U=p.get(I.id);if(!U){V=I;break}if(["pending","waiting","delayed"].includes(U)&&I.status==="succeeded"){V=I;break}}if(V){let I=V;g(E=>{let U=E.findIndex(q=>q.id===I.id);if(U>=0){let q=[...E];return q[U]=I,q}return [...E,I]}),T(E=>{let U=new Map(E);return U.set(I.id,I.status),U}),h(I),m(!0),I.status==="succeeded"&&w?.({message:"Deposit completed successfully",executionId:I.id}),x?.([...u,I]);}}catch(f){k?.({message:"Failed to check deposit status",error:f});}},Vh);return ()=>clearInterval(C)},[r,s,i,a,p,u,x,w,k]),qi.useEffect(()=>{if(!r||!_||!l)return;let c=async()=>{try{await dc(l,i);}catch{}};c();let C=setInterval(c,Dh);return ()=>clearInterval(C)},[r,_,l,i]),{pollingEnabled:_,showWaitingUi:S,handleIveDeposited:()=>{v(true),R(true);}}}var li=7,ai=4,Oa=4;function $C(e,t,r){return e<li&&t<li||e<li&&t>=r-li||e>=r-li&&t<li}function Zi({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=A(),l=a?"#1a1a1a":"#ffffff",u=a?"#ffffff":"#000000",p=n||l,g=qi.useMemo(()=>{try{return NC__default.default(e||"placeholder","H")}catch{return null}},[e]),T=g?g.length:0,h=T?(t-ai*2)/T:0,m=h*.38,w=o+12,x=w/2+4,k=t/2,_=t/2,v=T?[{x:ai,y:ai},{x:ai+(T-li)*h,y:ai},{x:ai,y:ai+(T-li)*h}]:[],S=li*h,R=5*h,d=h,c=3*h,C=2*h;return jsxRuntime.jsxs(reactNative.View,{style:[Fp.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Gt__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Gt.Rect,{x:0,y:0,width:t,height:t,fill:l}),g?.map((f,D)=>f.map((L,V)=>{if(!L||$C(D,V,T))return null;let I=ai+V*h+h/2,E=ai+D*h+h/2;if(r){let U=I-k,q=E-_;if(Math.sqrt(U*U+q*q)<x)return null}return jsxRuntime.jsx(Gt.Circle,{cx:I,cy:E,r:m,fill:u},`${D}-${V}`)})),v.map((f,D)=>jsxRuntime.jsxs(qi__namespace.default.Fragment,{children:[jsxRuntime.jsx(Gt.Rect,{x:f.x,y:f.y,width:S,height:S,rx:Oa,ry:Oa,fill:u}),jsxRuntime.jsx(Gt.Rect,{x:f.x+d,y:f.y+d,width:R,height:R,rx:Oa-1,ry:Oa-1,fill:l}),jsxRuntime.jsx(Gt.Rect,{x:f.x+C,y:f.y+C,width:c,height:c,rx:Oa-1.5,ry:Oa-1.5,fill:u})]},`finder-${D}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[Fp.logoContainer,{width:w,height:w,top:_-w/2,left:k-w/2,backgroundColor:p,borderRadius:w/2}],children:[jsxRuntime.jsx(ri,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[Fp.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(ri,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var Fp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});function ud({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:s,fonts:i,components:a}=A(),l=qi.useRef(new reactNative.Animated.Value(0)).current;qi.useEffect(()=>{if(r&&!o){l.setValue(0);let p=reactNative.Animated.loop(reactNative.Animated.timing(l,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return p.start(),()=>p.stop()}},[r,o,l]);let u=l.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[dd.iveDepositedButton,{backgroundColor:s.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[dd.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:dd.processingCard,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:u}]},children:jsxRuntime.jsx(Ga,{size:16,color:s.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[dd.processingCardTitle,{color:s.foregroundMuted,fontFamily:i.regular}],children:"Checking for deposit"})]})]})}var dd=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingTop:6,marginBottom:12},processingCardTitle:{fontSize:14}});var Ba=(e,t)=>`${t}:${e}`,rw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function md({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,onLatestExecution:m,onShowStatusSheet:w,onSelectedTokenIconUrl:x,borderTopLeftRadius:k,borderTopRightRadius:_,sheetBorderRadius:v}){let{colors:S,fonts:R,components:d}=A(),c=a&&l?`${a}:${l}`:"solana:mainnet",[C,f]=qi.useState("USDC"),[D,L]=qi.useState(c),[V,I]=qi.useState([]),[E,U]=qi.useState(true),[q,Ke]=qi.useState([]),[ie,Ge]=qi.useState(true),[$,le]=qi.useState(false),[Q,Y]=qi.useState(false),[we,G]=qi.useState(false),[se,Qe]=qi.useState(false),[Be,Je]=qi.useState([]),[Ye,ze]=qi.useState(new Map),[Me]=qi.useState(()=>new Date),[rt,De]=qi.useState(null),[Ae,ne]=qi.useState(false),[ye,ke]=qi.useState(null),[Ze,He]=qi.useState(false);qi.useEffect(()=>{ye&&m?.(ye);},[ye]),qi.useEffect(()=>{Ae&&(w?.(true),ne(false));},[Ae]);let dt=new Map;q.forEach(P=>{P.chains.forEach(b=>{let B=`${b.chain_type}:${b.chain_id}`;dt.has(B)||dt.set(B,b);});});let Ht=Array.from(dt.values()),_e=rw(D),Ve=Ht.find(P=>P.chain_type===_e.chainType&&P.chain_id===_e.chainId)?.chain_type||"ethereum",at=Eo(V,Ve),Ie=at?.address||"",be=qi.useRef(false);qi.useEffect(()=>{async function P(){try{Ge(!0),De(null);let B=await qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Ke(B.data),B.data.length>0&&!be.current){be.current=!0;let O,J;if(a&&l)if(u)for(let M of B.data){let $e=M.chains.find(Ue=>Ue.chain_type===a&&Ue.chain_id===l&&Ue.token_address.toLowerCase()===u.toLowerCase());if($e){O=M,J=$e;break}}else {let M=Ue=>Ue.chain_type===a&&Ue.chain_id===l,$e=B.data.find(Ue=>Ue.symbol==="USDC"&&Ue.chains.some(M));if($e)O=$e,J=$e.chains.find(M);else for(let Ue of B.data){let Gr=Ue.chains.find(M);if(Gr){O=Ue,J=Gr;break}}}if(!O&&s)for(let M of B.data){let $e=M.chains.find(Ue=>Ue.token_address.toLowerCase()===s.toLowerCase());if($e){O=M,J=$e;break}}O||(O=B.data.find(M=>M.symbol==="USDC"),O&&O.chains.length>0&&(J=O.chains[0])),O||(O=B.data.find(M=>M.symbol==="USDT"),O&&O.chains.length>0&&(J=O.chains[0])),O||(O=B.data[0],O.chains.length>0&&(J=O.chains[0])),O&&f(O.symbol),J&&L(Ba(J.chain_id,J.chain_type));}}catch(b){console.error("Error fetching supported tokens:",b),De("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:b});}finally{Ge(false);}}P();},[t,h,a,l,u,s,n,o]),qi.useEffect(()=>{async function P(){try{U(!0),De(null);let b=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);I(b.data);}catch(b){console.error("Error fetching wallets:",b),De("Failed to load wallets"),h?.({message:"Failed to load wallets",error:b});}finally{U(false);}}P();},[e,r,o,n,s,t,h]);let Oe=at?.id??"",{showWaitingUi:zt,handleIveDeposited:Ut}=si({depositConfirmationMode:p,depositAddress:Ie,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:Me,depositWalletId:Oe,depositExecutions:Be,trackedExecutions:Ye,setDepositExecutions:Je,setTrackedExecutions:ze,setLatestExecution:ke,setShowStatusSheet:ne,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h});qi.useEffect(()=>{if(!q.length)return;let P=q.find(B=>B.symbol===C);if(!P||P.chains.length===0){let B=q.find(O=>O.symbol==="USDC")||q[0];B&&(f(B.symbol),B.chains.length>0&&L(Ba(B.chains[0].chain_id,B.chains[0].chain_type)));return}if(!P.chains.some(B=>Ba(B.chain_id,B.chain_type)===D)){let B=P.chains[0];L(Ba(B.chain_id,B.chain_type));}},[C,q,D]);let wt=q.find(P=>P.symbol===C),yt=xe(wt,"png")||void 0;qi.useEffect(()=>{x?.(yt);},[yt]);let rr=wt?.chains||[],We=rr.find(P=>Ba(P.chain_id,P.chain_type)===D),ve=async()=>{if(Ie)try{reactNative.Clipboard.setString(Ie),le(!0),setTimeout(()=>le(!1),2e3);}catch(P){console.error("Failed to copy:",P);}},Ne=We?.estimated_price_impact_percent??0,ge=We?.max_slippage_percent??.25,Pe=We?.minimum_deposit_amount_usd??3;if(ie)return jsxRuntime.jsxs(reactNative.View,{style:z.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:S.foregroundMuted,fontFamily:R.regular}],children:"Loading currencies..."})]});if(rt&&q.length===0)return jsxRuntime.jsxs(reactNative.View,{style:z.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:S.error,fontFamily:R.regular}],children:rt}),jsxRuntime.jsx(reactNative.Text,{style:[z.errorHint,{color:S.foregroundMuted,fontFamily:R.regular}],children:"Please check your network connection and try again."})]});let H=()=>jsxRuntime.jsxs(_t,{visible:we,onClose:()=>G(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:d.header.titleColor,fontFamily:R.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Tt,{style:z.sheetList,contentContainerStyle:z.sheetListContent,showsVerticalScrollIndicator:false,children:q.map(P=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{f(P.symbol),G(false);},activeOpacity:.7,style:[z.sheetItem,{backgroundColor:C===P.symbol?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(P,"png"))},style:z.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:z.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.sheetItemTitle,{color:d.card.titleColor,fontFamily:R.medium}],children:P.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[z.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:R.regular}],children:[P.chains.length," network",P.chains.length!==1?"s":""," available"]})]}),C===P.symbol&&jsxRuntime.jsx(lt,{size:20,color:S.primary,strokeWidth:2})]},P.symbol))})]}),ue=()=>jsxRuntime.jsxs(_t,{visible:se,onClose:()=>Qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.chainSelector?.borderTopLeftRadius??k,borderTopRightRadius:v?.chainSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:d.header.titleColor,fontFamily:R.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Tt,{style:z.sheetList,contentContainerStyle:z.sheetListContent,showsVerticalScrollIndicator:false,children:rr.map(P=>{let b=Ba(P.chain_id,P.chain_type),B=D===b;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{L(b),Qe(false);},activeOpacity:.7,style:[z.sheetItem,{backgroundColor:B?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(P,"png"))},style:z.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:z.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.sheetItemTitle,{color:d.card.titleColor,fontFamily:R.medium}],children:P.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[z.sheetItemSubtitle,{fontFamily:R.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:d.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:S.warning},children:["$",P.minimum_deposit_amount_usd]})]})]}),B&&jsxRuntime.jsx(lt,{size:20,color:S.primary,strokeWidth:2})]},b)})})]});return jsxRuntime.jsxs(reactNative.View,{style:z.container,children:[jsxRuntime.jsxs(reactNative.View,{style:z.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.selectorLabel,{color:d.card.labelColor,fontFamily:R.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(true),style:[z.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[wt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(wt,"png"))},style:z.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[z.selectorText,{color:d.card.titleColor,fontFamily:R.medium}],children:C}),jsxRuntime.jsx(Jt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:z.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[z.selectorLabel,{color:d.card.labelColor,fontFamily:R.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[z.minDeposit,{color:S.warning,fontFamily:R.regular}],children:["($",Pe," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(true),style:[z.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[We&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(We,"png"))},style:z.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[z.selectorText,{color:d.card.titleColor,fontFamily:R.medium}],numberOfLines:1,children:We?.chain_name||"Select network"}),jsxRuntime.jsx(Jt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:z.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[z.qrWrapper,{backgroundColor:S.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:E?jsxRuntime.jsxs(reactNative.View,{style:z.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:S.foregroundMuted,fontFamily:R.regular}],children:"Loading..."})]}):Ie?jsxRuntime.jsx(Zi,{value:Ie,size:160,logoUri:re(xe(We,"png")||$t("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:z.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:S.error,fontFamily:R.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:z.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:z.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressLabel,{color:d.card.labelColor,fontFamily:R.medium}],children:"Deposit Address"}),$&&jsxRuntime.jsxs(reactNative.View,{style:z.copiedIndicator,children:[jsxRuntime.jsx(lt,{size:14,color:S.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[z.copiedText,{color:S.success,fontFamily:R.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(xr,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!E&&Ie?ve:void 0,contentStyle:z.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressText,{color:d.card.titleColor,fontFamily:R.regular}],numberOfLines:2,children:E?"Loading...":Ie||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:z.addressCopyIcon,children:jsxRuntime.jsx(Go,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Y(!Q),style:z.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:R.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:z.chevronContainer,children:Q?jsxRuntime.jsx(fn,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),Q&&jsxRuntime.jsxs(reactNative.View,{style:z.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:R.regular}],children:["Price impact: ",Ne.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>He(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:R.regular}],children:["Slippage: Auto \u2022 ",ge.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>He(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:d.card.titleColor,fontFamily:R.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ud,{depositConfirmationMode:p,depositAddress:Ie,showWaitingUi:zt,latestExecution:ye,onIveDeposited:Ut}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:z.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[z.termsText,{color:S.primary,fontFamily:R.regular}],children:"Terms apply"})}),H(),ue(),jsxRuntime.jsxs(_t,{visible:Ze,onClose:()=>He(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:d.header.titleColor,fontFamily:R.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>He(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardTitle,{color:d.card.titleColor,fontFamily:R.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:d.card.titleColor,fontFamily:R.medium}],children:[Ne.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:d.card.descriptionColor,fontFamily:R.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardTitle,{color:d.card.titleColor,fontFamily:R.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:d.card.titleColor,fontFamily:R.medium}],children:[ge.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:d.card.descriptionColor,fontFamily:R.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var z=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 fd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=A();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ds.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ds.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ds.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(e,"png"))},style:Ds.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ds.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ds.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ds.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(lt,{size:16,color:o.primary,strokeWidth:2})]})}var Ds=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 Ul({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=A();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Mh.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Mh.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(fd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Mh=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function gd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:u,components:p}=A(),[g,T]=qi.useState(""),h=o.map(S=>r.find(R=>R.currency_code.toLowerCase()===S.toLowerCase())).filter(S=>S!==void 0),m=r.filter(S=>!o.includes(S.currency_code.toLowerCase())),w=S=>{if(!g)return S;let R=g.toLowerCase();return S.filter(d=>d.name.toLowerCase().includes(R)||d.currency_code.toLowerCase().includes(R))},x=w(h),k=w(m),_=S=>{s(S),t(false),T("");},v=()=>{t(false),T("");};return jsxRuntime.jsxs(_t,{visible:e,onClose:v,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(eo,{title:"Currency",showBack:false,onClose:v}),jsxRuntime.jsx(reactNative.View,{style:Os.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Os.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:u.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(Tt,{style:Os.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Os.listContent,children:[jsxRuntime.jsx(Ul,{title:"Popular currencies",currencies:x,selectedCurrency:n,onSelect:_}),x.length>0&&k.length>0&&jsxRuntime.jsx(reactNative.View,{style:Os.sectionSpacer}),jsxRuntime.jsx(Ul,{title:"All currencies",currencies:k,selectedCurrency:n,onSelect:_}),x.length===0&&k.length===0&&jsxRuntime.jsx(reactNative.View,{style:Os.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Os.noResultsText,{color:p.container.subtitleColor,fontFamily:u.regular}],children:"No currencies found"})})]})})]})}var Os=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 Bp(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 Cd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:u,onDepositError:p,onExecutionsChange:g,onLatestExecution:T,onShowStatusSheet:h,onSelectedTokenIconUrl:m,borderTopLeftRadius:w,borderTopRightRadius:x,sheetBorderRadius:k}){let{colors:_,fonts:v,components:S}=A(),[R,d]=qi.useState(""),[c,C]=qi.useState("usd"),[f,D]=qi.useState(false),[L,V]=qi.useState(false),[I,E]=qi.useState([]),[U,q]=qi.useState(false),[Ke,ie]=qi.useState(null),[Ge,$]=qi.useState(null),[le,Q]=qi.useState("amount"),[Y,we]=qi.useState(null),[G,se]=qi.useState(true),[Qe,Be]=qi.useState(null),[Je,Ye]=qi.useState(false),ze=qi.useRef(null),Me=qi.useRef(false);qi.useEffect(()=>{ze.current=Y;},[Y]),qi.useEffect(()=>{Me.current=Je;},[Je]);let[rt,De]=qi.useState([]),[Ae,ne]=qi.useState(true),[ye,ke]=qi.useState(60),[Ze,He]=qi.useState([]),[dt,Ht]=qi.useState([]),[_e,Re]=qi.useState(null),[Ve,at]=qi.useState(null),[Ie,be]=qi.useState(true),[Oe,zt]=qi.useState(null),[Ut,wt]=qi.useState(false),[yt,rr]=qi.useState(null),[We,ve]=qi.useState(false),[Ne,ge]=qi.useState(false),[Pe,H]=qi.useState(false),[ue,P]=qi.useState(null),b=r??le,B=qi.useRef(null),O=Ze.find(de=>de.currency_code.toLowerCase()===c.toLowerCase()),J=qi.useCallback(de=>{Q(de),de==="quotes"?o?.(de,I.length):o?.(de);},[I.length,o]);qi.useEffect(()=>{async function de(){try{let Ee=await il();at(Ee);}catch(Ee){console.error("Error fetching user IP:",Ee);}finally{be(false);}}de();},[]),qi.useEffect(()=>{async function de(){try{let Ee=await Zo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);De(Ee.data);}catch(Ee){console.error("Error fetching wallets:",Ee),ie("Failed to load wallet addresses");}finally{ne(false);}}de();},[e,s,i,a,l,t]);let M=n||_e?.symbol.toUpperCase()||"USDC",$e=_i(_e?.icon_urls,"png")||_e?.icon_url,Ue=_i(_e?.chain_icon_urls,"png")||_e?.chain_icon_url,[Gr,X]=qi.useState([]),[Hs,Dt]=qi.useState(new Map),[Fe]=qi.useState(()=>new Date),[Ft,ot]=qi.useState(null),[Xe,ro]=qi.useState(false),[Kt,Mr]=qi.useState(null);qi.useEffect(()=>{b==="onramp"&&!Kt&&Mr(new Date);},[b,Kt]);let Br=Oe?.destination_token_metadata?.chain_type||i||"ethereum",Ns=Oe?.destination_token_metadata?.chain_id||a||"",Hn=`${Br}:${Ns}`,Gl=Eo(rt,Br),ss=Gl?.address||"",Jl=Gl?.id??"";qi.useEffect(()=>{Ft&&T?.(Ft);},[Ft]),qi.useEffect(()=>{Xe&&(h?.(true),ro(false));},[Xe]),qi.useEffect(()=>{m?.($e||void 0);},[$e]),qi.useEffect(()=>{g?.(Gr);},[Gr]),si({depositConfirmationMode:"auto_silent",enabled:b==="onramp",depositAddress:ss,chain:Hn,externalUserId:e,publishableKey:t,modalOpenedAt:Kt??Fe,depositWalletId:Jl,depositExecutions:Gr,trackedExecutions:Hs,setDepositExecutions:X,setTrackedExecutions:Dt,setLatestExecution:ot,setShowStatusSheet:ro,onDepositSuccess:u,onExecutionsChange:g,onDepositError:p}),qi.useEffect(()=>{async function de(){try{let Ee=await ol(t);He(Ee.data),Ht(Ee.preferred||[]);}catch(Ee){console.error("Error fetching fiat currencies:",Ee);}}de();},[t]),qi.useEffect(()=>{if(f||Ze.length===0||!Ve?.alpha2)return;let de=Ve.alpha2.toUpperCase(),Ee=Ze.find(mr=>mr.country_codes.includes(de));if(Ee)C(Ee.currency_code.toLowerCase()),!R&&!L&&d(String(Ee.default_amount??100));else if(!R&&!L){let mr=Ze.find(pn=>pn.currency_code.toLowerCase()==="usd");mr&&d(String(mr.default_amount??100));}},[Ze,Ve,f,R,L]),qi.useEffect(()=>{if(Ze.length!==0){if(B.current!==null&&B.current!==c){let de=Ze.find(Ee=>Ee.currency_code.toLowerCase()===c.toLowerCase());de&&d(String(de.default_amount??100));}B.current=c;}},[c,Ze]),qi.useEffect(()=>{async function de(){try{let Ee=await au({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Re(Ee);}catch(Ee){console.error("Error fetching supported tokens:",Ee);}}de();},[i,a,l,t]),qi.useEffect(()=>{async function de(){if(!(!l||!a||!i)&&!Ie){wt(true);try{let Ee=await du({country_code:Ve?.alpha2?.toUpperCase()||"US",subdivision_code:Ve?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);zt(Ee);}catch(Ee){console.error("Error fetching default onramp token:",Ee);}finally{wt(false);}}}de();},[l,a,i,Ve,Ie,t]),qi.useEffect(()=>{let de=parseFloat(R);if(isNaN(de)||de<=0){E([]),$(null);return}if(!Oe||Ut){E([]),we(null);return}let Ee=Ze.find(pn=>pn.currency_code.toLowerCase()===c.toLowerCase());if(Ee){if(de<Ee.minimum_amount){E([]),we(null),$(`Minimum amount is ${Bp(c)}${Ee.minimum_amount.toLocaleString()}`);return}if(de>Ee.maximum_amount){E([]),we(null),$(`Maximum amount is ${Bp(c)}${Ee.maximum_amount.toLocaleString()}`);return}}$(null);let mr=setTimeout(()=>{as(de);},500);return ()=>clearTimeout(mr)},[R,c,t,Oe,Ut,Ze]);let as=async de=>{if(!Oe){ie("Loading token information...");return}q(true),ie(null);try{let Ee={country_code:Ve?.alpha2?.toUpperCase()||"US",source_amount:de.toString(),source_currency:c.toLowerCase(),destination_currency:Oe.destination_currency,destination_network:Oe.destination_network,subdivision_code:Ve?.state||void 0},mr=await lu(Ee,t);E(mr.data);let pn=Me.current,Xl=ze.current;if(pn&&Xl){let ki=mr.data.find(F=>F.service_provider===Xl.service_provider);if(ki){if(we(ki),mr.data.length>0){let F=mr.data[0];Qe||Be(F.service_provider),se(ki.service_provider===Qe);}}else if(mr.data.length>0){let F=mr.data[0];we(F),Be(F.service_provider),se(!0),Ye(!1);}}else if(mr.data.length>0){let ki=mr.data[0];we(ki),Be(ki.service_provider),se(!0);}ke(60);}catch(Ee){console.error("Failed to fetch quotes:",Ee),ie("Failed to fetch quotes. Please try again."),E([]);}finally{q(false);}};qi.useEffect(()=>{if(I.length===0)return;let de=setInterval(()=>{ke(Ee=>{if(Ee<=1){let mr=parseFloat(R);return !isNaN(mr)&&mr>0&&as(mr),60}return Ee-1});},1e3);return ()=>clearInterval(de)},[I.length,R]);let Zl=de=>{(/^\d*\.?\d{0,2}$/.test(de)||de==="")&&(d(de),V(true));},$s=de=>{d(de.toString()),V(true);},Qd=async()=>{if(Y&&Oe)try{let de=Oe.destination_token_metadata.chain_type,Ee=Eo(rt,de);if(!Ee?.address){ie("Wallet address not available");return}let mr={service_provider:Y.service_provider,country_code:Y.country_code?.toUpperCase()||Ve?.alpha2?.toUpperCase()||"US",source_currency:Y.source_currency,source_amount:R,destination_currency:Y.destination_currency,destination_network:Y.destination_network,wallet_address:Ee.address,subdivision_code:Ve?.state||void 0},pn=await cu(mr,t);rr({provider:Y,sourceCurrency:c,sourceAmount:R,sessionUrl:pn.url}),P(pn.url),H(!0);}catch(de){console.error("Failed to create session:",de),ie("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:de});}},Ti=Bp(c),ja=()=>{H(false),J("onramp"),u?.({message:"Payment flow completed"});},Yd=()=>jsxRuntime.jsx(gw,{visible:Pe,onClose:ja,url:ue,providerName:Y?.service_provider_display_name||"Complete Payment",colors:_,fonts:v,borderTopLeftRadius:k?.webView?.borderTopLeftRadius??w,borderTopRightRadius:k?.webView?.borderTopRightRadius??x});return b==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:te.amountViewContainer,children:[jsxRuntime.jsxs(Tt,{style:te.scrollContainer,contentContainerStyle:te.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:te.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ve(true),style:[te.currencyButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.input.borderRadius,borderWidth:S.input.borderWidth,borderColor:S.input.borderColor}],children:[O&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(O,"png"))},style:te.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[te.currencyText,{color:S.card.titleColor,fontFamily:v.medium}],children:c.toUpperCase()}),jsxRuntime.jsx(Jt,{size:16,color:S.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(gd,{open:We,onOpenChange:ve,currencies:Ze,preferredCurrencyCodes:dt,selectedCurrency:c,onSelectCurrency:de=>{C(de.toLowerCase()),D(true);},borderTopLeftRadius:k?.currencyModal?.borderTopLeftRadius??w,borderTopRightRadius:k?.currencyModal?.borderTopRightRadius??x}),jsxRuntime.jsx(reactNative.View,{style:te.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:te.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.currencySymbol,{color:S.container.titleColor,fontFamily:v.medium}],children:Ti}),jsxRuntime.jsx(reactNative.TextInput,{style:[te.amountInput,{color:S.container.titleColor,fontFamily:v.medium}],value:R,onChangeText:Zl,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:_.foregroundMuted})]})}),O?.suggested_amounts&&O.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:te.quickAmounts,children:O.suggested_amounts.map(de=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>$s(de),style:[te.quickAmountButton,{backgroundColor:S.card.backgroundColor,borderRadius:S.button.borderRadius,borderWidth:parseFloat(R)===de?2:S.button.borderWidth,borderColor:parseFloat(R)===de?_.primary:S.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[te.quickAmountText,{color:S.card.titleColor,fontFamily:v.medium}],children:[Ti,de.toLocaleString()]})},de))}),Ge&&jsxRuntime.jsx(reactNative.Text,{style:[te.validationError,{color:_.error,fontFamily:v.regular}],children:Ge}),jsxRuntime.jsxs(reactNative.View,{style:te.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:te.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.providerLabel,{color:S.card.labelColor,fontFamily:v.medium}],children:"Provider"}),I.length>0&&!U&&jsxRuntime.jsxs(reactNative.Text,{style:[te.refreshText,{color:S.card.labelRightColor,fontFamily:v.regular}],children:["Refreshing in ",ye,"s"]})]}),jsxRuntime.jsx(xr,{cardTokens:S.depositCard.quoteProvider.card,onPress:U||I.length===0?void 0:()=>ge(true),contentStyle:reactNative.StyleSheet.flatten([te.providerButton,(U||I.length===0)&&te.disabled]),children:U?jsxRuntime.jsxs(reactNative.View,{style:te.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[te.loadingText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"Finding best rates..."})]}):Y?jsxRuntime.jsxs(reactNative.View,{style:te.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:te.providerInfo,children:[G&&jsxRuntime.jsx(reactNative.Text,{style:[te.autoPickedText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:te.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(uc(Y.icon_urls,"png",Y.icon_url))},style:te.providerIconImage},`provider-${Y.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[te.providerName,{color:S.card.titleColor,fontFamily:v.medium}],children:Y.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[te.bestPriceText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:[Y.destination_amount.toFixed(2)," ",M]})]})]})]}),jsxRuntime.jsx(Ur,{size:20,color:S.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[te.noProviderText,{color:S.container.subtitleColor,fontFamily:v.regular}],children:parseFloat(R)>0?"No providers available":"Enter an amount to see providers"})}),Ke&&jsxRuntime.jsx(reactNative.Text,{style:[te.errorText,{color:_.error,fontFamily:v.regular}],children:Ke})]}),jsxRuntime.jsxs(_t,{visible:Ne,onClose:()=>ge(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:k?.providerModal?.borderTopLeftRadius??w,borderTopRightRadius:k?.providerModal?.borderTopRightRadius??x,children:[jsxRuntime.jsx(eo,{title:"Select Provider",showBack:false,onClose:()=>ge(false)}),jsxRuntime.jsx(Tt,{style:te.providerModalList,contentContainerStyle:te.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:te.quotesList,children:I.map(de=>{let Ee=Y?.service_provider===de.service_provider;return jsxRuntime.jsxs(xr,{cardTokens:S.depositCard.quoteProvider.card,onPress:()=>{we(de),Ye(true),se(de.service_provider===Qe),ge(false);},contentStyle:reactNative.StyleSheet.flatten([te.quoteItem,Ee&&{borderWidth:2,borderColor:_.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:te.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(uc(de.icon_urls,"png",de.icon_url))},style:te.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[te.quoteName,{color:S.card.titleColor,fontFamily:v.medium}],children:de.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:te.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[te.quoteAmount,{color:S.card.textRightColor,fontFamily:v.medium}],children:[de.destination_amount.toFixed(2)," ",M]}),jsxRuntime.jsxs(reactNative.Text,{style:[te.quoteSource,{color:S.card.subtextRightColor,fontFamily:v.regular}],children:["Fee: ",Ti,de.total_fee.toFixed(2)]})]})]},de.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.continueButtonContainer,{backgroundColor:_.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:U||Ae||!Y||parseFloat(R)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Qd,disabled:U||Ae||!Y||parseFloat(R)<=0,style:[te.continueButton,{backgroundColor:S.container.buttonColor,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[te.continueButtonText,{color:S.container.buttonTitleColor,fontFamily:v.medium}],children:Ae?"Loading...":"Continue"})})})})]}),Yd()]}):b==="onramp"&&yt?jsxRuntime.jsxs(reactNative.View,{style:te.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(uc(yt.provider.icon_urls,"png",yt.provider.icon_url))},style:te.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[te.onrampTitle,{color:S.container.titleColor,fontFamily:v.medium}],children:["Complete transaction with ",yt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[te.onrampSubtitle,{color:S.container.subtitleColor,fontFamily:v.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[te.flowDiagram,{backgroundColor:S.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:te.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$t(`/icons/currencies/png/${yt.sourceCurrency.toLowerCase()}.png`)},style:te.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:yt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ur,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:te.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:te.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:_i(Oe?.destination_token_metadata?.icon_urls,"png")||Oe?.destination_token_metadata?.icon_url||$t("/icons/tokens/png/usdc.png")},style:te.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:_i(Oe?.destination_token_metadata?.chain?.icon_urls,"png")||Oe?.destination_token_metadata?.chain?.icon_url||$t("/icons/networks/png/polygon.png")},style:[te.flowNetworkBadge,{borderColor:_.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:"USDC"})]}),jsxRuntime.jsx(Ur,{size:16,color:S.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:te.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:te.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$e||$t("/icons/tokens/png/usdc.png")},style:te.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Ue||$t("/icons/networks/png/polygon.png")},style:[te.flowNetworkBadge,{borderColor:_.background,borderRadius:S.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowLabel,{color:S.card.subtitleColor,fontFamily:v.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[te.flowValue,{color:S.card.titleColor,fontFamily:v.medium}],children:M})]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.onrampInfoBox,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[te.onrampInfoText,{color:S.card.descriptionColor,fontFamily:v.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function gw({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Ls.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ls.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(lt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ls.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Ls.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Ls.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Ls.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Ls.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Ls=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"}}),te=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 ww(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 Td({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=re(xe(e.destination_token_metadata,"png")||$t("/icons/tokens/png/usdc.png")),u=i?"Deposit Processing":"Deposit Completed",p=ww(e.created_at||new Date().toISOString()),g=Sw(e.source_amount_usd);return jsxRuntime.jsxs(xr,{cardTokens:s,onPress:t,contentStyle:ui.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ui.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:ui.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ui.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(Ys,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ui.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ui.title,{color:s.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[ui.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:ui.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ui.amount,{color:s.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(Ur,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var ui=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 Nh(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 $h(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 kw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var jh=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function qh(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}=A(),o=qi.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Bs.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Bs.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Bs.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Bs.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var Bs=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 Ep({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=A(),[l,u]=qi.useState(r),[p,g]=qi.useState(false),[T,h]=qi.useState(null),[m,w]=qi.useState(false),x=qi.useRef(null);qi.useEffect(()=>{if(!e||!o)return;let c=async()=>{g(true);try{let D=[...(await Xo(o,n,"deposit")).data].sort((L,V)=>{let I=L.created_at?new Date(L.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-I});u(D);}catch(f){console.error("Failed to fetch executions:",f),u(r);}finally{g(false);}};c();let C=setInterval(c,1e4);return ()=>clearInterval(C)},[e,o,n,r]),qi.useEffect(()=>{r.length>0&&u(c=>{let C=new Set(c.map(D=>D.id)),f=r.filter(D=>!C.has(D.id));return f.length>0?[...f,...c]:c});},[r]),qi.useEffect(()=>{e||h(null);},[e]);let k=c=>{h(c);},_=()=>{h(null),w(false);},v=()=>{h(null),t();},S=()=>{if(!T)return null;let c=T,C=c.status==="pending"||c.status==="waiting"||c.status==="delayed",f=c.status==="succeeded",D=re(xe(c.destination_token_metadata,"png")||$t("/icons/tokens/png/usdc.png")),L=c.provider_metadata?.details,V=L?.currencyIn,I=L?.currencyOut;V?.currency?.symbol||"USDC";I?.currency?.symbol||"USDC";let q=$h(c.source_amount_base_unit,c.source_token_metadata?.decimals),Ke=$h(c.destination_amount_base_unit,c.destination_token_metadata?.decimals),ie=kw(c.source_amount_usd),Ge=Nh(c.source_chain_type,c.source_chain_id),$=Nh(c.destination_chain_type,c.destination_chain_id),le=()=>{c.explorer_url&&reactNative.Linking.openURL(c.explorer_url);},Q=()=>{c.destination_explorer_url&&reactNative.Linking.openURL(c.destination_explorer_url);};return jsxRuntime.jsxs(Tt,{ref:x,style:Le.scrollContainer,contentContainerStyle:Le.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Le.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Le.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:D},style:Le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Le.statusBadge,{backgroundColor:C?s.warning:s.success,borderColor:s.background}],children:C?jsxRuntime.jsx(Jt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(lt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Le.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Le.statusDot,{backgroundColor:C?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Le.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Le.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:xw(c.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[Le.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[q," ",qh(c.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Ke," ",qh(c.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ie})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ge})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:$})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Y=!m;w(Y),Y?setTimeout(()=>{x.current?.scrollToEnd({animated:true});},100):x.current?.scrollTo({y:0,animated:true});},style:Le.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:m?"See less":"See more details"}),m?jsxRuntime.jsx(fn,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:14,color:a.container.actionColor,strokeWidth:2})]}),m&&jsxRuntime.jsxs(reactNative.View,{style:[Le.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[c.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:le,style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:jh(c.transaction_hash)}),jsxRuntime.jsx(mn,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Le.cardDivider,{backgroundColor:s.border}]})]}),c.destination_explorer_url&&f&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Q,style:Le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:jh(c.destination_transaction_hashes[0])}),jsxRuntime.jsx(mn,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},R=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:T?"Deposit Details":"Deposit Tracker",onClose:v,showClose:!T,showBack:!!T,onBack:_}),T?S():R?jsxRuntime.jsx(Rw,{}):jsxRuntime.jsx(Tt,{style:Le.scrollContainer,contentContainerStyle:Le.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:Le.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[Le.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:Le.executionsList,children:l.map(c=>jsxRuntime.jsx(Td,{execution:c,onPress:()=>k(c)},c.id))})})]})}var Le=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 Hl(e,t=true){let[r,o]=qi.useState(null),[n,s]=qi.useState(null),[i,a]=qi.useState(false),[l,u]=qi.useState(false),[p,g]=qi.useState(null),[T,h]=qi.useState(null);qi.useEffect(()=>{!t||r||(a(true),il().then(k=>{o(k),g(null);}).catch(k=>{g(k instanceof Error?k:new Error(String(k)));}).finally(()=>{a(false);}));},[t,r]),qi.useEffect(()=>{!t||!e||n||(u(true),nl(e).then(k=>{s(k),h(null);}).catch(k=>{h(k instanceof Error?k:new Error(String(k)));}).finally(()=>{u(false);}));},[t,e,n]);let m=i||l,w=p||T||null,x=null;if(r&&n){let k=n.blocked_country_codes||[],_=r.alpha2.toUpperCase();x=!k.some(v=>v.toUpperCase()===_);}return {isAllowed:x,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:m,error:w}}var Up="unifold_recent_tokens",Fw=5,Zh=[{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 Id(){try{let e=await Mu__default.default.getItem(Up);return e?JSON.parse(e):[]}catch{return []}}async function Vw(e){try{let r=(await Id()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Fw);await Mu__default.default.setItem(Up,JSON.stringify(o));}catch{}}async function Dw(e){try{let r=(await Id()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Mu__default.default.setItem(Up,JSON.stringify(r)),r}catch{return []}}function Hp({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:u,heightPercent:p=.9,showHandle:g=true}){let{colors:T,fonts:h,components:m}=A(),[w,x]=qi.useState(""),[k,_]=qi.useState([]);qi.useEffect(()=>{e&&Id().then(_);},[e]),qi.useEffect(()=>{e||x("");},[e]);let v=qi.useMemo(()=>{let f=[];return r.forEach(D=>{D.chains.forEach(L=>{f.push({token:D,chain:L});});}),f},[r]),S=qi.useMemo(()=>{let f=[],D=new Set,L=(V,I,E,U)=>{let q=`${V}-${I}:${E}`;if(D.has(q))return;let Ke=r.find(Ge=>Ge.symbol===V);if(!Ke)return;let ie=Ke.chains.find(Ge=>Ge.chain_type===I&&Ge.chain_id===E);ie&&(D.add(q),f.push({token:Ke,chain:ie,isRecent:U}));};return k.forEach(V=>{L(V.symbol,V.chainType,V.chainId,true);}),Zh.forEach(V=>{L(V.symbol,V.chainType,V.chainId,false);}),f},[r,k]),R=qi.useMemo(()=>{if(!w.trim())return v;let f=w.toLowerCase();return v.filter(({token:D,chain:L})=>D.symbol.toLowerCase().includes(f)||D.name.toLowerCase().includes(f)||L.chain_name.toLowerCase().includes(f))},[v,w]),d=(f,D,L)=>Zh.some(V=>V.symbol===f&&V.chainType===D&&V.chainId===L),c=async(f,D)=>{let L=`${D.chain_type}:${D.chain_id}`;if(!d(f.symbol,D.chain_type,D.chain_id)){await Vw({symbol:f.symbol,chainType:D.chain_type,chainId:D.chain_id});let V=await Id();_(V);}x(""),s(f.symbol,L),t();},C=async(f,D)=>{let L=await Dw({symbol:f.symbol,chainType:D.chain_type,chainId:D.chain_id});_(L);};return jsxRuntime.jsxs(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:g,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:u,children:[jsxRuntime.jsxs(reactNative.View,{style:[Mt.header,!g&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:Mt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.headerTitle,{color:m.header.titleColor,fontFamily:h.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Mt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(ht,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Mt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Mt.searchInput,{backgroundColor:m.search.backgroundColor,color:m.search.inputColor,fontFamily:h.regular,borderRadius:m.input.borderRadius,borderWidth:m.input.borderWidth,borderColor:m.input.borderColor}],placeholder:"Search",placeholderTextColor:m.search.placeholderColor,value:w,onChangeText:x,autoCapitalize:"none",autoCorrect:false})}),!l&&S.length>0&&!w&&jsxRuntime.jsxs(reactNative.View,{style:Mt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.sectionLabel,{color:m.list.titleSectionColor,fontFamily:h.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Mt.quickSelectScroll,children:S.map(({token:f,chain:D,isRecent:L})=>{let V=`${D.chain_type}:${D.chain_id}`;f.symbol===o&&V===n;return jsxRuntime.jsxs(reactNative.View,{children:[L&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>C(f,D),style:Mt.removeButton,children:jsxRuntime.jsx(ht,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>c(f,D),activeOpacity:.7,style:[Mt.quickSelectItem,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(f,"png"))},style:Mt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(D,"png"))},style:[Mt.quickSelectChainBadge,{borderColor:m.card.backgroundColor,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Mt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.quickSelectSymbol,{color:m.card.titleColor,fontFamily:h.medium}],children:f.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.quickSelectChain,{color:m.card.subtitleColor,fontFamily:h.regular}],children:D.chain_name})]})]})]},`quick-${f.symbol}-${V}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.sectionLabel,{color:m.list.titleSectionColor,fontFamily:h.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Tt,{style:Mt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Mt.tokenListContent,children:R.length===0?jsxRuntime.jsx(reactNative.View,{style:Mt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Mt.emptyText,{color:T.foregroundMuted,fontFamily:h.regular}],children:"No tokens found"})}):R.map(({token:f,chain:D})=>{let L=`${D.chain_type}:${D.chain_id}`,V=f.symbol===o&&L===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>c(f,D),activeOpacity:.7,style:[Mt.tokenItem,{backgroundColor:V?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(f,"png"))},style:Mt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(D,"png"))},style:[Mt.tokenChainBadge,{borderColor:m.card.backgroundColor,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Mt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.tokenSymbol,{color:m.card.titleColor,fontFamily:h.medium}],children:f.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.tokenChainName,{color:m.card.subtitleColor,fontFamily:h.regular}],children:D.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Mt.minDeposit,{color:m.card.labelColor,fontFamily:h.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:m.card.labelHighlightRightColor,fontFamily:h.regular},children:["$",D.minimum_deposit_amount_usd]})]})]},`${f.symbol}-${L}`)})})]})}var Mt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Nl=(e,t)=>`${t}:${e}`,Ww=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Np({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,onLatestExecution:m,onShowStatusSheet:w,onSelectedTokenIconUrl:x,wallets:k,borderTopLeftRadius:_,borderTopRightRadius:v,sheetBorderRadius:S}){let{colors:R,fonts:d,components:c}=A(),C=a&&l?`${a}:${l}`:"solana:mainnet",[f,D]=qi.useState("USDC"),[L,V]=qi.useState(C),[I,E]=qi.useState([]),[U,q]=qi.useState(!k?.length),Ke=k?.length?k:I,[ie,Ge]=qi.useState([]),[$,le]=qi.useState(true),[Q,Y]=qi.useState(false),[we,G]=qi.useState(false),[se,Qe]=qi.useState(false),[Be,Je]=qi.useState([]),[Ye,ze]=qi.useState(new Map),[Me]=qi.useState(()=>new Date),[rt,De]=qi.useState(null),[Ae,ne]=qi.useState(false),[ye,ke]=qi.useState(null),[Ze,He]=qi.useState(false);qi.useEffect(()=>{ye&&m?.(ye);},[ye]),qi.useEffect(()=>{Ae&&(w?.(true),ne(false));},[Ae]);let dt=new Map;ie.forEach(H=>{H.chains.forEach(ue=>{let P=`${ue.chain_type}:${ue.chain_id}`;dt.has(P)||dt.set(P,ue);});});let Ht=Array.from(dt.values()),_e=Ww(L),Re=Ht.find(H=>H.chain_type===_e.chainType&&H.chain_id===_e.chainId),Ve=Re?.chain_type||"ethereum",at=Eo(Ke,Ve),Ie=at?.address||"",be=qi.useRef(false);qi.useEffect(()=>{async function H(){try{le(!0),De(null);let P=await qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Ge(P.data),P.data.length>0&&!be.current){be.current=!0;let b,B;if(a&&l)if(u)for(let O of P.data){let J=O.chains.find(M=>M.chain_type===a&&M.chain_id===l&&M.token_address.toLowerCase()===u.toLowerCase());if(J){b=O,B=J;break}}else {let O=M=>M.chain_type===a&&M.chain_id===l,J=P.data.find(M=>M.symbol==="USDC"&&M.chains.some(O));if(J)b=J,B=J.chains.find(O);else for(let M of P.data){let $e=M.chains.find(O);if($e){b=M,B=$e;break}}}if(!b&&s)for(let O of P.data){let J=O.chains.find(M=>M.token_address.toLowerCase()===s.toLowerCase());if(J){b=O,B=J;break}}b||(b=P.data.find(O=>O.symbol==="USDC"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=P.data.find(O=>O.symbol==="USDT"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=P.data[0],b.chains.length>0&&(B=b.chains[0])),b&&D(b.symbol),B&&V(Nl(B.chain_id,B.chain_type));}}catch(ue){console.error("Error fetching supported tokens:",ue),De("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:ue});}finally{le(false);}}H();},[t,s,n,o,a,l,u,h]),qi.useEffect(()=>{g&&g(Be);},[Be,g]),qi.useEffect(()=>{if(k?.length){q(false);return}if(I.length>0){q(false);return}let H=null,ue=false,P=async()=>{if(!ue){q(true);try{let b=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);ue||(E(b.data),De(null),q(!1));}catch(b){console.error("Error fetching wallets, retrying in 5s:",b),ue||(De(b instanceof Error?b.message:"Failed to load wallets"),q(false),H=setTimeout(P,5e3));}}};return P(),()=>{ue=true,H&&clearTimeout(H);}},[e,r,o,n,s,t,k,I.length]);let Oe=at?.id??"",{showWaitingUi:zt,handleIveDeposited:Ut}=si({depositConfirmationMode:p,depositAddress:Ie,chain:L,externalUserId:e,publishableKey:t,modalOpenedAt:Me,depositWalletId:Oe,depositExecutions:Be,trackedExecutions:Ye,setDepositExecutions:Je,setTrackedExecutions:ze,setLatestExecution:ke,setShowStatusSheet:ne,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h});qi.useEffect(()=>{if(!ie.length)return;let H=ie.find(P=>P.symbol===f);if(!H||H.chains.length===0){let P=ie.find(b=>b.symbol==="USDC")||ie[0];P&&(D(P.symbol),P.chains.length>0&&V(Nl(P.chains[0].chain_id,P.chains[0].chain_type)));return}if(!H.chains.some(P=>Nl(P.chain_id,P.chain_type)===L)){let P=H.chains[0];V(Nl(P.chain_id,P.chain_type));}},[f,ie,L]);let wt=ie.find(H=>H.symbol===f),yt=xe(wt,"png")||void 0;qi.useEffect(()=>{x?.(yt);},[yt]);let We=(wt?.chains||[]).find(H=>Nl(H.chain_id,H.chain_type)===L),ve=async()=>{if(Ie)try{reactNative.Clipboard.setString(Ie),Y(!0),setTimeout(()=>Y(!1),2e3);}catch(H){console.error("Failed to copy:",H);}},Ne=We?.estimated_price_impact_percent??0,ge=We?.max_slippage_percent??.25,Pe=We?.minimum_deposit_amount_usd??3;return $?jsxRuntime.jsxs(reactNative.View,{style:ee.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:R.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ee.loadingText,{color:R.foregroundMuted,fontFamily:d.regular}],children:"Loading currencies..."})]}):rt&&ie.length===0?jsxRuntime.jsxs(reactNative.View,{style:ee.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.errorText,{color:R.error,fontFamily:d.regular}],children:rt}),jsxRuntime.jsx(reactNative.Text,{style:[ee.errorHint,{color:R.foregroundMuted,fontFamily:d.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ee.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.selectorLabel,{color:c.card.labelColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Qe(true),disabled:$||ie.length===0,style:[ee.tokenSelectorButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],activeOpacity:.7,children:$?jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.loadingIcon,{backgroundColor:R.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.loadingLine,{backgroundColor:R.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[ee.loadingLine,{backgroundColor:R.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ee.tokenIconWrapper,children:[wt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(wt,"png"))},style:ee.tokenMainIcon}),(We||Re)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(We||Re,"png"))},style:[ee.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSelectorSymbol,{color:c.card.titleColor,fontFamily:d.semibold}],children:wt?.symbol||f}),jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSelectorNetwork,{color:c.card.subtitleColor,fontFamily:d.regular}],numberOfLines:1,children:We?.chain_name||Re?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ee.minDepositText,{color:R.warning,fontFamily:d.medium}],children:["$",Pe," minimum"]}),jsxRuntime.jsx(Ur,{size:16,color:c.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Hp,{visible:se,onClose:()=>Qe(false),tokens:ie,selectedToken:f,selectedChainKey:L,onSelect:(H,ue)=>{D(H),V(ue);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??_,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:ee.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ee.qrWrapper,{backgroundColor:R.background,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth>0?c.card.borderWidth:1,borderColor:c.card.borderColor}],children:U?jsxRuntime.jsxs(reactNative.View,{style:ee.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:R.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ee.loadingText,{color:R.foregroundMuted,fontFamily:d.regular}],children:"Loading..."})]}):Ie?jsxRuntime.jsx(Zi,{value:Ie,size:180,logoUri:re(xe(We,"png")||$t("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:ee.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ee.errorText,{color:R.error,fontFamily:d.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:ee.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.addressLabel,{color:c.card.labelColor,fontFamily:d.medium}],children:"Deposit Address"}),Q&&jsxRuntime.jsxs(reactNative.View,{style:ee.copiedIndicator,children:[jsxRuntime.jsx(lt,{size:14,color:R.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ee.copiedText,{color:R.success,fontFamily:d.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(xr,{cardTokens:c.transferCrypto.depositAddress.card,onPress:!U&&Ie?ve:void 0,contentStyle:ee.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.addressText,{color:c.card.titleColor,fontFamily:d.regular}],numberOfLines:2,children:U?"Loading...":Ie||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:ee.addressCopyIcon,children:jsxRuntime.jsx(Go,{size:16,color:c.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ee.detailsCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(!we),style:ee.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ee.chevronContainer,children:we?jsxRuntime.jsx(fn,{size:16,color:c.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:16,color:c.card.actionColor,strokeWidth:2})})]}),we&&jsxRuntime.jsxs(reactNative.View,{style:ee.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:["Price impact: ",Ne.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>He(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:["Slippage: Auto \u2022 ",ge.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>He(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(hn,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.detailsLabel,{color:c.card.titleColor,fontFamily:d.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ud,{depositConfirmationMode:p,depositAddress:Ie,showWaitingUi:zt,latestExecution:ye,onIveDeposited:Ut}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:ee.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[ee.termsText,{color:R.primary,fontFamily:d.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(_t,{visible:Ze,onClose:()=>He(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??_,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[ee.sheetHeader,{borderBottomColor:R.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ee.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ee.sheetTitle,{color:c.header.titleColor,fontFamily:d.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>He(false),style:ee.sheetCloseButton,children:jsxRuntime.jsx(ht,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ee.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardTitle,{color:c.card.titleColor,fontFamily:d.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.infoCardValue,{color:c.card.titleColor,fontFamily:d.medium}],children:[Ne.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardDescription,{color:c.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:[ee.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardTitle,{color:c.card.titleColor,fontFamily:d.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.infoCardValue,{color:c.card.titleColor,fontFamily:d.medium}],children:[ge.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.infoCardDescription,{color:c.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."})]})]})]})]})}var ee=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Ea=(e,t)=>`${t}:${e}`,Hw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},Nw=e=>e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`;function Fd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:T,onDepositError:h,onLatestExecution:m,onShowStatusSheet:w,onSelectedTokenIconUrl:x,onShowInfoSheet:k,onInfoSheetData:_,wallets:v,borderTopLeftRadius:S,borderTopRightRadius:R,sheetBorderRadius:d}){let{colors:c,fonts:C,components:f}=A(),D=a&&l?`${a}:${l}`:"solana:mainnet",[L,V]=qi.useState("USDC"),[I,E]=qi.useState(D),[U,q]=qi.useState([]),[Ke,ie]=qi.useState(!v?.length),Ge=v?.length?v:U,[$,le]=qi.useState([]),[Q,Y]=qi.useState(true),[we,G]=qi.useState(false),[se,Qe]=qi.useState(false),[Be,Je]=qi.useState(false),[Ye,ze]=qi.useState([]),[Me,rt]=qi.useState(new Map),[De]=qi.useState(()=>new Date),[Ae,ne]=qi.useState(null),[ye,ke]=qi.useState(false),[Ze,He]=qi.useState(null),[dt,Ht]=qi.useState(false),[_e,Re]=qi.useState(false),[Ve,at]=qi.useState(""),[Ie,be]=qi.useState(""),Oe=qi.useRef(new reactNative.Animated.Value(0)).current;qi.useEffect(()=>{let Fe=reactNative.Animated.loop(reactNative.Animated.timing(Oe,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Fe.start(),()=>Fe.stop()},[Oe]);let zt=Oe.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});qi.useEffect(()=>{Ze&&m?.(Ze);},[Ze]),qi.useEffect(()=>{ye&&(w?.(true),ke(false));},[ye]);let Ut=new Map;$.forEach(Fe=>{Fe.chains.forEach(Ft=>{let ot=`${Ft.chain_type}:${Ft.chain_id}`;Ut.has(ot)||Ut.set(ot,Ft);});});let wt=Array.from(Ut.values()),yt=Hw(I),rr=wt.find(Fe=>Fe.chain_type===yt.chainType&&Fe.chain_id===yt.chainId),We=rr?.chain_type||"ethereum",ve=Eo(Ge,We),Ne=ve?.address||"",ge=qi.useRef(false);qi.useEffect(()=>{async function Fe(){try{Y(!0),ne(null);let ot=await qn(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(le(ot.data),ot.data.length>0&&!ge.current){ge.current=!0;let Xe,ro;if(a&&l)if(u)for(let Kt of ot.data){let Mr=Kt.chains.find(Br=>Br.chain_type===a&&Br.chain_id===l&&Br.token_address.toLowerCase()===u.toLowerCase());if(Mr){Xe=Kt,ro=Mr;break}}else {let Kt=Br=>Br.chain_type===a&&Br.chain_id===l,Mr=ot.data.find(Br=>Br.symbol==="USDC"&&Br.chains.some(Kt));if(Mr)Xe=Mr,ro=Mr.chains.find(Kt);else for(let Br of ot.data){let Ns=Br.chains.find(Kt);if(Ns){Xe=Br,ro=Ns;break}}}if(!Xe&&s)for(let Kt of ot.data){let Mr=Kt.chains.find(Br=>Br.token_address.toLowerCase()===s.toLowerCase());if(Mr){Xe=Kt,ro=Mr;break}}Xe||(Xe=ot.data.find(Kt=>Kt.symbol==="USDC"),Xe&&Xe.chains.length>0&&(ro=Xe.chains[0])),Xe||(Xe=ot.data.find(Kt=>Kt.symbol==="USDT"),Xe&&Xe.chains.length>0&&(ro=Xe.chains[0])),Xe||(Xe=ot.data[0],Xe.chains.length>0&&(ro=Xe.chains[0])),Xe&&V(Xe.symbol),ro&&E(Ea(ro.chain_id,ro.chain_type));}}catch(Ft){console.error("Error fetching supported tokens:",Ft),ne("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:Ft});}finally{Y(false);}}Fe();},[t,s,n,o,a,l,u,h]),qi.useEffect(()=>{g&&g(Ye);},[Ye,g]),qi.useEffect(()=>{if(v?.length){ie(false);return}if(U.length>0){ie(false);return}let Fe=null,Ft=false,ot=async()=>{if(!Ft){ie(true);try{let Xe=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Ft||(q(Xe.data),ne(null),ie(!1));}catch(Xe){console.error("Error fetching wallets, retrying in 5s:",Xe),Ft||(ne(Xe instanceof Error?Xe.message:"Failed to load wallets"),ie(false),Fe=setTimeout(ot,5e3));}}};return ot(),()=>{Ft=true,Fe&&clearTimeout(Fe);}},[e,r,o,n,s,t,v,U.length]);let Pe=ve?.id??"",{showWaitingUi:H,handleIveDeposited:ue}=si({depositConfirmationMode:p,depositAddress:Ne,chain:I,externalUserId:e,publishableKey:t,modalOpenedAt:De,depositWalletId:Pe,depositExecutions:Ye,trackedExecutions:Me,setDepositExecutions:ze,setTrackedExecutions:rt,setLatestExecution:He,setShowStatusSheet:ke,onDepositSuccess:T,onExecutionsChange:g,onDepositError:h}),P=p==="manual"&&Ne&&!H;qi.useEffect(()=>{if(!$.length)return;let Fe=$.find(ot=>ot.symbol===L);if(!Fe||Fe.chains.length===0){let ot=$.find(Xe=>Xe.symbol==="USDC")||$[0];ot&&(V(ot.symbol),ot.chains.length>0&&E(Ea(ot.chains[0].chain_id,ot.chains[0].chain_type)));return}if(!Fe.chains.some(ot=>Ea(ot.chain_id,ot.chain_type)===I)){let ot=Fe.chains[0];E(Ea(ot.chain_id,ot.chain_type));}},[L,$,I]);let b=$.find(Fe=>Fe.symbol===L),B=xe(b,"png")||void 0;qi.useEffect(()=>{x?.(B);},[B]);let O=b?.chains||[],J=O.find(Fe=>Ea(Fe.chain_id,Fe.chain_type)===I),M=async()=>{if(Ne)try{reactNative.Clipboard.setString(Ne),G(!0),setTimeout(()=>G(!1),2e3);}catch(Fe){console.error("Failed to copy:",Fe);}},$e=J?.estimated_price_impact_percent??0,Ue=J?.max_slippage_percent??.25,Gr=J?.minimum_deposit_amount_usd??3,X=J?.chain_name||rr?.chain_name||"Network",Hs=qi.useMemo(()=>{if(!Ve.trim())return O;let Fe=Ve.toLowerCase();return O.filter(Ft=>Ft.chain_name.toLowerCase().includes(Fe))},[O,Ve]),Dt=qi.useMemo(()=>{if(!Ie.trim())return $;let Fe=Ie.toLowerCase();return $.filter(Ft=>Ft.symbol.toLowerCase().includes(Fe)||Ft.name?.toLowerCase().includes(Fe)||Ft.chains.some(ot=>ot.chain_name.toLowerCase().includes(Fe)))},[$,Ie]);return Q?jsxRuntime.jsxs(reactNative.View,{style:oe.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[oe.loadingText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Loading currencies..."})]}):Ae&&$.length===0?jsxRuntime.jsxs(reactNative.View,{style:oe.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.errorText,{color:c.error,fontFamily:C.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[oe.errorHint,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:oe.container,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.content,children:[jsxRuntime.jsx(reactNative.View,{style:oe.qrSection,children:jsxRuntime.jsx(reactNative.View,{style:[oe.qrCard,{backgroundColor:c.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:Ke?jsxRuntime.jsxs(reactNative.View,{style:oe.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.primary}),jsxRuntime.jsx(reactNative.Text,{style:[oe.loadingText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"Loading..."})]}):Ne?jsxRuntime.jsx(reactNative.View,{style:oe.qrWrapper,children:jsxRuntime.jsx(Zi,{value:Ne,size:200,logoUri:re(xe(b,"png")||$t("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:re(xe(J,"png")||$t("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:oe.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.errorText,{color:c.error,fontFamily:C.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:oe.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{at(""),Re(true);},style:[oe.selectorPill,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:[(J||rr)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(J||rr,"png"))},style:oe.selectorPillIcon}),jsxRuntime.jsx(Jt,{size:14,color:f.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{be(""),Je(true);},disabled:Q||$.length===0,style:[oe.selectorPill,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:[b&&jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(b,"png"))},style:oe.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[oe.selectorPillText,{color:f.card.titleColor,fontFamily:C.semibold}],children:b?.symbol||L}),jsxRuntime.jsx(Jt,{size:14,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:oe.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:M,style:[oe.addressPill,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.addressPillText,{color:f.card.titleColor,fontFamily:C.regular}],numberOfLines:1,children:Ke?"Loading...":Ne?Nw(Ne):"No address"}),we?jsxRuntime.jsx(lt,{size:14,color:c.success,strokeWidth:2}):jsxRuntime.jsx(Go,{size:14,color:f.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:H&&!Ze?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:zt}]},children:jsxRuntime.jsx(Ga,{size:16,color:c.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:c.foregroundMuted,fontFamily:C.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_?.({priceImpact:$e,maxSlippage:Ue,minDepositUsd:Gr,chainName:X}),k?.(true);},style:oe.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(hn,{size:14,color:f.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.infoFooterText,{color:f.card.subtitleColor,fontFamily:C.regular}],numberOfLines:1,children:["$",Gr," ",X," Minimum and ","<","1 min Processing"]})]}),P?jsxRuntime.jsxs(reactNative.View,{style:oe.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:oe.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:ue,activeOpacity:.8,style:[oe.ctaButton,{backgroundColor:c.primary,borderRadius:f.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.ctaText,{color:c.primaryForeground??"#FFF",fontFamily:C.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:oe.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[oe.ctaButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.button.borderRadius,borderWidth:1,borderColor:c.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.ctaText,{color:c.foreground,fontFamily:C.semibold}],children:we?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:M,activeOpacity:.8,style:[oe.ctaButton,{backgroundColor:c.primary,borderRadius:f.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.ctaText,{color:"#FFFFFF",fontFamily:C.semibold}],children:we?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(_t,{visible:Be,onClose:()=>{Je(false),be("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:d?.tokenSelector?.borderTopLeftRadius??S,borderTopRightRadius:d?.tokenSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[oe.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:oe.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[oe.sheetTitle,{color:f.header.titleColor,fontFamily:C.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Je(false),be("");},style:oe.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(ht,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:oe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[oe.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:C.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:f.search.placeholderColor,value:Ie,onChangeText:be,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Tt,{style:oe.sheetList,contentContainerStyle:oe.sheetListContent,showsVerticalScrollIndicator:false,children:Dt.length===0?jsxRuntime.jsx(reactNative.View,{style:oe.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.emptyText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"No tokens found"})}):Dt.map(Fe=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(Fe.symbol),Je(false),be("");},activeOpacity:.7,style:[oe.sheetItem,{backgroundColor:L===Fe.symbol?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(Fe,"png"))},style:oe.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[oe.sheetItemTitle,{color:f.card.titleColor,fontFamily:C.medium}],children:Fe.symbol}),jsxRuntime.jsx(reactNative.View,{style:oe.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[oe.sheetItemBadge,{borderWidth:1,borderColor:c.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[oe.sheetItemBadgeText,{color:f.card.subtitleColor,fontFamily:C.medium}],children:[Fe.chains.length," chain",Fe.chains.length!==1?"s":""]})})]},Fe.symbol))})]}),jsxRuntime.jsxs(_t,{visible:_e,onClose:()=>{Re(false),at("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:d?.chainSelector?.borderTopLeftRadius??S,borderTopRightRadius:d?.chainSelector?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[oe.sheetHeader,{borderBottomColor:c.border}],children:[jsxRuntime.jsx(reactNative.View,{style:oe.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[oe.sheetTitle,{color:f.header.titleColor,fontFamily:C.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Re(false),at("");},style:oe.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(ht,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:oe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[oe.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:C.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search networks",placeholderTextColor:f.search.placeholderColor,value:Ve,onChangeText:at,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Tt,{style:oe.sheetList,contentContainerStyle:oe.sheetListContent,showsVerticalScrollIndicator:false,children:Hs.length===0?jsxRuntime.jsx(reactNative.View,{style:oe.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.emptyText,{color:c.foregroundMuted,fontFamily:C.regular}],children:"No networks found"})}):Hs.map(Fe=>{let Ft=Ea(Fe.chain_id,Fe.chain_type),ot=I===Ft;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{E(Ft),Re(false),at("");},activeOpacity:.7,style:[oe.chainItem,{backgroundColor:ot?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(Fe,"png"))},style:oe.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:oe.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.chainItemName,{color:f.card.titleColor,fontFamily:C.medium}],children:Fe.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[oe.chainMinBadge,{backgroundColor:`${c.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[oe.chainMinBadgeText,{color:c.warning,fontFamily:C.medium}],children:["$",Fe.minimum_deposit_amount_usd," Minimum"]})})]},Ft)})})]})]})}var oe=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function ag(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Kw(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function Dd({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:u,useModal:p,heightProcessing:g,heightCompleted:T,heightCompletedExpanded:h}){let {colors:m,fonts:w,components:x}=A(),[k,_]=qi.useState(false),v=t==="pending"||t==="waiting"||t==="delayed",S=t==="succeeded",d=()=>{o&&reactNative.Linking.openURL(o);},c=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(_t,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:S?k?h??T??.55:T??.55:g??.4,borderTopLeftRadius:l,borderTopRightRadius:u,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:dr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:dr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:x.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:dr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:dr.container,children:[jsxRuntime.jsx(reactNative.View,{style:dr.iconContainer,children:v?jsxRuntime.jsx(St,{size:80,strokeWidth:4,iconSize:56,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:re(r)},style:dr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[dr.tokenIconFill,{backgroundColor:m.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:re(r)},style:dr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[dr.tokenIconLarge,{backgroundColor:m.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[dr.statusBadge,{backgroundColor:x.container.iconBackgroundColor}],children:jsxRuntime.jsx(lt,{size:16,color:x.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[dr.title,{color:x.container.titleColor,fontFamily:w.semibold}],children:v?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[dr.amount,{color:x.container.titleColor,fontFamily:w.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[dr.date,{color:x.container.subtitleColor,fontFamily:w.regular}],children:Kw(s)}),jsxRuntime.jsx(reactNative.Text,{style:[dr.subtitle,{color:x.container.subtitleColor,fontFamily:w.regular}],children:v?"This usually takes less than a minute.":"Your account has been credited successfully!"}),S&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:dr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[dr.divider,{backgroundColor:m.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:dr.detailsToggle,onPress:()=>_(!k),children:[jsxRuntime.jsx(reactNative.Text,{style:[dr.detailsToggleText,{color:x.container.actionTitle,fontFamily:w.medium}],children:k?"See less":"See more details"}),k?jsxRuntime.jsx(fn,{size:18,color:x.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:18,color:x.container.actionColor,strokeWidth:2})]}),k&&jsxRuntime.jsxs(reactNative.View,{style:dr.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[dr.txButton,{backgroundColor:x.card.backgroundColor,borderColor:m.border}],onPress:d,children:[jsxRuntime.jsx(reactNative.Text,{style:[dr.txLabel,{color:x.card.titleColor,fontFamily:w.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[dr.txHash,{color:x.card.subtitleColor,fontFamily:w.regular}],children:ag(o)}),jsxRuntime.jsx(mn,{size:16,color:x.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[dr.txButton,{backgroundColor:x.card.backgroundColor,borderColor:m.border}],onPress:c,children:[jsxRuntime.jsx(reactNative.Text,{style:[dr.txLabel,{color:x.card.titleColor,fontFamily:w.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[dr.txHash,{color:x.card.subtitleColor,fontFamily:w.regular}],children:ag(n)}),jsxRuntime.jsx(mn,{size:16,color:x.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var dr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function $p({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:u,fonts:p,components:g}=A(),T=[{icon:jsxRuntime.jsx(oo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(Jo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(Jo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(uo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(_t,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:Ko.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ko.header,children:[jsxRuntime.jsxs(reactNative.View,{style:Ko.titleRow,children:[jsxRuntime.jsx(hn,{size:16,color:g.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ko.title,{color:g.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:Ko.closeButton,children:jsxRuntime.jsx(ht,{size:18,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ko.rows,children:[T.map((h,m)=>jsxRuntime.jsxs(reactNative.View,{style:Ko.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Ko.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:h.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Ko.label,{color:g.card.titleColor,fontFamily:p.regular}],children:h.label})]},m)),jsxRuntime.jsxs(reactNative.View,{style:Ko.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Ko.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qs,{size:14,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ko.label,{color:g.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var Ko=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var yi={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 eS(){let{colors:e,components:t}=A(),r=qi.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;qi.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[os.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[os.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:os.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[os.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[os.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:os.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[os.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:os.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var os=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 tS({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,showBalance:h=false,hideDepositTracker:m=false,enableCashApp:w=false,enableStripeLinkPay:x=false,StripeOnrampComponent:k,stripeOnrampEmail:_,stripeOnrampPhone:v,stripeMerchantIdentifier:S,stripePaymentSelectorPosition:R,stripeSkipSuccessConfirmation:d,stripeTheme:c,depositConfirmationMode:C="auto_ui",transferInputVariant:f="double_input",initialScreen:D="main",onDepositSuccess:L,onDepositError:V,sheetBorderRadius:I}){let E=I?.globalBorderTopLeftRadius,U=I?.globalBorderTopRightRadius,{colors:q,fonts:Ke}=A(),[ie,Ge]=qi.useState([]),[$,le]=qi.useState(null),[Q,Y]=qi.useState("amount"),[we,G]=qi.useState(false),[se,Qe]=qi.useState(null),[Be,Je]=qi.useState(void 0),[Ye,ze]=qi.useState(false),[Me,rt]=qi.useState(null),De=D==="tracker"&&!m?"tracker":D==="transfer"?"transfer":D==="card"?"card":D==="cashapp"&&w?"cashapp":"main",Ae=De==="main",[ne,ye]=qi.useState(De),{isAllowed:ke,isLoading:Ze}=Hl(o,e);qi.useEffect(()=>{if(!e||$)return;let ve=false;return nl(o).then(async Ne=>{if(ve)return;let ge=[];for(let Pe of Ne?.transfer_crypto?.networks??[]){let H=Pe.icon_urls.find(ue=>ue.format==="png")?.url||Pe.icon_urls.find(ue=>ue.format==="svg")?.url;H&&ge.push(re(H));}for(let Pe of Ne?.payment_networks?.networks??[]){let H=Pe.icon_urls.find(ue=>ue.format==="png")?.url||Pe.icon_urls.find(ue=>ue.format==="svg")?.url;H&&ge.push(re(H));}ge.length>0&&await hp(ge),ve||le(Ne);}).catch(console.error),()=>{ve=true;}},[e,$,o]);let He=()=>{t();};qi.useEffect(()=>{e&&(ye(De),Y("amount"),ze(false),rt(null));},[e,De]);let dt=qi.useCallback(ve=>{ve.length!==0&&Ge(Ne=>{let ge=new Map(Ne.map(Pe=>[Pe.id,Pe]));for(let Pe of ve)ge.set(Pe.id,Pe);return Array.from(ge.values())});},[]),Ht=qi.useCallback(()=>{ze(false),rt(null),Ae?(ye("main"),Y("amount")):He();},[Ae,He]),_e=ie.filter(ve=>ve.status==="pending"||ve.status==="waiting").length,Ve=!!(i&&a&&l&&u&&o)&&h!==false&&!!$,at=Ze||e&&!$,Ie=ke===false,be=null;if(ne==="stripe"&&k){let ve=jsxRuntime.jsx(k,{publishableKey:o,email:_,phone:v,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,merchantIdentifier:S,paymentSelectorPosition:R,skipSuccessConfirmation:d,appName:$?.project_name??"",onClose:Ht});be=c?jsxRuntime.jsx(Gs,{...c,children:ve}):ve;}let Oe=ne==="stripe"||ne==="transfer"||ne==="card"||ne==="cashapp"?.9:ne==="tracker"?.6:ne==="main"?w?.6:.5:void 0,zt=ne==="main"?.9:void 0,wt={main:I?.main,transfer:I?.transferCrypto,card:I?.buyWithCard,stripe:I?.stripeLinkPay,cashapp:I?.cashApp,tracker:I?.depositsTracker}[ne],yt=wt?.borderTopLeftRadius??E,rr=wt?.borderTopRightRadius??U,We=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[se&&jsxRuntime.jsx(Dd,{visible:we,useModal:false,status:se.status,tokenIconUrl:se.destination_token_metadata?.icon_urls?.find(ve=>ve.format==="png")?.url||se.destination_token_metadata?.icon_url||Be,explorerUrl:se.explorer_url,completionExplorerUrl:se.destination_explorer_url,date:se.created_at?new Date(se.created_at):void 0,amountUsd:se.source_amount_usd?parseFloat(se.source_amount_usd):void 0,onClose:()=>G(false),heightProcessing:ne==="card"?.35:void 0,heightCompleted:ne==="card"?.41:void 0,heightCompletedExpanded:ne==="card"?.53:void 0,borderTopLeftRadius:I?.depositStatus?.borderTopLeftRadius??E,borderTopRightRadius:I?.depositStatus?.borderTopRightRadius??U}),Me&&jsxRuntime.jsx($p,{visible:Ye,useModal:false,onClose:()=>ze(false),priceImpact:Me.priceImpact,maxSlippage:Me.maxSlippage,minDepositUsd:Me.minDepositUsd,chainName:Me.chainName,borderTopLeftRadius:I?.infoSheet?.borderTopLeftRadius??E,borderTopRightRadius:I?.infoSheet?.borderTopRightRadius??U})]});return jsxRuntime.jsxs(_t,{visible:e,onClose:ne==="main"?He:Ht,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:Oe,maxHeightPercent:zt,borderTopLeftRadius:yt,borderTopRightRadius:rr,overlay:We,children:[ne==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:n,showBack:false,onClose:He,showBalance:Ve,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:$?.project_name}),at&&jsxRuntime.jsx(eS,{}),!at&&Ie&&jsxRuntime.jsxs(reactNative.View,{style:Kr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Kr.iconContainer,{backgroundColor:q.cardHover}],children:jsxRuntime.jsx(Ja,{size:32,color:q.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedTitle,{color:q.foreground,fontFamily:Ke.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedDescription,{color:q.foreground,opacity:.7,fontFamily:Ke.regular}],children:"There are no supported tokens available from your current location."})]}),!at&&!Ie&&jsxRuntime.jsxs(reactNative.View,{style:Kr.optionsContainer,children:[jsxRuntime.jsx(Fl,{onPress:()=>ye("transfer"),title:yi.transferCrypto.title,subtitle:yi.transferCrypto.subtitle,featuredTokens:$?.transfer_crypto?.networks}),jsxRuntime.jsx(Dl,{onPress:()=>ye("card"),title:yi.depositWithCard.title,subtitle:yi.depositWithCard.subtitle,paymentNetworks:$?.payment_networks?.networks}),w&&jsxRuntime.jsx(Al,{onPress:()=>ye("cashapp")}),x&&k&&jsxRuntime.jsx(Bl,{onPress:()=>ye("stripe"),title:yi.stripeLinkPay.title,subtitle:yi.stripeLinkPay.subtitle}),!m&&jsxRuntime.jsx(Ol,{onPress:()=>ye("tracker"),title:yi.depositTracker.title,subtitle:yi.depositTracker.subtitle,badge:_e>0?_e:void 0})]})]}),ne==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:yi.transferCrypto.title,showBack:false,onClose:Ht,showBalance:Ve,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:$?.project_name}),Ze&&jsxRuntime.jsx(reactNative.View,{style:[Kr.centeredContainer,Kr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:q.primary})}),!Ze&&Ie&&jsxRuntime.jsxs(reactNative.View,{style:[Kr.centeredContainer,Kr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Kr.iconContainer,{backgroundColor:q.cardHover}],children:jsxRuntime.jsx(Ja,{size:32,color:q.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedTitle,{color:q.foreground,fontFamily:Ke.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Kr.blockedDescription,{color:q.foreground,opacity:.7,fontFamily:Ke.regular}],children:"There are no supported tokens available from your current location."})]}),!Ze&&!Ie&&jsxRuntime.jsx(Tt,{style:Kr.transferScrollContainer,contentContainerStyle:f==="compact"?Kr.scrollContentCompact:Kr.scrollContent,showsVerticalScrollIndicator:false,children:f==="compact"?jsxRuntime.jsx(Fd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:C,onExecutionsChange:dt,onDepositSuccess:L,onDepositError:V,onLatestExecution:Qe,onShowStatusSheet:G,onSelectedTokenIconUrl:Je,onShowInfoSheet:ze,onInfoSheetData:rt,borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:I?.tokenSelector,chainSelector:I?.chainSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}}):f==="single_input"?jsxRuntime.jsx(Np,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:C,onExecutionsChange:dt,onDepositSuccess:L,onDepositError:V,onLatestExecution:Qe,onShowStatusSheet:G,onSelectedTokenIconUrl:Je,borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:I?.tokenSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}}):jsxRuntime.jsx(md,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:T,depositConfirmationMode:C,onExecutionsChange:dt,onDepositSuccess:L,onDepositError:V,onLatestExecution:Qe,onShowStatusSheet:G,onSelectedTokenIconUrl:Je,borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:I?.tokenSelector,chainSelector:I?.chainSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}})})]}),ne==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:`Deposit ${s||"USDC"}`,showBack:Q==="onramp",onBack:()=>Y("amount"),onClose:Ht,showBalance:Ve,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:$?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Kr.buyWithCardContainer,children:jsxRuntime.jsx(Cd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,onDepositSuccess:L,onDepositError:V,onExecutionsChange:dt,onLatestExecution:Qe,onShowStatusSheet:G,onSelectedTokenIconUrl:Je,view:Q,onViewChange:ve=>Y(ve),borderTopLeftRadius:E,borderTopRightRadius:U,sheetBorderRadius:{providerModal:I?.providerModal,webView:I?.webView,currencyModal:I?.currencyModal}})})]}),ne==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:Kr.cashAppContainer,children:jsxRuntime.jsx(sd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,onBack:Ht,onClose:Ht,onDepositSuccess:L})}),ne==="stripe"&&be&&jsxRuntime.jsx(reactNative.View,{style:Kr.stripeLinkPayContainer,children:be}),ne==="tracker"&&jsxRuntime.jsx(Ep,{active:ne==="tracker",onClose:Ht,executions:ie,externalUserId:r,publishableKey:o})]})}function Ad({theme:e="auto",...t}){return jsxRuntime.jsx(tS,{...t})}var Kr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Wd(e,t=true){return ti({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>mc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function qp(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return ti({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await qn(s),u=null,p=null,g=null,T=null,h,m,w,x=l.data.some(k=>k.chains.some(_=>{let v=_.chain_type===t&&_.chain_id===r&&_.token_address.toLowerCase()===o.toLowerCase();return v&&(u=_.minimum_deposit_amount_usd,p=_.estimated_processing_time,g=_.max_slippage_percent,T=_.estimated_price_impact_percent,w=_.chain_name,m=k),v}));if(m){let k=xe(m,"png");k&&(h=re(k));}return {isSupported:x,minimumAmountUsd:u,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:T,errorMessage:x?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:h,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Kp(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return ti({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await fc(t,r,o,n,s);if(l.balance){let u=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,T=BigInt(g),h=BigInt(10**u),m=T/h,x=(T%h).toString().padStart(u,"0").replace(/0+$/,""),k=x?`${m}.${x}`:m.toString();return {balanceBaseUnit:g,balanceHuman:k,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:u,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var oS=2500,nS=3e3,iS=6e4;function Qp({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=qi.useState([]),[l,u]=qi.useState(false),p=qi.useRef(new Date),g=qi.useRef(new Map),T=qi.useRef(false),h=qi.useRef(n),m=qi.useRef(s);return qi.useEffect(()=>{h.current=n;},[n]),qi.useEffect(()=>{m.current=s;},[s]),qi.useEffect(()=>{o&&!T.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),T.current=o;},[o]),qi.useEffect(()=>{if(!e||!o)return;let w=p.current,x=async()=>{try{let _=await Xo(e,t,"withdraw"),v=new Date(w.getTime()-iS),S=[..._.data].sort((C,f)=>{let D=C.created_at?new Date(C.created_at).getTime():0;return (f.created_at?new Date(f.created_at).getTime():0)-D}),R=["pending","waiting","delayed"],d=["succeeded","failed"],c=null;for(let C of S){let f=C.created_at?new Date(C.created_at):null;if(!f||f<v)continue;let D=g.current.get(C.id);if(!D){c=C;break}if(R.includes(D)&&d.includes(C.status)){c=C;break}}if(c){let C=c,f=C.created_at?new Date(C.created_at):null;if(!f||f<p.current)return;let D=g.current.get(C.id);g.current.set(C.id,C.status),a(L=>{let V=L.findIndex(I=>I.id===C.id);if(V>=0){let I=[...L];return I[V]=C,I}return [...L,C]}),C.status==="succeeded"&&(!D||R.includes(D))?h.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&D!=="failed"&&m.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(_){console.error("Failed to fetch withdraw executions:",_),m.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:_});}};x();let k=setInterval(x,oS);return u(true),()=>{clearInterval(k),u(false);}},[e,t,o]),qi.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await mu({deposit_wallet_id:r},t);}catch{}};w();let x=setInterval(w,nS);return ()=>clearInterval(x)},[o,r,t]),{executions:i,isPolling:l}}var Yp=(e,t)=>`${t}:${e}`;function ql({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:u,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:T,fonts:h,components:m}=A(),[w,x]=qi.useState(false),[k,_]=qi.useState(false),v=m.card,S=t?e.find(C=>C.symbol===t):void 0,R=S?.chains||[],d=r?R.find(C=>Yp(C.chain_id,C.chain_type)===r):void 0,c={backgroundColor:v.backgroundColor,borderRadius:v.borderRadius,borderWidth:v.borderWidth||1,borderColor:v.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Pt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.label,{color:v.labelColor,fontFamily:h.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.selectButton,c],onPress:()=>!s&&e.length>0&&x(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[Pt.placeholder,{color:v.subtitleColor,fontFamily:h.regular}],children:"Loading..."}):S?jsxRuntime.jsxs(reactNative.View,{style:Pt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(S,"png"))},style:Pt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.selectedText,{color:v.titleColor,fontFamily:h.medium}],numberOfLines:1,children:S.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Pt.placeholder,{color:v.subtitleColor,fontFamily:h.regular}],children:"Select receive token"}),jsxRuntime.jsx(Jt,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Pt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.label,{color:v.labelColor,fontFamily:h.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.selectButton,c,(!S||R.length===0)&&Pt.disabled],onPress:()=>!s&&S&&R.length>0&&_(true),activeOpacity:.7,disabled:s||!S||R.length===0,children:[d?jsxRuntime.jsxs(reactNative.View,{style:Pt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(d,"png"))},style:Pt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.selectedText,{color:v.titleColor,fontFamily:h.medium}],numberOfLines:1,children:d.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Pt.placeholder,{color:v.subtitleColor,fontFamily:h.regular}],children:"Chain"}),jsxRuntime.jsx(Jt,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(_t,{visible:w,onClose:()=>x(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:u,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Pt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerTitle,{color:T.foreground,fontFamily:h.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Pt.pickerHeaderClose,onPress:()=>x(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Js,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Pt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.pickerItem,{backgroundColor:C.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(C.symbol),x(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(C,"png"))},style:Pt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerItemText,{color:T.foreground,fontFamily:h.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerItemSub,{color:T.foregroundMuted,fontFamily:h.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(lt,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(_t,{visible:k,onClose:()=>_(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Pt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerTitle,{color:T.foreground,fontFamily:h.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Pt.pickerHeaderClose,onPress:()=>_(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Js,{data:R,keyExtractor:C=>Yp(C.chain_id,C.chain_type),contentContainerStyle:Pt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let f=Yp(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Pt.pickerItem,{backgroundColor:f===r?T.cardHover:"transparent"}],onPress:()=>{n(f),_(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re(xe(C,"png"))},style:Pt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.pickerItemText,{color:T.foreground,fontFamily:h.medium}],children:C.chain_name}),f===r&&jsxRuntime.jsx(lt,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Pt=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 Gp(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return ti({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>pu({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function cS(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function dS(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function uS(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Md({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:u,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:T,estimatedProcessingTime:h,maxSlippagePercent:m,priceImpactPercent:w,canWithdraw:x,onDepositWalletCreation:k,onWithdraw:_,onWithdrawError:v,onWithdrawSubmitted:S,onViewTracker:R}){let d="https://unifold.io/terms",c="https://unifold.io/support",{colors:C,fonts:f,components:D}=A(),[L,V]=qi.useState(a||""),[I,E]=qi.useState(""),[U,q]=qi.useState(false),[Ke,ie]=qi.useState(null),[Ge,$]=qi.useState(false),[le,Q]=qi.useState(""),Y=qi.useRef(null);qi.useEffect(()=>{V(a||""),E(""),ie(null);},[a]);let we=L.trim();qi.useEffect(()=>{let be=setTimeout(()=>Q(we),500);return ()=>clearTimeout(be)},[we]);let{data:G,isLoading:se,error:Qe}=Gp({chainType:u?.chain_type,chainId:u?.chain_id,tokenAddress:u?.token_address,recipientAddress:le,publishableKey:e,enabled:le.length>5&&!!u}),Be=we!==le,Je=qi.useMemo(()=>!we||we.length<=5||Be||se?null:Qe?"Invalid address":G&&!G.valid?G.failure_code==="account_not_found"?`Account not found on ${u?.chain_name}`:G.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${u?.chain_name}`:"Invalid address":null,[we,Be,se,Qe,G,u,l]),Ye=!Be&&!!G?.valid&&!Je,ze=qi.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),Me=qi.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),rt=n||p?.symbol||"TOKEN",De=p?.decimals??6,Ae=qi.useMemo(()=>{let be=parseFloat(I);return !be||be<=0?0:be},[I]),ne=qi.useMemo(()=>{let be=parseFloat(I);return !be||be<=0?0:be*ze},[I,ze]),ye=qi.useCallback(async()=>{try{let Oe=await Pg("expo-clipboard").getStringAsync();Oe&&(V(Oe.trim()),ie(null));}catch{}},[]),ke=qi.useCallback(()=>{Me<=0||E(p?.balanceHuman??"0");},[Me,p]),Ze=T!==null&&ne>0&&ne<T,He=Ae>0&&Me>0&&Ae>Me,dt=we.length>0&&I.trim().length>0&&Ae>0&&Ye&&!Ze&&!He&&!!p,Ht=qi.useCallback(async()=>{if(!(!l||!u||!dt||!x)){q(true),ie(null);try{let be=await k({destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,recipientAddress:we}),Oe=dS(Ae,De),zt=uS(Ae,De),Ut={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:rt,sourceTokenIconUrl:i,destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,destinationTokenSymbol:l.symbol,destinationChainName:u.chain_name,destinationTokenIconUrl:l?re(xe(l,"png")):void 0,amount:zt,amountBaseUnit:Oe,submittedAt:new Date,withdrawIntentAddress:be.address,recipientAddress:we};await _(Ut),S(Ut);}catch(be){let Oe=be instanceof Error?be.message:"Withdrawal failed. Please try again.",zt=Oe.length>120?"Withdrawal failed. Please try again.":Oe;ie(zt),v?.({message:Oe,error:be,code:"WITHDRAW_FAILED"});}finally{q(false);}}},[l,u,dt,x,we,t,r,o,rt,i,I,Me,p,Ae,De,ne,k,_,v,S]),_e=D.input,Re=D.card,Ve=D.button,at=Je?C.error:_e.borderColor,Ie=qi.useMemo(()=>U?"Processing...":He?"Insufficient balance":Ze?`Minimum $${T?.toFixed(2)}`:Ke?"Withdrawal failed \u2014 try again":"Withdraw",[U,He,Ze,T,Ke]);return jsxRuntime.jsxs(reactNative.View,{style:Rt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Rt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Rt.label,{color:Re.labelColor,fontFamily:f.medium}],children:"Recipient address"}),(Be||se)&&we.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:ye,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(lm,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Rt.inputRow,{backgroundColor:_e.backgroundColor,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth,borderColor:at}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Rt.textInput,{color:_e.textColor,fontFamily:f.regular}],placeholder:"Enter wallet address",placeholderTextColor:_e.placeholderColor,value:L,onChangeText:be=>{V(be),ie(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Y.current?.focus()})}),Je?jsxRuntime.jsx(reactNative.Text,{style:[Rt.errorText,{color:C.error,fontFamily:f.regular}],children:Je}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Rt.label,{color:Re.labelColor,fontFamily:f.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:f.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Rt.amountRow,{backgroundColor:_e.backgroundColor,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth,borderColor:_e.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:[Rt.amountInput,{color:_e.textColor,fontFamily:f.regular}],placeholder:"0.00",placeholderTextColor:_e.placeholderColor,value:I,onChangeText:be=>{(be===""||/^\d*\.?\d*$/.test(be))&&(E(be),ie(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.unitLabel,{color:C.foregroundMuted,fontFamily:f.medium}],children:rt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Rt.maxButton,{backgroundColor:`${C.primary}20`}],onPress:ke,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Rt.maxText,{color:C.primary,fontFamily:f.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Rt.detailsCard,{marginTop:24,backgroundColor:Re.backgroundColor,borderRadius:Re.borderRadius,borderWidth:Re.borderWidth||1,borderColor:Re.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Rt.detailsToggle,onPress:()=>$(!Ge),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Rt.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Rt.detailsLabel,{color:Re.titleColor,fontFamily:f.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:f.medium},children:cS(h)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:Ge?"180deg":"0deg"}]},children:jsxRuntime.jsx(Jt,{size:16,color:Re.actionColor,strokeWidth:2})})]})}),Ge&&jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Rt.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(uo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Rt.detailsLabel,{color:Re.titleColor,fontFamily:f.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:f.medium},children:["Auto \u2022 ",(m??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Rt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Rt.detailIcon,{backgroundColor:Re.iconBackgroundColor,borderRadius:Re.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:Re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Rt.detailsLabel,{color:Re.titleColor,fontFamily:f.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:f.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Ke&&jsxRuntime.jsx(reactNative.Text,{style:[Rt.errorText,{color:C.error,fontFamily:f.regular,textAlign:"center"}],children:Ke}),jsxRuntime.jsxs(reactNative.View,{style:Rt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Rt.withdrawButton,{backgroundColor:Ve.primaryBackground,borderRadius:Ve.borderRadius,borderWidth:Ve.borderWidth,borderColor:Ve.borderColor,opacity:!dt||!x||U?.5:1}],onPress:Ht,disabled:!dt||!x||U,activeOpacity:.8,children:[U&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Ve.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.withdrawButtonText,{color:Ve.primaryText,fontFamily:f.medium}],children:Ie})]}),jsxRuntime.jsxs(reactNative.View,{style:Rt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Rt.historyLink,onPress:R,activeOpacity:.7,children:[jsxRuntime.jsx(oo,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.historyText,{color:C.foregroundMuted,fontFamily:f.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Rt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(d),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Rt.legalText,{color:C.foregroundMuted,fontFamily:f.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Rt.legalSeparator,{color:C.foregroundMuted,fontFamily:f.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(c),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Rt.legalText,{color:C.foregroundMuted,fontFamily:f.regular}],children:"Help"})})]})]})]})]})}var Rt=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 fS(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 hS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Hd({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,u=re(xe(e.destination_token_metadata,"png")||$t("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=fS(e.created_at||new Date().toISOString()),T=hS(e.source_amount_usd);return jsxRuntime.jsxs(xr,{cardTokens:s,onPress:t,contentStyle:Ci.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ci.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:Ci.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ci.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(Ys,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(lt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Ci.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(Ur,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Ci=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function Xp(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let u=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${u} ${l}`}catch{return e}}function wg(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 yS(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 Sg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Tg(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Kl({label:e,value:t,isLast:r}){let{fonts:o,components:n}=A(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ft.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[ft.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[ft.divider,{backgroundColor:s.borderColor}]})]})}function tm({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=A(),[u,p]=qi.useState([]),[g,T]=qi.useState(!!n),h=l.card,m=l.button,w=l.header,x=l.container;qi.useEffect(()=>{uu().then(q=>p(q.data)).catch(()=>{});},[]),qi.useEffect(()=>{T(!!n);},[e?.id]);let k=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,_=e?e.status==="failed"||e.status==="refunded":false,v=_?i.error:k?i.warning:i.success,S=_?"Failed":k?"Processing":"Completed",R=e?.destination_token_metadata?re(xe(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?re(t.destinationTokenIconUrl):re($t("/icons/tokens/png/usdc.png")),d=e?.created_at?Xp(e.created_at):t.submittedAt?Xp(t.submittedAt.toISOString()):Xp(new Date().toISOString()),c=e?`${wg(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Sg(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${wg(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Sg(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,f=e?yS(e.source_amount_usd,e.source_amount_base_unit):"$0.00",D=e?pc(u,e.source_chain_type,e.source_chain_id):t.sourceChainId,L=e?pc(u,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,I=e?.explorer_url,E=e?.destination_transaction_hashes?.[0],U=e?.destination_explorer_url;return jsxRuntime.jsxs(Tt,{style:ft.scroll,contentContainerStyle:ft.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ft.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ks,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ft.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ft.headerTitle,{color:w.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:ft.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ht,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ft.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:R},style:ft.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ft.statusBadge,{backgroundColor:v}],children:_?jsxRuntime.jsx(Ya,{size:10,color:"#FFFFFF",strokeWidth:3}):k?jsxRuntime.jsx(reactNative.View,{style:ft.spinnerDot}):jsxRuntime.jsx(lt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ft.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ft.statusDot,{backgroundColor:v}]}),jsxRuntime.jsx(reactNative.Text,{style:[ft.statusText,{color:v,fontFamily:a.medium}],children:S})]}),jsxRuntime.jsx(reactNative.Text,{style:[ft.dateText,{color:x.subtitleColor,fontFamily:a.regular}],children:d}),jsxRuntime.jsxs(reactNative.View,{style:[ft.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:[jsxRuntime.jsx(Kl,{label:"Amount Sent",value:c}),jsxRuntime.jsx(Kl,{label:"Amount Received",value:C}),jsxRuntime.jsx(Kl,{label:"USD Value",value:f}),jsxRuntime.jsx(Kl,{label:"Source Network",value:D}),jsxRuntime.jsx(Kl,{label:"Destination Network",value:L,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ft.moreDetailsRow,onPress:()=>T(q=>!q),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.moreDetailsText,{color:x.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(fn,{size:16,color:x.actionColor,strokeWidth:2}):jsxRuntime.jsx(Jt,{size:16,color:x.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[ft.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:V&&I?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ft.txRow,onPress:()=>reactNative.Linking.openURL(I),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.txLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ft.txHash,{color:h.titleColor,fontFamily:a.regular}],children:Tg(V)}),jsxRuntime.jsx(mn,{size:14,color:h.actionColor,strokeWidth:2})]}),!k&&E&&U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[ft.divider,{backgroundColor:h.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ft.txRow,onPress:()=>reactNative.Linking.openURL(U),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.txLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ft.txHash,{color:h.titleColor,fontFamily:a.regular}],children:Tg(E)}),jsxRuntime.jsx(mn,{size:14,color:h.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:ft.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.detailLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:ft.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ft.button,ft.halfButton,{backgroundColor:m.secondaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.buttonText,{color:m.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ft.button,ft.halfButton,{backgroundColor:m.primaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.buttonText,{color:m.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var ft=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 kg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Nd({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=A(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",u=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:tr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tr.closeButton,onPress:r,children:jsxRuntime.jsx(ht,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[tr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(lt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[tr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[tr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",kg(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:tr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tr.button,tr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[tr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tr.button,tr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[tr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):u?jsxRuntime.jsxs(reactNative.View,{style:tr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tr.closeButton,onPress:r,children:jsxRuntime.jsx(ht,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[tr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(ht,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[tr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[tr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tr.button,tr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[tr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:tr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tr.closeButton,onPress:r,children:jsxRuntime.jsx(ht,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(St,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:re(e.sourceTokenIconUrl)},style:tr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[tr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[tr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[tr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",kg(e.recipientAddress)]})]})}var tr=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 kS(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:re(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:re(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 xg=(e,t)=>`${t}:${e}`;function xS(){let{colors:e}=A(),t=qi.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return qi.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function qd({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:u="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:T,heightPercent:h=.94,sheetBorderRadius:m,sourceChainType:w,sourceChainId:x,sourceTokenAddress:k,sourceTokenSymbol:_,sourceChainName:v,sourceTokenIconUrl:S}){let{colors:R,fonts:d}=A(),[c,C]=qi.useState("form"),[f,D]=qi.useState(w),[L,V]=qi.useState(x),[I,E]=qi.useState(k),[U,q]=qi.useState(_),[Ke,ie]=qi.useState(v),[Ge,$]=qi.useState(S),[le,Q]=qi.useState(null),[Y,we]=qi.useState(null),[G,se]=qi.useState(null),[Qe,Be]=qi.useState(),[Je,Ye]=qi.useState([]),[ze,Me]=qi.useState(null),[rt,De]=qi.useState("form"),Ae=qi.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,ne=qi.useRef(null),ye=!!f&&!!L&&!!I,{data:ke,isLoading:Ze}=Wd(r,e&&c==="form"),He=ke?.data??[],{data:dt,isLoading:Ht}=qp({sourceChainType:f,sourceChainId:L,sourceTokenAddress:I,sourceTokenSymbol:U,publishableKey:r,enabled:e&&ye&&c==="form"}),{data:_e,isLoading:Re}=Kp({address:n,chainType:f,chainId:L,tokenAddress:I,publishableKey:r,enabled:e&&ye}),{executions:Ve}=Qp({userId:o,publishableKey:r,depositWalletId:Qe,enabled:!!Qe&&e,onWithdrawSuccess:g,onWithdrawError:T});qi.useEffect(()=>{if(!e||c!=="tracker")return;let O=false;return Xo(o,r,"withdraw").then(J=>{O||Ye(J.data);}).catch(console.error),()=>{O=true;}},[e,c,o,r]),qi.useEffect(()=>{e&&(ne.current&&(clearTimeout(ne.current),ne.current=null),C("form"),D(w),V(x),E(k),q(_),ie(v),$(S),Q(null),we(null),se(null),Be(void 0),Ye([]),Me(null),De("form"),Ae.setValue(reactNative.Dimensions.get("window").width));},[e]),qi.useEffect(()=>()=>{ne.current&&clearTimeout(ne.current);},[]),qi.useEffect(()=>{Ge||dt?.iconUrl&&$(dt.iconUrl);},[dt?.iconUrl,Ge]),qi.useEffect(()=>{Ke||dt?.chainName&&ie(dt.chainName);},[dt?.chainName,Ke]),qi.useEffect(()=>{if(!He.length||le)return;let O,J;if(i&&a)if(l)for(let M of He){let $e=M.chains.find(Ue=>Ue.chain_type===i&&Ue.chain_id===a&&Ue.token_address.toLowerCase()===l.toLowerCase());if($e){O=M,J=$e;break}}else for(let M of He){let $e=M.chains.find(Ue=>Ue.chain_type===i&&Ue.chain_id===a);if($e){O=M,J=$e;break}}O||(O=He[0]),O&&(Q(O),we(J??O.chains[0]??null));},[He,le,i,a,l]),qi.useEffect(()=>{c==="confirming"&&Ve.length>0&&C("details");},[c,Ve]);let at=qi.useCallback(()=>{t(),ne.current=setTimeout(()=>{C("form"),D(w),V(x),E(k),q(_),ie(v),$(S),Q(null),we(null),se(null),Be(void 0),Ye([]),Me(null),De("form"),ne.current=null;},300);},[t,w,x,k,_,v,S]),Ie=qi.useCallback(O=>{let J=He.find(M=>M.symbol===O);J&&(Q(J),J.chains.length>0&&we(J.chains[0]));},[He]),be=qi.useCallback(O=>{if(!le)return;let J=le.chains.find(M=>xg(M.chain_id,M.chain_type)===O);J&&we(J);},[le]),Oe=qi.useCallback(async O=>{let J=await Zo({external_user_id:o,destination_chain_type:O.destinationChainType,destination_chain_id:O.destinationChainId,destination_token_address:O.destinationTokenAddress,recipient_address:O.recipientAddress,action_type:"withdraw"},r),M=Eo(J.data,f??"");if(!M)throw new Error(`No deposit wallet found for chain type: ${f}`);return Be(M.id),{id:M.id,address:M.address}},[o,r,f]),zt=qi.useCallback(O=>{se(O),C("confirming");},[]),Ut=qi.useCallback(O=>{Me(O),Ae.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ae,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ae]),wt=qi.useCallback(()=>{reactNative.Animated.timing(Ae,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Me(null));},[Ae]),yt=Ze||Ht,rr=dt?.isSupported??null,We=c==="confirming"?"Withdrawal Status":u,ve=m?.globalBorderTopLeftRadius,Ne=m?.globalBorderTopRightRadius,ge=m?.main?.borderTopLeftRadius??ve,Pe=m?.main?.borderTopRightRadius??Ne,H=m?.tokenSelector?.borderTopLeftRadius??ve,ue=m?.tokenSelector?.borderTopRightRadius??Ne,P=m?.chainSelector?.borderTopLeftRadius??ve,b=m?.chainSelector?.borderTopRightRadius??Ne,B=(()=>{if(c!=="form"||!ye||Re||!_e)return;let O=U||_e.symbol,J=_e.balanceUsd;if(J!=null){let Ue=`$${parseFloat(J).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return O?`Balance: ${Ue} ${O}`:`Balance: ${Ue}`}let M=_e.balanceHuman;if(!(!M||M==="0"))return O?`Balance: ${M} ${O}`:`Balance: ${M}`})();return jsxRuntime.jsx(_t,{visible:e,onClose:at,closeOnBackdropPress:false,enablePanDownToClose:c==="tracker"||c==="form",showHandle:c==="tracker"||c==="form",heightPercent:c==="confirming"?.3:c==="details"?.7:c==="tracker"?.9:h,borderTopLeftRadius:ge,borderTopRightRadius:Pe,children:c==="confirming"&&G?jsxRuntime.jsx(Nd,{txInfo:G,executions:Ve,onClose:at,onViewTracker:()=>{De("confirming"),C("tracker");}}):c==="details"&&G?jsxRuntime.jsx(tm,{execution:Ve.length>0?Ve[Ve.length-1]:null,txInfo:G,onClose:at,onViewHistory:()=>{De("details"),C("tracker");},onHeaderClose:()=>C("form")}):c==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:zn.trackerContainer,children:[jsxRuntime.jsx(eo,{title:"Withdrawal History",onClose:()=>C(rt)}),Je.length===0?jsxRuntime.jsx(reactNative.View,{style:zn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[zn.emptyText,{color:R.foregroundMuted,fontFamily:d.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Js,{data:Je,keyExtractor:O=>O.id,contentContainerStyle:zn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:O})=>jsxRuntime.jsx(Hd,{execution:O,onPress:()=>Ut(O)})}),ze&&jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.historyDetailOverlay,{backgroundColor:R.background,transform:[{translateX:Ae}]}],children:jsxRuntime.jsx(tm,{execution:ze,txInfo:kS(ze),onClose:at,onBack:wt,onViewHistory:wt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eo,{title:We,subtitle:B,onClose:at}),yt?jsxRuntime.jsx(xS,{}):rr===false?jsxRuntime.jsxs(reactNative.View,{style:zn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[zn.unsupportedTitle,{color:R.foreground,fontFamily:d.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[zn.unsupportedMessage,{color:R.foregroundMuted,fontFamily:d.regular}],children:dt?.errorMessage})]}):jsxRuntime.jsx(RS,{publishableKey:r,sourceChainType:f??"",sourceChainId:L??"",sourceTokenAddress:I??"",sourceTokenSymbol:U,sourceChainName:Ke,sourceTokenIconUrl:Ge,recipientAddressProp:s,destinationTokens:He,selectedToken:le,selectedChain:Y,selectedChainKey:Y?xg(Y.chain_id,Y.chain_type):null,onTokenChange:Ie,onChainChange:be,tokensLoading:Ze,balanceData:_e??null,isLoadingBalance:Re,sourceValidation:dt??null,onDepositWalletCreation:Oe,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:zt,onViewTracker:()=>{De("form"),C("tracker");},tokenSelectorLeft:H,tokenSelectorRight:ue,chainSelectorLeft:P,chainSelectorRight:b})]})})}function RS({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:u,selectedChain:p,selectedChainKey:g,onTokenChange:T,onChainChange:h,tokensLoading:m,balanceData:w,isLoadingBalance:x,sourceValidation:k,onDepositWalletCreation:_,onWithdraw:v,onWithdrawError:S,onWithdrawSubmitted:R,onViewTracker:d,tokenSelectorLeft:c,tokenSelectorRight:C,chainSelectorLeft:f,chainSelectorRight:D}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Tt,{style:{flex:1,paddingTop:16},contentContainerStyle:zn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:zn.doubleInputWrapper,children:jsxRuntime.jsx(ql,{tokens:l,selectedTokenSymbol:u?.symbol??null,selectedChainKey:g,onTokenChange:T,onChainChange:h,isLoading:m,tokenPickerBorderTopLeftRadius:c,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:f,chainPickerBorderTopRightRadius:D})}),jsxRuntime.jsx(Md,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:u,selectedChain:p,balanceData:w,isLoadingBalance:x,minimumWithdrawAmountUsd:k?.minimumAmountUsd??null,estimatedProcessingTime:k?.estimatedProcessingTime??null,maxSlippagePercent:k?.maxSlippagePercent??null,priceImpactPercent:k?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:_,onWithdraw:v,onWithdrawError:S,onWithdrawSubmitted:R,onViewTracker:d})]})})}var zn=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 Ig=qi.createContext(null);function BS({children:e,publishableKey:t,config:r}){let[o]=qi.useState(()=>new lp({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=qi.useState(false),[i,a]=qi.useState(null),[l,u]=qi.useState(false),[p,g]=qi.useState(null),T=reactNative.useColorScheme(),h=qi.useRef(false);h.current||(lc({publishableKey:t}),h.current=true);let m=qi.useMemo(()=>{let I=r?.appearance||"dark";return I==="auto"?T==="dark"?"dark":"light":I},[r?.appearance,T]);qi.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),lc({publishableKey:t});},[t]),qi.useEffect(()=>()=>{x.current&&clearTimeout(x.current),d.current&&clearTimeout(d.current);},[]);let w=qi.useRef(null),x=qi.useRef(null),k=qi.useCallback(I=>{x.current&&(clearTimeout(x.current),x.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let E=new Promise((U,q)=>{w.current={resolve:U,reject:q};});return a(I),s(true),E},[]),_=qi.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),s(false),x.current=setTimeout(()=>{a(null),x.current=null;},200);},[]),v=qi.useCallback(I=>{i?.onSuccess&&i.onSuccess(I),w.current&&(w.current.resolve(I),w.current=null);},[i]),S=qi.useCallback(I=>{console.error("[UnifoldProvider] Deposit error:",I),i?.onError&&i.onError(I),w.current&&(w.current.reject(I),w.current=null);},[i]),R=qi.useRef(null),d=qi.useRef(null),c=qi.useRef(void 0),C=qi.useCallback(I=>{d.current&&(clearTimeout(d.current),d.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 E=new Promise((U,q)=>{R.current={resolve:U,reject:q};});return c.current=I.onClose,g(I),u(true),E},[]),f=qi.useCallback(()=>{R.current&&(R.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),R.current=null),c.current?.(),c.current=void 0,u(false),d.current=setTimeout(()=>{g(null),d.current=null;},200);},[]),D=qi.useCallback(I=>{p?.onSuccess&&p.onSuccess(I),R.current&&(R.current.resolve(I),R.current=null);},[p]),L=qi.useCallback(I=>{console.error("[UnifoldProvider] Withdraw error:",I),p?.onError&&p.onError(I),R.current&&(R.current.reject(I),R.current=null);},[p]),V=qi.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:_,beginWithdraw:C,closeWithdraw:f}),[t,k,_,C,f]);return jsxRuntime.jsx(up,{client:o,children:jsxRuntime.jsx(Ig.Provider,{value:V,children:jsxRuntime.jsxs(Gs,{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Ad,{visible:n,onClose:_,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,enableCashApp:r?.enableCashApp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?kf():void 0,onDepositSuccess:v,onDepositError:S,theme:m,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(qd,{visible:l,onClose:f,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:D,onWithdrawError:L,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function AS(){let e=qi.useContext(Ig);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
5
5
|
exports.AmountScreen=vc;exports.BottomSheet=_t;exports.KYCWizardScreen=Pc;exports.OnrampScreen=Mc;exports.StripeOnramp=zc;exports.StripeOnrampPreconfigure=Sf;exports.UnifoldProvider=BS;exports.getPreferredIcon=xe;exports.getStripePublishableKey=kc;exports.getSupportedDestinationTokens=mc;exports.normalizeIconUrl=re;exports.registerStripeOnramp=Uc;exports.setDevApiUrl=gm;exports.setStripeOnrampApiUrl=Tc;exports.setStripeOnrampPublishableKey=Sc;exports.useAllowedCountry=Hl;exports.useStripeOnramp=Fc;exports.useTheme=A;exports.useUnifold=AS;
|