@unifold/connect-react-native 0.1.31 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var on=require('react'),reactNative=require('react-native'),St=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),stripeReactNative=require('@stripe/stripe-react-native'),df=require('expo-constants'),reactNativeGestureHandler=require('react-native-gesture-handler'),Xf=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview'),Wc=require('@react-native-async-storage/async-storage');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 on__namespace=/*#__PURE__*/_interopNamespace(on);var St__default=/*#__PURE__*/_interopDefault(St);var df__default=/*#__PURE__*/_interopDefault(df);var Xf__default=/*#__PURE__*/_interopDefault(Xf);var Wc__default=/*#__PURE__*/_interopDefault(Wc);var Jc=e=>{throw TypeError(e)};var Gp=(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 hl=(e,t,r)=>t.has(e)||Jc("Cannot "+r);var u=(e,t,r)=>(hl(e,t,"read from private field"),r?r.call(e):t.get(e)),Q=(e,t,r)=>t.has(e)?Jc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),D=(e,t,r,o)=>(hl(e,t,"write to private field"),t.set(e,r),r),be=(e,t,r)=>(hl(e,t,"access private method"),r);var qi=(e,t,r,o)=>({set _(n){D(e,t,n);},get _(){return u(e,t,o)}});var gl={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)"}},yl=gl;function Ms(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Qi(e,t,r){let o=r?t?.[r]:void 0,n=(c,g,w)=>{let f=o?.[c]?.[g];if(f!==void 0)return f;let y=t?.[c]?.[g];return y!==void 0?y:w},i={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,d=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:i,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Ms(i,s)},transferCrypto:{depositAddress:{card:Ms(i,a)}},depositCard:{quoteProvider:{card:Ms(i,l)}},depositTracker:{executionRow:{card:Ms(i,d)}}}}function bl(e,t,r){let n={...gl[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Cl=on.createContext(null);function O(){let e=on.useContext(Cl);if(!e){let t=yl.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Qi(t,void 0,"dark"),isDark:true}}return e}function Tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(St.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Sl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ki({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Br({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(St.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(St.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function yt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(St.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Cn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.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 Ae({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(St.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $r({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.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(St.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ho({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.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 zs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.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(St.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(St.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Us({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.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 ri({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function No({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.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(St.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Hs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.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(St.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 Ns({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.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(St.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(St.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(St.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ed({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(St.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(St.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(St.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(St.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rd({size:e=28}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(St.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(St.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(St.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 nd({size:e=28}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(St.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(St.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(St.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(St.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(St.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(St.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(St.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(St.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(St.Defs,{children:jsxRuntime.jsx(St.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(St.Rect,{width:28,height:28,fill:"white"})})})]})}function ad({size:e=28}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(St.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(St.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(St.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(St.Defs,{children:jsxRuntime.jsx(St.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(St.Rect,{width:28,height:28,fill:"white"})})})]})}function ld({size:e=28}){return jsxRuntime.jsxs(St__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(St.Defs,{children:[jsxRuntime.jsxs(St.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(St.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(St.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(St.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(St.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(St.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(St.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(St.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(St.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(St.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(St.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(St.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(St.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(St.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 cd({size:e=28}){return jsxRuntime.jsx(St__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(St.G,{children:[jsxRuntime.jsx(St.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(St.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 ii=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:rd},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:nd},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:ad},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ld},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:cd}];function dd(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function js(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 $s(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=ii.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=ii.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function It({onPress:e,title:t}){let{components:r,fonts:o}=O(),n=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:si.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(tt,{size:20,color:r.header.buttonColor,strokeWidth:2})});return t?jsxRuntime.jsxs(reactNative.View,{style:si.headerWithTitle,children:[jsxRuntime.jsx(reactNative.View,{style:si.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[si.headerTitleText,{color:r.header.titleColor},...o.bold?[{fontFamily:o.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),n]}):jsxRuntime.jsxs(reactNative.View,{style:si.header,children:[jsxRuntime.jsx(reactNative.View,{style:si.headerSpacer}),n]})}var qs={paddingTop:60,paddingBottom:16},si=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...qs},headerWithTitle:{flexDirection:"row",alignItems:"center",...qs},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Kt({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[ud.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[ud.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var ud=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function jo({quote:e,label:t,value:r,mono:o,last:n}){return jsxRuntime.jsxs(on.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,o&&e.rowMono],children:r})]}),n?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function Il({quote:e,label:t,address:r,last:o}){let[n,i]=on.useState(false),{colors:s,components:a}=O(),l=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},d=dd(r);return jsxRuntime.jsxs(on.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,e.rowMono,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:d}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:l,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:n?jsxRuntime.jsx(Ae,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(Cn,{size:14,color:a.card.actionIcon,strokeWidth:2})})]})]}),o?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function ai(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return on.useMemo(()=>{let l=s.borderRadius,d=reactNative.Platform.OS==="ios"?"Menlo":"monospace",c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:48},content:{flex:1,paddingTop:16},title:{fontSize:28,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:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},g={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}:{}},numpad:{gap:4,marginBottom:24},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:68,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}:{}}},w={heroBox:{backgroundColor:s.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:l,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}},rowMono:{fontFamily:d,fontSize:13}},f=Math.max(16,Math.min(l,22)),y={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:f,borderTopRightRadius:f,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:f,borderBottomRightRadius:f,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},b={input:{fontSize:14,fontFamily:d},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},m={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:w,pm:y,wallet:b,flow:m,amount:g}},[e,t,o,n,i,s,a])}var _m=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function Gs({initialAmount:e="",currency:t="USD",onConfirm:r,onCancel:o}){let n=ai(),[i,s]=on.useState(e),a=g=>{if(g==="\u232B"){s(w=>w.slice(0,-1));return}if(g==="."){if(i.includes("."))return;s(w=>w===""?"0.":w+".");return}s(w=>{let f=w.indexOf(".");return f!==-1&&w.length-f>2?w:w==="0"&&g!=="."?g:w+g});},l=i===""?"0":i,d=parseFloat(i),c=i!==""&&!isNaN(d)&&d>0;return jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsx(It,{onPress:o,title:"Enter amount"}),jsxRuntime.jsxs(reactNative.View,{style:n.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:n.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[n.amount.amountText,l==="0"&&n.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",l]}),jsxRuntime.jsx(reactNative.Text,{style:n.amount.currencyLabel,children:t.toUpperCase()})]}),jsxRuntime.jsx(reactNative.View,{style:n.amount.numpad,children:_m.map((g,w)=>jsxRuntime.jsx(reactNative.View,{style:n.amount.numpadRow,children:g.map(f=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:n.amount.numpadKey,onPress:()=>a(f),activeOpacity:.6,children:jsxRuntime.jsx(reactNative.Text,{style:f==="\u232B"?n.amount.backspaceText:n.amount.numpadKeyText,children:f})},f))},w))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!c&&n.form.continueBtnDisabled],onPress:()=>c&&r(i),disabled:!c,children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!c&&n.form.continueBtnTextDisabled],children:"Continue"})})]})]})}function it({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=O(),l=i??a.warning,d=s??"#FBBF24",c=on.useRef(new reactNative.Animated.Value(0)).current,g=on.useId(),w=on.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),f=(e-t)/2,y=2*Math.PI*f,b=e/2,m=o??Math.max(0,Math.round(e-t*2-8)),S=(e-m)/2;on.useEffect(()=>{let p=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return p.start(),()=>p.stop()},[c]);let h=c.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:h}]},children:jsxRuntime.jsxs(St__default.default,{width:e,height:e,children:[jsxRuntime.jsx(St.Defs,{children:jsxRuntime.jsxs(St.LinearGradient,{id:w,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(St.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(St.Stop,{offset:"100%",stopColor:d})]})}),jsxRuntime.jsx(St.Circle,{cx:b,cy:b,r:f,stroke:`url(#${w})`,strokeWidth:t,fill:"none",strokeDasharray:`${y*.75} ${y*.25}`,strokeLinecap:"round",rotation:-90,origin:`${b}, ${b}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:S+1.5,left:S,width:m,height:m},children:r}):null]})}var Xi=4;function Js({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=ai(),{colors:i,fonts:s,components:a}=O(),l=a.input.placeholderColor,[d,c]=on.useState(1),[g,w]=on.useState(e.firstName??""),[f,y]=on.useState(e.lastName??""),[b,m]=on.useState(e.dobMonth??""),[S,h]=on.useState(e.dobDay??""),[p,T]=on.useState(e.dobYear??""),[x,_]=on.useState(e.addressLine1??""),[F,k]=on.useState(e.addressLine2??""),[C,B]=on.useState(e.city??""),[E,L]=on.useState(e.state??""),[R,H]=on.useState(e.postalCode??""),[V,we]=on.useState(e.country??"US"),[We,Xe]=on.useState(e.idNumber??""),ee=on.useRef(null),ye=on.useRef(null),ze=on.useRef(null),Fe=on.useRef(null),Ue=on.useRef(null),ie=on.useRef(null),Ge=on.useRef(null),Ve=on.useRef(null),Ye=()=>{switch(d){case 1:return g.trim().length>0&&f.trim().length>0;case 2:return b.length===2&&S.length===2&&p.length===4;case 3:return x.trim().length>0&&C.trim().length>0&&E.trim().length>0&&R.trim().length>0;case 4:return We.trim().length>0;default:return false}},dt=()=>{Ye()&&(d<Xi?c(J=>J+1):r({firstName:g,lastName:f,idNumber:We,dobMonth:b,dobDay:S,dobYear:p,addressLine1:x,addressLine2:F,city:C,state:E,postalCode:R,country:V}));},at=()=>{d>1?c(J=>J-1):o();},ht=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],He=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],Lt=[kt.stepCounter,{color:i.foregroundMuted},...s.semibold?[{fontFamily:s.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:kt.header,children:[jsxRuntime.jsx(reactNative.View,{style:kt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kt.iconButton,onPress:at,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:d>1?"Back":"Cancel",children:jsxRuntime.jsx(Ki,{size:20,color:a.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:kt.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Lt,children:[d," of ",Xi]})}),jsxRuntime.jsx(reactNative.View,{style:kt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:kt.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(tt,{size:20,color:a.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:kt.progressTrack,children:Array.from({length:Xi}).map((J,q)=>jsxRuntime.jsx(reactNative.View,{style:[kt.progressSegment,{backgroundColor:q<d||q+1===d?i.primary:i.border}]},q))}),jsxRuntime.jsxs(reactNative.ScrollView,{style:n.form.flex,contentContainerStyle:kt.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:ht[d-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:He[d-1]}),d===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:g,onChangeText:w,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ee.current?.focus()})}),jsxRuntime.jsx(ho,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ee,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:f,onChangeText:y,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:dt})})]}),d===2&&jsxRuntime.jsxs(reactNative.View,{style:kt.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:kt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,kt.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,kt.dobInput],placeholder:"MM",placeholderTextColor:l,value:b,onChangeText:J=>{let q=J.replace(/\D/g,"").slice(0,2);m(q),q.length===2&&ye.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:kt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,kt.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ye,style:[n.form.input,kt.dobInput],placeholder:"DD",placeholderTextColor:l,value:S,onChangeText:J=>{let q=J.replace(/\D/g,"").slice(0,2);h(q),q.length===2&&ze.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:kt.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,kt.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ze,style:[n.form.input,kt.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:p,onChangeText:J=>{let q=J.replace(/\D/g,"").slice(0,4);T(q);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:dt})]})]}),d===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:x,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Fe.current?.focus()})}),jsxRuntime.jsx(ho,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Fe,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:F,onChangeText:k,returnKeyType:"next",onSubmitEditing:()=>Ue.current?.focus()})}),jsxRuntime.jsx(ho,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ue,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:C,onChangeText:B,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ie.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:kt.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx(ho,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ie,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:E,onChangeText:J=>L(J.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ge.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx(ho,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:R,onChangeText:H,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Ve.current?.focus()})})})]}),jsxRuntime.jsx(ho,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ve,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:V,onChangeText:J=>we(J.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:dt})})]}),d===4&&jsxRuntime.jsxs(ho,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:We,onChangeText:Xe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:dt}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,kt.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&d===Xi?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(it,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!Ye()&&n.form.continueBtnDisabled],onPress:dt,disabled:!Ye(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!Ye()&&n.form.continueBtnTextDisabled],children:d===Xi?"Submit":"Continue"})})})]})})}function ho({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 kt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Mm="https://api.unifold.io",Dl="__UnifoldDevApiBaseUrl__",sr="pk_test_123",Zs={};function zm(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Dl];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function Wt(){return zm()??Mm}function Xs(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),sr=e.publishableKey;}e.defaultConfig&&(Zs=e.defaultConfig);}function Cd(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[Dl]=t:delete globalThis[Dl];}function es(){return Wt()}function ea(){return sr}function kr(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 Mt(e){let t=e.startsWith("/")?e:`/${e}`;return `${Wt()}/api/public${t}`}function K(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Wt()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Wt()}${e}`:`${Wt()}/api/public${e}`:""}async function yo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Zs.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||Zs.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Zs.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||sr;kr(n);let i=await fetch(`${Wt()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function bo(e,t){return e.find(r=>r.chain_type===t)}async function Co(e,t,r){let o=t||sr;kr(o);let n=await fetch(`${Wt()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function ta(e,t){let r=t||sr;kr(r);let o=await fetch(`${Wt()}/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 ae(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 kn(e,t){let r=e||sr;kr(r);let o=`${Wt()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Fl(e,t){let r=t||sr;kr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${Wt()}/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 ra(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Vl(e,t){let r=t||sr;kr(r);let o=await fetch(`${Wt()}/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 Ll(e,t){let r=t||sr;kr(r);let o=await fetch(`${Wt()}/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 Bl(e,t){let r=t||sr;kr(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(`${Wt()}/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 Wl(e){let t=e||sr;kr(t);let r=await fetch(`${Wt()}/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 ci(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 ts(e){let t=e||sr;kr(t);let r=await fetch(`${Wt()}/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 Al(){let e=await fetch(`${Wt()}/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 oa(e,t,r){let o=e.find(i=>i.chain_id===r);if(o)return o.chain_name;let n=e.find(i=>i.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function rs(){let e=await fetch(`${Wt()}/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 na(e){let t=e||sr;kr(t);let r=await fetch(`${Wt()}/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 El(e,t){let r=t||sr;kr(r);let o=await fetch(`${Wt()}/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 Ml(e,t){return ta(e.deposit_wallet_id,t)}async function ia(e,t,r,o,n){let i=n||sr;kr(i);let s=await fetch(`${Wt()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}var wd="",Td;function sa(e){wd=e;}function aa(e){Td=e;}function Gr(){let e=wd||ea();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Yr(){return Td??es()}async function la(){let e=`${Yr()}/v1/public/onramps/headless/stripe/config`,t=Gr(),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 Sd(e){let t=await fetch(`${Yr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Gr(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function kd(e){let t=await fetch(`${Yr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Gr(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!t.ok)throw new Error(`Failed to exchange auth intent for tokens: ${t.status}`);return t.json()}async function xd(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(`${Yr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Gr(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function _d(e,t){let r=await fetch(`${Yr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Gr(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function Rd(e,t){let r=`${Yr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Gr(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function vd(e,t){let r=`${Yr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Gr(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function Id(e,t){let r=await fetch(`${Yr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Gr(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function Pd(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(`${Yr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Gr(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}async function Od(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Yr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Gr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}var $m=5,Dd={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function ca(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:i,authorize:s,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:d,registerWalletAddress:c,collectPaymentMethod:g,createCryptoPaymentToken:w}=stripeReactNative.useOnramp(),[f,y]=on.useState(r),[b,m]=on.useState(false),[S,h]=on.useState(""),[p,T]=on.useState(null),[x,_]=on.useState(e?.email??""),[F,k]=on.useState(e?.phone??""),[C,B]=on.useState(""),[E,L]=on.useState("US"),[R,H]=on.useState(""),[V,we]=on.useState(""),[We,Xe]=on.useState(false),[ee,ye]=on.useState(false),ze=on.useRef(0),Fe=on.useRef(false),Ue=on.useRef(false),ie=on.useRef(false),Ge=on.useRef(""),Ve=on.useRef(null),[Ye,dt]=on.useState(Dd),[at,ht]=on.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[He,Lt]=on.useState(""),[J,q]=on.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Te,wt]=on.useState(e?.defaultSourceAmount??"100"),[he,_e]=on.useState(e?.defaultSourceCurrency??"usd"),[Je,mt]=on.useState(e?.defaultDestinationCurrency??"usdc"),[Se,et]=on.useState(null),[Ht,lt]=on.useState(false),Re=on.useRef(null),Nt=on.useRef(false),Bt=on.useRef(0),Cr=on.useRef(e?.onComplete),xe=on.useRef(e?.onError),je=on.useRef(e?.onStepChange),$e=on.useRef(r);on.useEffect(()=>{Cr.current=e?.onComplete;},[e?.onComplete]),on.useEffect(()=>{xe.current=e?.onError;},[e?.onError]),on.useEffect(()=>{je.current=e?.onStepChange;},[e?.onStepChange]);let ur=on.useRef(r);on.useEffect(()=>{f!==ur.current&&(je.current?.(f,ur.current),ur.current=f),$e.current=f;},[f]);let N=on.useCallback((P,Y,ne)=>{let v={code:P,message:Y,step:$e.current,stripeErrorCode:ne};T(v),h(""),xe.current?.(v);},[]),re=on.useCallback(P=>{let Y={sessionId:P.id,status:P.status,sourceAmount:P.transaction_details.source_amount,sourceCurrency:P.transaction_details.source_currency,destinationAmount:P.transaction_details.destination_amount,destinationCurrency:P.transaction_details.destination_currency,destinationNetwork:P.transaction_details.destination_network,walletAddress:P.transaction_details.wallet_address,fees:{networkFee:P.transaction_details.fees.network_fee_amount,transactionFee:P.transaction_details.fees.transaction_fee_amount}};return Cr.current?.(Y),Y},[]),ue=on.useCallback(()=>T(null),[]);on.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){lt(false);return}let Y=false;return stripeReactNative.isPlatformPaySupported().then(ne=>{Y||lt(ne);}),()=>{Y=true;}},[e?.merchantIdentifier]),on.useEffect(()=>(Nt.current=false,()=>{Nt.current=true,Re.current&&clearTimeout(Re.current);}),[]),on.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||We||ee)return;let P=false;ye(true);async function Y(){try{let[ne,v]=await Promise.all([Pd({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?Od({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Tt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Tt?.message),null)):Promise.resolve(null)]);if(P)return;let M=e?.destinationChainType??"ethereum",ke=ne.data.find(Tt=>Tt.chain_type===M);if(ke?.address){let Tt=ke.address.toLowerCase();ht(Tt),Ge.current=Tt,ke.recipient_address&&Lt(ke.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",M,"in",ne.data?.length,"wallets");let gt={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},zo={8453:"base",1:"ethereum",137:"polygon"},wr=v?.destination_network,ir="none";if(wr&&gt[wr])q(gt[wr]),ir=wr+" (from default_token API)";else if(e?.destinationChainId&&zo[e.destinationChainId]){let Tt=zo[e.destinationChainId];gt[Tt]&&q(gt[Tt]),ir=Tt+" (from chain_id "+e.destinationChainId+")";}else gt[M]&&(q(gt[M]),ir=M+" (from chain_type fallback)");v?.destination_currency&&mt(v.destination_currency.toLowerCase()),Xe(!0),ie.current=!0;}catch(ne){console.error("[useStripeOnramp] Failed to resolve wallet:",ne?.message),Xe(true),ie.current=true;}finally{P||ye(false);}}return Y(),()=>{P=true;}},[e?.publishableKey,e?.externalUserId]);let le=on.useCallback(async()=>{if(Ve.current)return Ve.current;let P=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(Y=>(Y.error&&(console.error("[useStripeOnramp] configureSDK error:",Y.error.message,Y.error.code),Ve.current=null),Y)).catch(Y=>{throw console.error("[useStripeOnramp] configureSDK threw:",Y?.message??Y),Ve.current=null,Y});return Ve.current=P,P},[o,e?.merchantDisplayName]);on.useEffect(()=>{le();},[]);let Le=on.useCallback(async P=>{if(!Fe.current){Fe.current=true,m(true),ue(),h("Creating auth intent...");try{let Y=await Sd(P);h("Waiting for authorization...");let ne=await s(Y);if(ne?.error){N("authorization_error",ne.error.message,ne.error.code),y("email");return}if(ne?.status==="Denied"){N("authorization_error","Authorization denied by user."),y("email");return}if(ne?.status!=="Consented"||!ne.customerId){N("authorization_error","Authorization was canceled."),y("email");return}h("Exchanging tokens...");let v=await kd(Y),M=ne.customerId,ke=v.access_token;H(M),we(ke),h("Checking verification status...");try{let gt=await Rd(M,ke),zo=gt.verifications.find(mo=>mo.name==="kyc_verified"),wr=gt.verifications.find(mo=>mo.name==="id_document_verified"),ir=zo?.status==="verified",Tt=zo?.status==="rejected",Uo=wr?.status==="verified",fl=gt.provided_fields.includes("first_name");if(h(""),Tt&&!fl)N("kyc_error","KYC was previously rejected. Please submit with correct info."),y("kyc");else if(Tt&&fl)y(Uo?"wallet":"identity");else if(!ir&&!fl)y("kyc");else if(!Uo)y("identity");else if(ie.current&&Ge.current)try{let mo=await c(Ge.current,J);mo?.error?(N("wallet_error",mo.error.message,mo.error.code),y("wallet")):y(t?"payment_method":"session_params");}catch(mo){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",mo?.message),y("wallet");}else y("wallet");}catch(gt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",gt?.message),h(""),y("kyc");}}catch(Y){N("authorization_error",Y?.message??String(Y)),y("email");}finally{Fe.current=false,m(false);}}},[s,ue,N,c,J,t]),U=on.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!x){N("validation_error","Please enter an email address.");return}m(true),ue(),h("");try{h("Configuring...");let P=await le();if(P.error){N("configuration_error",P.error.message,P.error.code);return}h("Checking Link account...");let Y=await n(x);if(Y.error){N("authorization_error",Y.error.message,Y.error.code);return}Y.hasLinkAccount?await Le(x):(h(""),y("register"));}catch(P){N("unknown_error",P?.message??String(P));}finally{m(false);}},[ue,le,x,N,n,Le]),Z=on.useCallback(async()=>{if(!F){N("validation_error","Please enter your phone number.");return}m(true),ue(),h("");try{h("Creating Link account...");let P=await i({email:x,phone:F,fullName:C||x,country:E||"US"});if(P.error){N("registration_error",P.error.message,P.error.code);return}await Le(x);}catch(P){N("registration_error",P?.message??String(P));}finally{m(false);}},[ue,E,x,N,C,F,i,Le]);on.useEffect(()=>{if(f!=="email"||!e?.email)return;let P=++ze.current,Y=false,ne=()=>Y||ze.current!==P;return e?.phone?(async()=>{m(true),ue();try{h("Configuring...");let v=await le();if(ne())return;if(v.error){N("configuration_error",v.error.message,v.error.code);return}h("Checking Link account...");let M=await n(e.email);if(ne())return;if(M.error){N("authorization_error",M.error.message,M.error.code);return}if(M.hasLinkAccount){if(ne())return;await Le(e.email);}else {h("Creating Link account...");let ke=await i({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(ne())return;if(ke.error){N("registration_error",ke.error.message,ke.error.code);return}if(ne())return;await Le(e.email);}}catch(v){ne()||N("unknown_error",v?.message??String(v));}finally{m(false);}})():(async()=>{m(true),ue();try{h("Configuring...");let v=await le();if(ne())return;if(v.error){N("configuration_error",v.error.message,v.error.code);return}h("Checking Link account...");let M=await n(e.email);if(ne())return;if(M.error){N("authorization_error",M.error.message,M.error.code);return}if(M.hasLinkAccount){if(ne())return;await Le(e.email);}else {if(ne())return;h(""),y("register");}}catch(v){ne()||N("unknown_error",v?.message??String(v));}finally{m(false);}})(),()=>{Y=true;}},[f,e?.email,e?.phone]);let pe=on.useCallback(async P=>{m(true),ue(),h(""),dt(P);try{let Y={firstName:P.firstName,lastName:P.lastName,idNumber:P.idNumber||void 0,dateOfBirth:{day:parseInt(P.dobDay,10),month:parseInt(P.dobMonth,10),year:parseInt(P.dobYear,10)},address:{line1:P.addressLine1,line2:P.addressLine2||void 0,city:P.city,state:P.state,postalCode:P.postalCode,country:P.country}},ne=await a(Y);if(ne?.error){if(ne.error.stripeErrorCode==="consumer_person_already_verified"){h(""),y("identity");return}N("kyc_error",ne.error.message,ne.error.stripeErrorCode??ne.error.code),y("kyc");return}h("Please review your KYC information...");let v=await l(null);if(v?.error){N("kyc_error",v.error.message,v.error.stripeErrorCode??v.error.code),y("kyc");return}if(v?.status==="UpdateAddress"){N("kyc_error","Please update your address and resubmit."),y("kyc");return}h(""),y("identity");}catch(Y){N("kyc_error",Y?.message??String(Y)),y("kyc");}finally{m(false);}},[a,ue,N,l]),oe=on.useCallback(async()=>{if(!Ue.current){Ue.current=true,m(true),ue(),h("Launching identity verification...");try{let P=await d();if(P?.error){N("identity_error",P.error.message,P.error.code);return}h(""),y("wallet");}catch(P){N("identity_error",P?.message??String(P));}finally{Ue.current=false,m(false);}}},[ue,N,d]);on.useEffect(()=>{f==="identity"&&!b&&oe();},[f]);let X=on.useCallback(async()=>{if(!at){N("validation_error","Please enter a wallet address.");return}m(true),ue(),h("");try{let P=await c(at.toLowerCase(),J);if(P?.error){N("wallet_error",P.error.message,P.error.code);return}h(""),y(t?"payment_method":"session_params");}catch(P){N("wallet_error",P?.message??String(P));}finally{m(false);}},[ue,N,at,J,c,t]);on.useEffect(()=>{f==="wallet"&&We&&at&&!b&&X();},[f,We,at]);let ce=on.useCallback((P,Y)=>{Nt.current=false,Bt.current=0;let ne=async()=>{try{let v=await vd(P,Y);if(Nt.current)return;Bt.current=0,v.status==="fulfillment_complete"?(et(v),y("success"),re(v)):Re.current=setTimeout(ne,3e3);}catch(v){if(Nt.current)return;if(Bt.current+=1,console.error("[pollSessionStatus] error:",v?.message),Bt.current>=$m){N("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}Re.current=setTimeout(ne,5e3);}};Re.current=setTimeout(ne,3e3);},[re,N]),nt=on.useCallback(()=>{$e.current==="processing"&&(!Se?.id||!V||(ue(),Bt.current=0,Re.current&&(clearTimeout(Re.current),Re.current=null),ce(Se.id,V)));},[V,ue,ce,Se?.id]),Xt=on.useCallback(async P=>{m(true),ue(),h("");try{h("Confirming purchase...");let Y=await _d(P,V);et(Y),y("processing"),h(""),ce(Y.id,V);}finally{m(false);}},[V,ue,ce]),bn=on.useCallback(async()=>{if(Se)try{await Xt(Se.id);}catch(P){N("session_error",P?.message??String(P)),y("quote");}},[N,Xt,Se]),ul=on.useCallback(async(P=false)=>{if(!Te||isNaN(Number(Te))||Number(Te)<=0){N("validation_error","Please enter a valid amount.");return}m(true),ue(),h("");try{let Y;if(P){if(!e?.merchantIdentifier?.trim()){N("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),y("payment_method");return}h("Opening Apple Pay...");let ke={applePay:{merchantCountryCode:"US",currencyCode:he.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${Je.toUpperCase()} purchase + fees`,amount:Te||"0.00"}]}};Y=await g("PlatformPay",ke);}else h("Select a payment method..."),Y=await g("Card");if(Y?.error){N("payment_error",Y.error.message,Y.error.code),y("payment_method");return}if(!Y?.displayData){N("payment_error","Payment method selection was canceled."),y("payment_method");return}h("Creating payment token...");let ne=await w();if(ne?.error){N("payment_error",ne.error.message,ne.error.code),y("payment_method");return}let v=ne.cryptoPaymentToken;h("Creating onramp session...");let M=await xd({cryptoCustomerId:R,paymentToken:v,sourceAmount:Number(Te),sourceCurrency:he,destinationCurrency:Je,walletAddress:at.toLowerCase(),destinationNetwork:J},V);et(M),h(""),P?await Xt(M.id):y("quote");}catch(Y){N("session_error",Y?.message??String(Y)),y("payment_method");}finally{m(false);}},[V,ue,g,w,R,Je,N,Xt,Te,he,at,J,e?.merchantIdentifier]),pl=on.useCallback(async()=>{if(Se){m(true),ue(),h("");try{let P=await Id(Se.id,V);et(P);}catch(P){N("session_error",P?.message??String(P));}finally{m(false);}}},[V,ue,N,Se]),ml=on.useCallback(()=>{Nt.current=true,Bt.current=0,Re.current&&(clearTimeout(Re.current),Re.current=null),y(r),m(false),h(""),T(null),_(e?.email??""),k(e?.phone??""),B(""),L("US"),H(""),we(""),Xe(false),ye(false),dt(Dd),ht(e?.recipientAddress??""),q(stripeReactNative.Onramp.CryptoNetwork.ethereum),wt(e?.defaultSourceAmount??"100"),_e(e?.defaultSourceCurrency??"usd"),mt(e?.defaultDestinationCurrency??"usdc"),et(null),ze.current+=1,Fe.current=false,Ue.current=false;},[e,r]);return {step:f,loading:b,status:S,error:p,email:x,phone:F,fullName:C,country:E,customerId:R,accessToken:V,session:Se,kycData:Ye,walletAddress:at,resolvedRecipientAddress:He,walletNetwork:J,sourceAmount:Te,sourceCurrency:he,destinationCurrency:Je,applePaySupported:Ht,walletReady:We,walletLoading:ee,setStep:y,setStatus:h,setEmail:_,setPhone:k,setFullName:B,setCountry:L,setWalletAddress:ht,setWalletNetwork:q,setSourceAmount:wt,setSourceCurrency:_e,setDestinationCurrency:mt,checkEmail:U,register:Z,attachKyc:pe,verifyIdentity:oe,registerWallet:X,collectPaymentMethod:ul,refreshQuote:pl,confirmCheckout:bn,reset:ml,clearError:ue,resumeFulfillmentPolling:nt,amountFirst:t}}function Fd({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:d}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(it,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kt,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(it,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kt,{error:n,progress:i,loading:o})]})]})})}function Ld({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(it,{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(Kt,{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 Wd({styles:e,loading:t,error:r,status:o,sourceAmount:n,sourceCurrency:i,destinationCurrency:s,walletNetwork:a,applePaySupported:l,collectPaymentMethod:d,onClose:c}){let{colors:g}=O(),w=ii.find(b=>b.value===a)?.label??a,f=n===""||n===void 0?"0":n,y=g.primaryForeground;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:c,title:"How do you want to pay?"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.payHint,children:"Select a payment method to continue"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.stackWrapper,children:[jsxRuntime.jsxs(reactNative.View,{style:[e.pm.swapCard,e.pm.swapCardTop],children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.summaryLabel,children:"You pay"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.swapRow,children:[jsxRuntime.jsxs(reactNative.Text,{style:e.pm.swapSpendAmount,numberOfLines:1,adjustsFontSizeToFit:true,children:["$",f]}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapPill,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapPillText,children:i.toUpperCase()})})]})]}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapConnectorWrap,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:e.pm.swapConnectorCircle,children:jsxRuntime.jsx(yt,{size:20,color:y,strokeWidth:2.5})})}),jsxRuntime.jsxs(reactNative.View,{style:[e.pm.swapCard,e.pm.swapCardBottom],children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.summaryLabel,children:"You receive"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.swapRow,children:[jsxRuntime.jsx(reactNative.View,{style:e.pm.swapLeftCol,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapReceivePrimary,numberOfLines:1,adjustsFontSizeToFit:true,children:s.toUpperCase()})}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapPill,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapPillText,children:w.toUpperCase()})})]})]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[t?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(it,{size:28,strokeWidth:2})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.pm.applePayBtn,onPress:()=>d(true),children:jsxRuntime.jsxs(reactNative.Text,{style:e.pm.applePayBtnText,children:["Pay with ","\uF8FF"," Pay"]})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:()=>d(false),children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Pay with Card"})})]}),jsxRuntime.jsx(Kt,{error:r,progress:o,loading:t})]})]})}function Ed({styles:e,error:t,status:r,loading:o,onClose:n,onRetryStatusCheck:i}){let s=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[s?jsxRuntime.jsx(It,{onPress:n}):jsxRuntime.jsx(reactNative.View,{style:qs}),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(it,{size:48,strokeWidth:3})}),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."]})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Kt,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function zd({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,refreshQuote:s,onClose:a}){let l=t.transaction_details,d=new Date(l.quote_expiration*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),c=l.wallet_address.slice(0,6)+"..."+l.wallet_address.slice(-4),g=js(l.destination_amount,l.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:a,title:"Review your purchase"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:e.quote.heroBox,children:[jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroLabel,children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroAmount,children:g}),jsxRuntime.jsxs(reactNative.Text,{style:e.quote.heroNetwork,children:[l.destination_currency.toUpperCase()," ",$s(l.destination_network)]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(jo,{quote:e.quote,label:"You pay",value:`${l.source_amount} ${l.source_currency.toUpperCase()}`}),jsxRuntime.jsx(jo,{quote:e.quote,label:"Network fee",value:`$${l.fees.network_fee_amount}`}),jsxRuntime.jsx(jo,{quote:e.quote,label:"Transaction fee",value:`$${l.fees.transaction_fee_amount}`}),jsxRuntime.jsx(jo,{quote:e.quote,label:"Wallet",value:c,mono:true}),jsxRuntime.jsx(jo,{quote:e.quote,label:"Quote expires",value:d,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(it,{size:28,strokeWidth:2})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Refresh Quote"})})]}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]})}function Ud({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:d}){let c=O();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(it,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:s,onChangeText:g=>a(g.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:i})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(it,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]})})}function Hd({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,onDone:n}){let{colors:i}=O(),s=t.transaction_details,a=js(s.destination_amount,s.destination_currency),l=r||o||"";return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:n,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(reactNative.ScrollView,{style:e.form.flex,contentContainerStyle:e.flow.successScrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.checkCircle,children:jsxRuntime.jsx(Ae,{size:40,color:i.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your crypto is on its way to your wallet."}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.heroBox,e.flow.detailCard],children:[jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroLabel,children:"You received"}),jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroAmount,children:a}),jsxRuntime.jsxs(reactNative.Text,{style:e.quote.heroNetwork,children:[s.destination_currency.toUpperCase()," ",$s(s.destination_network)]})]}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,e.flow.detailCard],children:[jsxRuntime.jsx(Il,{quote:e.quote,label:"Deposit Address",address:s.wallet_address}),l?jsxRuntime.jsx(Il,{quote:e.quote,label:"Recipient Address",address:l,last:true}):jsxRuntime.jsx(jo,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),mono:true,last:true})]})]})}),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:"Done"})})})]})}function jd({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:d,registerWallet:c,onClose:g}){let{components:w}=O();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(it,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(It,{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:w.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:ii.map(f=>{let y=s===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(f.value),d(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,y&&e.wallet.rowTextSelected],children:f.label}),y&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(Ae,{size:14,color:w.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(it,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:c,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]})})}function pa({config:e,onComplete:t}){let r=O(),o=ai(),{step:n,loading:i,status:s,error:a,email:l,phone:d,session:c,kycData:g,walletAddress:w,resolvedRecipientAddress:f,walletNetwork:y,sourceAmount:b,sourceCurrency:m,destinationCurrency:S,applePaySupported:h,setStep:p,setEmail:T,setPhone:x,setWalletAddress:_,setWalletNetwork:F,setSourceAmount:k,setDestinationCurrency:C,checkEmail:B,register:E,attachKyc:L,verifyIdentity:R,registerWallet:H,collectPaymentMethod:V,refreshQuote:we,confirmCheckout:We,reset:Xe,resumeFulfillmentPolling:ee,amountFirst:ye}=ca(e),ze=!!e?.email,Fe=!!e?.phone,Ue=!!e?.publishableKey&&!!e?.externalUserId,ie=()=>{Xe(),t?.();};return n==="email"?jsxRuntime.jsx(Fd,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:ze,loading:i,error:a,status:s,email:l,setEmail:T,checkEmail:B,onClose:ie}):n==="register"?jsxRuntime.jsx(Ud,{styles:o,hasPrefilledPhone:Fe,loading:i,error:a,status:s,email:l,phone:d,setPhone:x,register:E,onClose:ie}):n==="kyc"?jsxRuntime.jsx(Js,{initialData:g,loading:i,onComplete:L,onCancel:()=>p("email")}):n==="identity"?jsxRuntime.jsx(Ld,{styles:o,loading:i,status:s,error:a,verifyIdentity:R,onClose:ie}):n==="wallet"?jsxRuntime.jsx(jd,{styles:o,hasAutoWallet:Ue,loading:i,error:a,status:s,walletAddress:w,walletNetwork:y,setWalletAddress:_,setWalletNetwork:F,setDestinationCurrency:C,registerWallet:H,onClose:ie}):n==="session_params"?jsxRuntime.jsx(Gs,{initialAmount:b,currency:m,onConfirm:Ge=>{k(Ge),p(ye?"email":"payment_method");},onCancel:()=>{ye?ie():p("wallet");}}):n==="payment_method"?jsxRuntime.jsx(Wd,{styles:o,loading:i,error:a,status:s,sourceAmount:b,sourceCurrency:m,destinationCurrency:S,walletNetwork:y,applePaySupported:h,collectPaymentMethod:V,onClose:ie}):n==="quote"&&c?jsxRuntime.jsx(zd,{styles:o,session:c,loading:i,error:a,status:s,confirmCheckout:We,refreshQuote:we,onClose:ie}):n==="processing"?jsxRuntime.jsx(Ed,{styles:o,error:a,status:s,loading:i,onClose:ie,onRetryStatusCheck:ee}):n==="success"&&c?jsxRuntime.jsx(Hd,{styles:o,session:c,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,onDone:()=>{Xe(),t?.();}}):null}function $d(){try{let e=df__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}}catch{}}function ma({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:d,onError:c,onStepChange:g,onClose:w,merchantIdentifier:f="",urlScheme:y="unifoldOnramp"}){let b=e||ea(),m=on.useMemo(()=>{let _=f.trim();return _.length>0?_:$d()??""},[f]),[S,h]=on.useState("loading"),[p,T]=on.useState(null);on.useEffect(()=>{let _=false;async function F(){try{b&&(sa(b),aa(es()));let k=await la();if(_)return;let C=m.trim();if(await stripeReactNative.initStripe({publishableKey:k,urlScheme:y,...C?{merchantIdentifier:C}:{}}),_)return;h("ready");}catch(k){if(_)return;console.error("[StripeOnramp] Init failed:",k),T(k?.message??"Failed to load Stripe configuration"),h("error");}}return F(),()=>{_=true;}},[b,m,y]);let x=on.useMemo(()=>{let _={publishableKey:b,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:d,onError:c,onStepChange:g};return a&&(_.destinationTokenAddress=a),l&&(_.recipientAddress=l),t&&(_.email=t),r&&(_.phone=r),n&&(_.flowOrder=n),_.merchantIdentifier=m,_},[b,o,i,s,a,l,t,r,n,m,d,c,g]);return S==="error"?jsxRuntime.jsxs(reactNative.View,{style:hi.centered,children:[jsxRuntime.jsx(reactNative.Text,{style:hi.errorText,children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:hi.errorDetail,children:p}),w&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hi.retryBtn,onPress:w,children:jsxRuntime.jsx(reactNative.Text,{style:hi.retryBtnText,children:"Go Back"})})]}):S==="loading"?jsxRuntime.jsx(reactNative.View,{style:hi.centered,children:jsxRuntime.jsx(it,{size:56,strokeWidth:3})}):jsxRuntime.jsx(pa,{config:x,onComplete:w})}var hi=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000",paddingHorizontal:24},errorText:{color:"#FF453A",fontSize:18,fontWeight:"600",marginBottom:8},errorDetail:{color:"#8E8E93",fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{backgroundColor:"#00D924",borderRadius:24,paddingVertical:14,paddingHorizontal:32},retryBtnText:{color:"#000000",fontSize:16,fontWeight:"700"}});function Gd(){let{configure:e}=stripeReactNative.useOnramp(),t=on.useRef(false);return on.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 Yd="__unifold_stripe_onramp__";function fa(e){globalThis[Yd]=e;}function Jd(){return globalThis[Yd]}fa(ma);var Zr=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 On,Go,gi,Zd,Cf=(Zd=class extends Zr{constructor(){super();Q(this,On);Q(this,Go);Q(this,gi);D(this,gi,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){u(this,Go)||this.setEventListener(u(this,gi));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Go))==null||t.call(this),D(this,Go,void 0));}setEventListener(t){var r;D(this,gi,t),(r=u(this,Go))==null||r.call(this),D(this,Go,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){u(this,On)!==t&&(D(this,On,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof u(this,On)=="boolean"?u(this,On):globalThis.document?.visibilityState!=="hidden"}},On=new WeakMap,Go=new WeakMap,gi=new WeakMap,Zd),yi=new Cf;var wf={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Xr,Dn,Xd,Tf=(Xd=class{constructor(){Q(this,Xr,wf);Q(this,Dn,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&u(this,Dn)&&e!==u(this,Xr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:u(this,Xr),provider:e}),D(this,Xr,e),process.env.NODE_ENV!=="production"&&D(this,Dn,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&D(this,Dn,true),u(this,Xr).setTimeout(e,t)}clearTimeout(e){u(this,Xr).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&D(this,Dn,true),u(this,Xr).setInterval(e,t)}clearInterval(e){u(this,Xr).clearInterval(e);}},Xr=new WeakMap,Dn=new WeakMap,Xd),eo=new Tf;function eu(e){setTimeout(e,0);}var Hl=typeof window>"u"||"Deno"in globalThis;function At(){}function ou(e,t){return typeof e=="function"?e(t):e}function ds(e){return typeof e=="number"&&e>=0&&e!==1/0}function ga(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zr(e,t){return typeof e=="function"?e(t):e}function hr(e,t){return typeof e=="function"?e(t):e}function ya(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==us(s,t.options))return false}else if(!Ln(t.queryKey,s))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||i&&!i(t))}function ba(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(Fn(t.options.mutationKey)!==Fn(i))return false}else if(!Ln(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function us(e,t){return (t?.queryKeyHashFn||Fn)(e)}function Fn(e){return JSON.stringify(e,(t,r)=>Ul(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Ln(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Ln(e[r],t[r])):false}var Sf=Object.prototype.hasOwnProperty;function ha(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=tu(e)&&tu(t);if(!o&&!(Ul(e)&&Ul(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},d=0;for(let c=0;c<a;c++){let g=o?c:s[c],w=e[g],f=t[g];if(w===f){l[g]=w,(o?c<i:Sf.call(e,g))&&d++;continue}if(w===null||f===null||typeof w!="object"||typeof f!="object"){l[g]=f;continue}let y=ha(w,f,r+1);l[g]=y,y===w&&d++;}return i===a&&d===i?e:l}function Ca(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 tu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ul(e){if(!ru(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!ru(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ru(e){return Object.prototype.toString.call(e)==="[object Object]"}function nu(e){return new Promise(t=>{eo.setTimeout(t,e);})}function ps(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 ha(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 ha(e,t)}return t}function iu(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function su(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Vn=Symbol();function wa(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Vn&&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===Vn?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ta(e,t){return typeof e=="function"?e(...t):!!e}function au(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 to=(()=>{let e=()=>Hl;return {isServer(){return e()},setIsServer(t){e=t;}}})();function ms(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var lu=eu;function kf(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=lu,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var ut=kf();var bi,Yo,Ci,cu,xf=(cu=class extends Zr{constructor(){super();Q(this,bi,true);Q(this,Yo);Q(this,Ci);D(this,Ci,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){u(this,Yo)||this.setEventListener(u(this,Ci));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Yo))==null||t.call(this),D(this,Yo,void 0));}setEventListener(t){var r;D(this,Ci,t),(r=u(this,Yo))==null||r.call(this),D(this,Yo,t(this.setOnline.bind(this)));}setOnline(t){u(this,bi)!==t&&(D(this,bi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return u(this,bi)}},bi=new WeakMap,Yo=new WeakMap,Ci=new WeakMap,cu),wi=new xf;function _f(e){return Math.min(1e3*2**e,3e4)}function Nl(e){return (e??"online")==="online"?wi.isOnline():true}var Sa=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function ka(e){let t=false,r=0,o,n=ms(),i=()=>n.status!=="pending",s=b=>{if(!i()){let m=new Sa(b);w(m),e.onCancel?.(m);}},a=()=>{t=true;},l=()=>{t=false;},d=()=>yi.isFocused()&&(e.networkMode==="always"||wi.isOnline())&&e.canRun(),c=()=>Nl(e.networkMode)&&e.canRun(),g=b=>{i()||(o?.(),n.resolve(b));},w=b=>{i()||(o?.(),n.reject(b));},f=()=>new Promise(b=>{o=m=>{(i()||d())&&b(m);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),y=()=>{if(i())return;let b,m=r===0?e.initialPromise:void 0;try{b=m??e.fn();}catch(S){b=Promise.reject(S);}Promise.resolve(b).then(g).catch(S=>{if(i())return;let h=e.retry??(to.isServer()?0:3),p=e.retryDelay??_f,T=typeof p=="function"?p(r,S):p,x=h===true||typeof h=="number"&&r<h||typeof h=="function"&&h(r,S);if(t||!x){w(S);return}r++,e.onFail?.(r,S),nu(T).then(()=>d()?void 0:f()).then(()=>{t?w(S):y();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?y():f().then(y),n)}}var Bn,du,xa=(du=class{constructor(){Q(this,Bn);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),ds(this.gcTime)&&D(this,Bn,eo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(to.isServer()?1/0:300*1e3));}clearGcTimeout(){u(this,Bn)!==void 0&&(eo.clearTimeout(u(this,Bn)),D(this,Bn,void 0));}},Bn=new WeakMap,du);var Wn,Ti,Fr,An,$t,fs,En,Rr,hu,To,mu,fu=(mu=class extends xa{constructor(t){super();Q(this,Rr);Q(this,Wn);Q(this,Ti);Q(this,Fr);Q(this,An);Q(this,$t);Q(this,fs);Q(this,En);D(this,En,false),D(this,fs,t.defaultOptions),this.setOptions(t.options),this.observers=[],D(this,An,t.client),D(this,Fr,u(this,An).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,D(this,Wn,pu(this.options)),this.state=t.state??u(this,Wn),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return u(this,$t)?.promise}setOptions(t){if(this.options={...u(this,fs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=pu(this.options);r.data!==void 0&&(this.setState(uu(r.data,r.dataUpdatedAt)),D(this,Wn,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&u(this,Fr).remove(this);}setData(t,r){let o=ps(this.state.data,t,this.options);return be(this,Rr,To).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){be(this,Rr,To).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=u(this,$t)?.promise;return u(this,$t)?.cancel(t),r?r.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return u(this,Wn)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>hr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zr(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!ga(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),u(this,$t)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),u(this,$t)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),u(this,Fr).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(u(this,$t)&&(u(this,En)||be(this,Rr,hu).call(this)?u(this,$t).cancel({revert:true}):u(this,$t).cancelRetry()),this.scheduleGc()),u(this,Fr).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,Rr,To).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&u(this,$t)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(u(this,$t))return u(this,$t).continueRetry(),u(this,$t).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(d=>d.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:()=>(D(this,En,true),o.signal)});},i=()=>{let l=wa(this.options,r),c=(()=>{let g={client:u(this,An),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return D(this,En,false),this.options.persister?this.options.persister(l,c,this):l(c)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:u(this,An),state:this.state,fetchFn:i};return n(l),l})();this.options.behavior?.onFetch(a,this),D(this,Ti,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&be(this,Rr,To).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),D(this,$t,ka({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Sa&&l.revert&&this.setState({...u(this,Ti),fetchStatus:"idle"}),o.abort();},onFail:(l,d)=>{be(this,Rr,To).call(this,{type:"failed",failureCount:l,error:d});},onPause:()=>{be(this,Rr,To).call(this,{type:"pause"});},onContinue:()=>{be(this,Rr,To).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await u(this,$t).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),u(this,Fr).config.onSuccess?.(l,this),u(this,Fr).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Sa){if(l.silent)return u(this,$t).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw be(this,Rr,To).call(this,{type:"error",error:l}),u(this,Fr).config.onError?.(l,this),u(this,Fr).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Wn=new WeakMap,Ti=new WeakMap,Fr=new WeakMap,An=new WeakMap,$t=new WeakMap,fs=new WeakMap,En=new WeakMap,Rr=new WeakSet,hu=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},To=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,...jl(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...uu(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return D(this,Ti,t.manual?n:void 0),n;case "error":let i=t.error;return {...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),ut.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),u(this,Fr).notify({query:this,type:"updated",action:t});});},mu);function jl(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Nl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function uu(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function pu(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 gr,ve,gs,lr,Mn,Si,So,Jo,ys,ki,xi,zn,Un,Zo,_i,qe,hs,$l,ql,Ql,Kl,Gl,Yl,Jl,Cu,bu,Xl=(bu=class extends Zr{constructor(t,r){super();Q(this,qe);Q(this,gr);Q(this,ve);Q(this,gs);Q(this,lr);Q(this,Mn);Q(this,Si);Q(this,So);Q(this,Jo);Q(this,ys);Q(this,ki);Q(this,xi);Q(this,zn);Q(this,Un);Q(this,Zo);Q(this,_i,new Set);this.options=r,D(this,gr,t),D(this,Jo,null),D(this,So,ms()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(u(this,ve).addObserver(this),gu(u(this,ve),this.options)?be(this,qe,hs).call(this):this.updateResult(),be(this,qe,Kl).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Zl(u(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zl(u(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,qe,Gl).call(this),be(this,qe,Yl).call(this),u(this,ve).removeObserver(this);}setOptions(t){let r=this.options,o=u(this,ve);if(this.options=u(this,gr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof hr(this.options.enabled,u(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,qe,Jl).call(this),u(this,ve).setOptions(this.options),r._defaulted&&!Ca(this.options,r)&&u(this,gr).getQueryCache().notify({type:"observerOptionsUpdated",query:u(this,ve),observer:this});let n=this.hasListeners();n&&yu(u(this,ve),o,this.options,r)&&be(this,qe,hs).call(this),this.updateResult(),n&&(u(this,ve)!==o||hr(this.options.enabled,u(this,ve))!==hr(r.enabled,u(this,ve))||zr(this.options.staleTime,u(this,ve))!==zr(r.staleTime,u(this,ve)))&&be(this,qe,$l).call(this);let i=be(this,qe,ql).call(this);n&&(u(this,ve)!==o||hr(this.options.enabled,u(this,ve))!==hr(r.enabled,u(this,ve))||i!==u(this,Zo))&&be(this,qe,Ql).call(this,i);}getOptimisticResult(t){let r=u(this,gr).getQueryCache().build(u(this,gr),t),o=this.createResult(r,t);return vf(this,o)&&(D(this,lr,o),D(this,Si,this.options),D(this,Mn,u(this,ve).state)),o}getCurrentResult(){return u(this,lr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&u(this,So).status==="pending"&&u(this,So).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){u(this,_i).add(t);}getCurrentQuery(){return u(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=u(this,gr).defaultQueryOptions(t),o=u(this,gr).getQueryCache().build(u(this,gr),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return be(this,qe,hs).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),u(this,lr)))}createResult(t,r){let o=u(this,ve),n=this.options,i=u(this,lr),s=u(this,Mn),a=u(this,Si),d=t!==o?t.state:u(this,gs),{state:c}=t,g={...c},w=false,f;if(r._optimisticResults){let C=this.hasListeners(),B=!C&&gu(t,r),E=C&&yu(t,o,r,n);(B||E)&&(g={...g,...jl(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:y,errorUpdatedAt:b,status:m}=g;f=g.data;let S=false;if(r.placeholderData!==void 0&&f===void 0&&m==="pending"){let C;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(C=i.data,S=true):C=typeof r.placeholderData=="function"?r.placeholderData(u(this,xi)?.state.data,u(this,xi)):r.placeholderData,C!==void 0&&(m="success",f=ps(i?.data,C,r),w=true);}if(r.select&&f!==void 0&&!S)if(i&&f===s?.data&&r.select===u(this,ys))f=u(this,ki);else try{D(this,ys,r.select),f=r.select(f),f=ps(i?.data,f,r),D(this,ki,f),D(this,Jo,null);}catch(C){D(this,Jo,C);}u(this,Jo)&&(y=u(this,Jo),f=u(this,ki),b=Date.now(),m="error");let h=g.fetchStatus==="fetching",p=m==="pending",T=m==="error",x=p&&h,_=f!==void 0,k={status:m,fetchStatus:g.fetchStatus,isPending:p,isSuccess:m==="success",isError:T,isInitialLoading:x,isLoading:x,data:f,dataUpdatedAt:g.dataUpdatedAt,error:y,errorUpdatedAt:b,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:h,isRefetching:h&&!p,isLoadingError:T&&!_,isPaused:g.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:T&&_,isStale:ec(t,r),refetch:this.refetch,promise:u(this,So),isEnabled:hr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let C=k.data!==void 0,B=k.status==="error"&&!C,E=H=>{B?H.reject(k.error):C&&H.resolve(k.data);},L=()=>{let H=D(this,So,k.promise=ms());E(H);},R=u(this,So);switch(R.status){case "pending":t.queryHash===o.queryHash&&E(R);break;case "fulfilled":(B||k.data!==R.value)&&L();break;case "rejected":(!B||k.error!==R.reason)&&L();break}}return k}updateResult(){let t=u(this,lr),r=this.createResult(u(this,ve),this.options);if(D(this,Mn,u(this,ve).state),D(this,Si,this.options),u(this,Mn).data!==void 0&&D(this,xi,u(this,ve)),Ca(r,t))return;D(this,lr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!u(this,_i).size)return true;let s=new Set(i??u(this,_i));return this.options.throwOnError&&s.add("error"),Object.keys(u(this,lr)).some(a=>{let l=a;return u(this,lr)[l]!==t[l]&&s.has(l)})};be(this,qe,Cu).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,qe,Kl).call(this);}},gr=new WeakMap,ve=new WeakMap,gs=new WeakMap,lr=new WeakMap,Mn=new WeakMap,Si=new WeakMap,So=new WeakMap,Jo=new WeakMap,ys=new WeakMap,ki=new WeakMap,xi=new WeakMap,zn=new WeakMap,Un=new WeakMap,Zo=new WeakMap,_i=new WeakMap,qe=new WeakSet,hs=function(t){be(this,qe,Jl).call(this);let r=u(this,ve).fetch(this.options,t);return t?.throwOnError||(r=r.catch(At)),r},$l=function(){be(this,qe,Gl).call(this);let t=zr(this.options.staleTime,u(this,ve));if(to.isServer()||u(this,lr).isStale||!ds(t))return;let o=ga(u(this,lr).dataUpdatedAt,t)+1;D(this,zn,eo.setTimeout(()=>{u(this,lr).isStale||this.updateResult();},o));},ql=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(u(this,ve)):this.options.refetchInterval)??false},Ql=function(t){be(this,qe,Yl).call(this),D(this,Zo,t),!(to.isServer()||hr(this.options.enabled,u(this,ve))===false||!ds(u(this,Zo))||u(this,Zo)===0)&&D(this,Un,eo.setInterval(()=>{(this.options.refetchIntervalInBackground||yi.isFocused())&&be(this,qe,hs).call(this);},u(this,Zo)));},Kl=function(){be(this,qe,$l).call(this),be(this,qe,Ql).call(this,be(this,qe,ql).call(this));},Gl=function(){u(this,zn)!==void 0&&(eo.clearTimeout(u(this,zn)),D(this,zn,void 0));},Yl=function(){u(this,Un)!==void 0&&(eo.clearInterval(u(this,Un)),D(this,Un,void 0));},Jl=function(){let t=u(this,gr).getQueryCache().build(u(this,gr),this.options);if(t===u(this,ve))return;let r=u(this,ve);D(this,ve,t),D(this,gs,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Cu=function(t){ut.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(u(this,lr));}),u(this,gr).getQueryCache().notify({query:u(this,ve),type:"observerResultsUpdated"});});},bu);function Rf(e,t){return hr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function gu(e,t){return Rf(e,t)||e.state.data!==void 0&&Zl(e,t,t.refetchOnMount)}function Zl(e,t,r){if(hr(t.enabled,e)!==false&&zr(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&ec(e,t)}return false}function yu(e,t,r,o){return (e!==t||hr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&ec(e,r)}function ec(e,t){return hr(t.enabled,e)!==false&&e.isStaleByTime(zr(t.staleTime,e))}function vf(e,t){return !Ca(e.getCurrentResult(),t)}function tc(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,d=async()=>{let c=false,g=y=>{au(y,()=>t.signal,()=>c=true);},w=wa(t.options,t.fetchOptions),f=async(y,b,m)=>{if(c)return Promise.reject();if(b==null&&y.pages.length)return Promise.resolve(y);let h=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:b,direction:m?"backward":"forward",meta:t.options.meta};return g(_),_})(),p=await w(h),{maxPages:T}=t.options,x=m?su:iu;return {pages:x(y.pages,p,T),pageParams:x(y.pageParams,b,T)}};if(n&&i.length){let y=n==="backward",b=y?If:wu,m={pages:i,pageParams:s},S=b(o,m);a=await f(m,S,y);}else {let y=e??i.length;do{let b=l===0?s[0]??o.initialPageParam:wu(o,a);if(l>0&&b==null)break;a=await f(a,b),l++;}while(l<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d;}}}function wu(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 If(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var bs,ro,rr,Hn,oo,Xo,Tu,Su=(Tu=class extends xa{constructor(t){super();Q(this,oo);Q(this,bs);Q(this,ro);Q(this,rr);Q(this,Hn);D(this,bs,t.client),this.mutationId=t.mutationId,D(this,rr,t.mutationCache),D(this,ro,[]),this.state=t.state||Pf(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){u(this,ro).includes(t)||(u(this,ro).push(t),this.clearGcTimeout(),u(this,rr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){D(this,ro,u(this,ro).filter(r=>r!==t)),this.scheduleGc(),u(this,rr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){u(this,ro).length||(this.state.status==="pending"?this.scheduleGc():u(this,rr).remove(this));}continue(){return u(this,Hn)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{be(this,oo,Xo).call(this,{type:"continue"});},o={client:u(this,bs),meta:this.options.meta,mutationKey:this.options.mutationKey};D(this,Hn,ka({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{be(this,oo,Xo).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{be(this,oo,Xo).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(this,rr).canRun(this)}));let n=this.state.status==="pending",i=!u(this,Hn).canStart();try{if(n)r();else {be(this,oo,Xo).call(this,{type:"pending",variables:t,isPaused:i}),u(this,rr).config.onMutate&&await u(this,rr).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&be(this,oo,Xo).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await u(this,Hn).start();return await u(this,rr).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await u(this,rr).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),be(this,oo,Xo).call(this,{type:"success",data:s}),s}catch(s){try{await u(this,rr).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await u(this,rr).config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o);}catch(a){Promise.reject(a);}throw be(this,oo,Xo).call(this,{type:"error",error:s}),s}finally{u(this,rr).runNext(this);}}},bs=new WeakMap,ro=new WeakMap,rr=new WeakMap,Hn=new WeakMap,oo=new WeakSet,Xo=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),ut.batch(()=>{u(this,ro).forEach(o=>{o.onMutationUpdate(t);}),u(this,rr).notify({mutation:this,type:"updated",action:t});});},Tu);function Pf(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ko,Ur,Cs,ku,xu=(ku=class extends Zr{constructor(t={}){super();Q(this,ko);Q(this,Ur);Q(this,Cs);this.config=t,D(this,ko,new Set),D(this,Ur,new Map),D(this,Cs,0);}build(t,r,o){let n=new Su({client:t,mutationCache:this,mutationId:++qi(this,Cs)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){u(this,ko).add(t);let r=_a(t);if(typeof r=="string"){let o=u(this,Ur).get(r);o?o.push(t):u(this,Ur).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(u(this,ko).delete(t)){let r=_a(t);if(typeof r=="string"){let o=u(this,Ur).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&u(this,Ur).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=_a(t);if(typeof r=="string"){let n=u(this,Ur).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=_a(t);return typeof r=="string"?u(this,Ur).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ut.batch(()=>{u(this,ko).forEach(t=>{this.notify({type:"removed",mutation:t});}),u(this,ko).clear(),u(this,Ur).clear();});}getAll(){return Array.from(u(this,ko))}find(t){let r={exact:true,...t};return this.getAll().find(o=>ba(r,o))}findAll(t={}){return this.getAll().filter(r=>ba(t,r))}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return ut.batch(()=>Promise.all(t.map(r=>r.continue().catch(At))))}},ko=new WeakMap,Ur=new WeakMap,Cs=new WeakMap,ku);function _a(e){return e.options.scope?.id}var no,_u,Ru=(_u=class extends Zr{constructor(t={}){super();Q(this,no);this.config=t,D(this,no,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??us(n,r),s=this.get(i);return s||(s=new fu({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){u(this,no).has(t.queryHash)||(u(this,no).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=u(this,no).get(t.queryHash);r&&(t.destroy(),r===t&&u(this,no).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){ut.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return u(this,no).get(t)}getAll(){return [...u(this,no).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>ya(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>ya(t,o)):r}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){ut.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){ut.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},no=new WeakMap,_u);var xt,en,tn,Ri,vi,rn,Ii,Pi,vu,rc=(vu=class{constructor(e={}){Q(this,xt);Q(this,en);Q(this,tn);Q(this,Ri);Q(this,vi);Q(this,rn);Q(this,Ii);Q(this,Pi);D(this,xt,e.queryCache||new Ru),D(this,en,e.mutationCache||new xu),D(this,tn,e.defaultOptions||{}),D(this,Ri,new Map),D(this,vi,new Map),D(this,rn,0);}mount(){qi(this,rn)._++,u(this,rn)===1&&(D(this,Ii,yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,xt).onFocus());})),D(this,Pi,wi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,xt).onOnline());})));}unmount(){var e,t;qi(this,rn)._--,u(this,rn)===0&&((e=u(this,Ii))==null||e.call(this),D(this,Ii,void 0),(t=u(this,Pi))==null||t.call(this),D(this,Pi,void 0));}isFetching(e){return u(this,xt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return u(this,en).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,xt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=u(this,xt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return u(this,xt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=u(this,xt).get(o.queryHash)?.state.data,s=ou(t,i);if(s!==void 0)return u(this,xt).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return ut.batch(()=>u(this,xt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,xt).get(t.queryHash)?.state}removeQueries(e){let t=u(this,xt);ut.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=u(this,xt);return ut.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=ut.batch(()=>u(this,xt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(At).catch(At)}invalidateQueries(e,t={}){return ut.batch(()=>(u(this,xt).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=ut.batch(()=>u(this,xt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(At)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(At)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=u(this,xt).build(this,t);return r.isStaleByTime(zr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e.behavior=tc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e.behavior=tc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return wi.isOnline()?u(this,en).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(this,xt)}getMutationCache(){return u(this,en)}getDefaultOptions(){return u(this,tn)}setDefaultOptions(e){D(this,tn,e);}setQueryDefaults(e,t){u(this,Ri).set(Fn(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...u(this,Ri).values()],r={};return t.forEach(o=>{Ln(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){u(this,vi).set(Fn(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...u(this,vi).values()],r={};return t.forEach(o=>{Ln(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(this,tn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=us(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===Vn&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(this,tn).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){u(this,xt).clear(),u(this,en).clear();}},xt=new WeakMap,en=new WeakMap,tn=new WeakMap,Ri=new WeakMap,vi=new WeakMap,rn=new WeakMap,Ii=new WeakMap,Pi=new WeakMap,vu);var oc=on__namespace.createContext(void 0),nc=e=>{let t=on__namespace.useContext(oc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ic=({client:e,children:t})=>(on__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(oc.Provider,{value:e,children:t}));var Iu=on__namespace.createContext(false),Pu=()=>on__namespace.useContext(Iu);Iu.Provider;function Df(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Ff=on__namespace.createContext(Df()),Ou=()=>on__namespace.useContext(Ff);var Fu=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Ta(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Vu=e=>{on__namespace.useEffect(()=>{e.clearReset();},[e]);},Lu=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Ta(r,[e.error,o]));var Bu=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));}},Wu=(e,t)=>e.isLoading&&e.isFetching&&!t,Au=(e,t)=>e?.suspense&&t.isPending,sc=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Eu(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=Pu(),n=Ou(),i=nc(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",Bu(s),Fu(s,n,a),Vu(n);let l=!i.getQueryCache().get(s.queryHash),[d]=on__namespace.useState(()=>new t(i,s)),c=d.getOptimisticResult(s),g=!o&&e.subscribed!==false;if(on__namespace.useSyncExternalStore(on__namespace.useCallback(w=>{let f=g?d.subscribe(ut.batchCalls(w)):At;return d.updateResult(),f},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),on__namespace.useEffect(()=>{d.setOptions(s);},[s,d]),Au(s,c))throw sc(s,d,n);if(Lu({result:c,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!to.isServer()&&Wu(c,o)&&(l?sc(s,d,n):a?.promise)?.catch(At).finally(()=>{d.updateResult();}),s.notifyOnChangeProps?c:d.trackResult(c)}function xo(e,t){return Eu(e,Xl)}function Di({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=on.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),d=on.useMemo(()=>{let f=o?.[l];return bl(l,f,r)},[l,o,r]),c=on.useMemo(()=>Qi(d,s,l),[d,s,l]),g=on.useMemo(()=>i?{regular:i.regular||n,medium:i.medium||n,semibold:i.semibold||n,bold:i.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,i]),w=on.useMemo(()=>({mode:l,colors:d,fonts:g,components:c,isDark:l==="dark"}),[l,d,g,c]);return jsxRuntime.jsx(Cl.Provider,{value:w,children:e})}function Qe({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,showHandle:n=true,heightPercent:i,noPadding:s=false,borderTopLeftRadius:a=24,borderTopRightRadius:l=24}){let{colors:d,components:c}=O(),{height:g}=reactNative.useWindowDimensions(),w=on.useRef(g);w.current=g;let f=on.useRef(new reactNative.Animated.Value(g)).current,y=on.useRef(new reactNative.Animated.Value(0)).current,b=i!=null&&i>=1;on.useEffect(()=>{let S=w.current;e?(f.setValue(S),y.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(f,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(f,{toValue:S,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,f,y]);let m=()=>{o&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:[nn.container,reactNative.Platform.OS==="android"&&{paddingTop:reactNative.StatusBar.currentHeight}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[nn.backdrop,{backgroundColor:"#000000",opacity:y}],pointerEvents:"none"}),!b&&jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:m,children:jsxRuntime.jsx(reactNative.View,{style:nn.backdropTouchArea})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[nn.sheet,{maxHeight:g*.9,backgroundColor:d.background,borderTopLeftRadius:a,borderTopRightRadius:l,overflow:"hidden",transform:[{translateY:f}],shadowColor:c.sheet.shadowColor,shadowOffset:c.sheet.shadowOffset,shadowOpacity:c.sheet.shadowOpacity,shadowRadius:c.sheet.shadowRadius,elevation:c.sheet.elevation,...i&&{height:g*i,maxHeight:g*i},...b&&{paddingBottom:0},...s&&{paddingBottom:0}}],children:[n&&jsxRuntime.jsx(reactNative.View,{style:nn.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[nn.handle,{backgroundColor:d.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[nn.content,i&&nn.contentFlex],children:r})]})]})})}var nn=reactNative.StyleSheet.create({container:{flex:1},backdrop:{...reactNative.StyleSheet.absoluteFillObject},backdropTouchArea:{flex:1},sheet:{paddingBottom:reactNative.Platform.OS==="ios"?34:24},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});var Vi=new Map;function Hu({width:e,height:t,borderRadius:r,color:o}){let n=on.useRef(new reactNative.Animated.Value(.3)).current;return on.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function an({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=O(),[d,c]=on.useState(false),[g,w]=on.useState(false),[f,y]=on.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=Vi.get(e);return x?{uri:e,xml:x}:null}),b=e?.toLowerCase().endsWith(".svg"),m=b&&e&&f?.uri===e?f.xml:null;on.useEffect(()=>{c(false),w(false);},[e]),on.useEffect(()=>{if(!b||!e)return;if(Vi.has(e)){y({uri:e,xml:Vi.get(e)});return}let x=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{x||(Vi.set(e,_),y({uri:e,xml:_}));}).catch(()=>{x||c(true);}),()=>{x=true;}},[e,b]);let S=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:S},a]});let h={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},p=t-n*2,T=r-n*2;return d?jsxRuntime.jsx(reactNative.View,{style:[h,{backgroundColor:s||S}]}):b?jsxRuntime.jsxs(reactNative.View,{style:h,children:[!!!m&&jsxRuntime.jsx(Hu,{width:p,height:T,borderRadius:o,color:S}),m?jsxRuntime.jsx(St.SvgXml,{xml:m,width:p,height:T,onError:()=>c(true)}):jsxRuntime.jsx(St.SvgUri,{uri:e,width:p,height:T,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:h,children:[!g&&jsxRuntime.jsx(Hu,{width:p,height:T,borderRadius:o,color:S}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:p,height:T},resizeMode:"contain",onLoad:()=>w(true),onError:()=>c(true)})]})}function dc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Vi.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Vi.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function cr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:d,balanceChainId:c,balanceTokenAddress:g,publishableKey:w,projectName:f,leftIcon:y,onLeftAction:b}){let{colors:m,fonts:S,components:h}=O(),[p,T]=on.useState(null),[x,_]=on.useState(false),F=on.useState(()=>new reactNative.Animated.Value(0))[0];on.useEffect(()=>{if(!x)return;let C=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(F,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(F,{toValue:0,duration:700,useNativeDriver:true})]));return C.start(),()=>C.stop()},[x,F]),on.useEffect(()=>{if(!a||!l||!d||!c||!g||!w){T(null),_(false);return}let C=false;return _(true),ia(l,d,c,g,w).then(B=>{if(C)return;let E=B.balance,L=null;E&&(E.amount_usd!=null&&E.amount_usd!==""?L=`$${E.amount_usd}`:L="$0.00"),T(L);}).catch(()=>{C||T(null);}).finally(()=>{C||_(false);}),()=>{C=true;}},[a,l,d,c,g,w]);let k=F.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:or.header,children:[jsxRuntime.jsx(reactNative.View,{style:or.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[or.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ki,{size:20,color:h.header.buttonColor,strokeWidth:2})}):y&&b?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:b,style:[or.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:y}):jsxRuntime.jsx(reactNative.View,{style:or.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:or.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:or.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[or.title,{color:h.header.titleColor,fontFamily:S.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[or.titleBadge,{backgroundColor:m.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[or.titleBadgeText,{color:m.foregroundMuted,fontFamily:S.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[or.balanceText,{color:m.foregroundMuted,fontFamily:S.regular}],children:t}):null,a&&(x?jsxRuntime.jsx(reactNative.Animated.View,{style:[or.balanceSkeleton,{backgroundColor:m.cardHover,opacity:k}]}):p!=null?jsxRuntime.jsxs(reactNative.Text,{style:[or.balanceText,{color:m.foregroundMuted,fontFamily:S.regular}],children:[f?`${f} `:"","Balance: ",p]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:or.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[or.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:h.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:or.spacer})})]})}var or=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 Et({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=O(),a=i??s.card,l=a.backShadowColor!=="transparent",d={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},c=[qu.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[d,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[qu.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 qu=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ss({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=O(),s=i.depositMenu.card,a=o?[...o].sort((l,d)=>l.position-d.position):[];return jsxRuntime.jsxs(Et,{cardTokens:s,onPress:e,style:so.wrapper,contentStyle:so.container,children:[jsxRuntime.jsxs(reactNative.View,{style:so.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[so.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Tl,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:so.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[so.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[so.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:so.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:so.networkIcons,children:a.map((l,d)=>{let c=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[so.networkIconWrapper,{marginLeft:d===0?0:-6,zIndex:a.length-d}],children:jsxRuntime.jsx(an,{uri:K(c),width:20,height:20})},l.name)})})})]})}var so=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 xs({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=O(),s=i.depositMenu.card;return jsxRuntime.jsxs(Et,{cardTokens:s,onPress:e,style:_o.wrapper,contentStyle:_o.container,children:[jsxRuntime.jsxs(reactNative.View,{style:_o.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[_o.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sl,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:_o.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[_o.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[_o.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:_o.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:_o.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(d=>d.format==="png")?.url||a.icon_urls.find(d=>d.format==="svg")?.url;return jsxRuntime.jsx(an,{uri:K(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var _o=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 _s({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=O(),s=i.depositMenu.card;return jsxRuntime.jsx(Et,{cardTokens:s,onPress:e,style:Ro.wrapper,contentStyle:Ro.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ro.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ro.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx(jr,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Ro.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ro.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ro.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ro.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ro.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Ro=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 vs({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),i=n.depositMenu.card;return jsxRuntime.jsxs(Et,{cardTokens:i,onPress:e,style:ao.wrapper,contentStyle:ao.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ao.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ao.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Hs,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ao.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ao.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ao.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:ao.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:ao.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[ao.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var ao=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 Yu=1e4,Ju=2500,Zu=3e3,Xu=6e4;function Is(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:i,modalOpenedAt:s,depositWalletId:a,depositExecutions:l,trackedExecutions:d,setDepositExecutions:c,setTrackedExecutions:g,setLatestExecution:w,setShowStatusSheet:f,onDepositSuccess:y,onExecutionsChange:b,onDepositError:m}=e,[S,h]=on.useState(false),[p,T]=on.useState(false);return on.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;h(false),t==="auto_ui"&&T(false);let _=setTimeout(()=>{h(true),t==="auto_ui"&&T(true);},Yu);return ()=>clearTimeout(_)},[t,r,o]),on.useEffect(()=>{if(!n||!s)return;let _=new Date(s.getTime()-Xu),F=setInterval(async()=>{try{let B=[...(await Co(n,i)).data??[]].sort((L,R)=>{let H=L.created_at?new Date(L.created_at).getTime():0;return (R.created_at?new Date(R.created_at).getTime():0)-H}),E=null;for(let L of B){let R=L.created_at?new Date(L.created_at):null;if(!R||R<=_)continue;let H=d.get(L.id);if(!H){E=L;break}if(["pending","waiting","delayed"].includes(H)&&L.status==="succeeded"){E=L;break}}if(E){let L=E;c(R=>{let H=R.findIndex(V=>V.id===L.id);if(H>=0){let V=[...R];return V[H]=L,V}return [...R,L]}),g(R=>{let H=new Map(R);return H.set(L.id,L.status),H}),w(L),f(!0),L.status==="succeeded"&&y?.({message:"Deposit completed successfully",executionId:L.id}),b?.([...l,L]);}}catch(k){m?.({message:"Failed to check deposit status",error:k});}},Ju);return ()=>clearInterval(F)},[n,i,s,d,l,b,y,m]),on.useEffect(()=>{if(!S||!a)return;let _=async()=>{try{await ta(a,i);}catch{}};_();let F=setInterval(_,Zu);return ()=>clearInterval(F)},[S,a,i]),{pollingEnabled:S,showWaitingUi:p,handleIveDeposited:()=>{h(true),T(true);}}}function Ai({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:i,isDark:s}=O(),a=s?"#1a1a1a":"#ffffff",l=s?"#ffffff":"#000000",d=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[tp.container,{width:t,height:t}],children:[jsxRuntime.jsx(Xf__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[tp.logoContainer,{width:o+12,height:o+12,backgroundColor:d,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(an,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var tp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function np(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function oh(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=s<10?`0${s}`:s;return `${r} ${o}, ${n} at ${i}:${l}${a}`}function Ei({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:d}){let{colors:c,fonts:g,components:w}=O(),[f,y]=on.useState(false),b=t==="pending"||t==="waiting"||t==="delayed",m=t==="succeeded",S=()=>{o&&reactNative.Linking.openURL(o);},h=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(Qe,{visible:e,onClose:a,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:d,children:jsxRuntime.jsxs(reactNative.View,{style:bt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:bt.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:w.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:bt.iconContainer,children:b?jsxRuntime.jsx(it,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:K(r)},style:bt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[bt.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:K(r)},style:bt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[bt.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[bt.statusBadge,{backgroundColor:w.container.iconBackgroundColor}],children:jsxRuntime.jsx(Ae,{size:16,color:w.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[bt.title,{color:w.container.titleColor,fontFamily:g.semibold}],children:b?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[bt.amount,{color:w.container.titleColor,fontFamily:g.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsxRuntime.jsx(reactNative.Text,{style:[bt.date,{color:w.container.subtitleColor,fontFamily:g.regular}],children:oh(i)}),jsxRuntime.jsx(reactNative.Text,{style:[bt.subtitle,{color:w.container.subtitleColor,fontFamily:g.regular}],children:b?"This usually takes less than a minute.":"Your account has been credited successfully!"}),m&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:bt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[bt.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:bt.detailsToggle,onPress:()=>y(!f),children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.detailsToggleText,{color:w.container.actionTitle,fontFamily:g.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(qr,{size:18,color:w.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(yt,{size:18,color:w.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:bt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[bt.txButton,{backgroundColor:w.card.backgroundColor,borderColor:c.border}],onPress:S,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.txLabel,{color:w.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.txHash,{color:w.card.subtitleColor,fontFamily:g.regular}],children:np(o)}),jsxRuntime.jsx($r,{size:16,color:w.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[bt.txButton,{backgroundColor:w.card.backgroundColor,borderColor:c.border}],onPress:h,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.txLabel,{color:w.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.txHash,{color:w.card.subtitleColor,fontFamily:g.regular}],children:np(n)}),jsxRuntime.jsx($r,{size:16,color:w.card.actionColor,strokeWidth:2})]})]})]})]})})}var bt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function Va({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:i,fonts:s,components:a}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[qn.iveDepositedButton,{backgroundColor:i.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[qn.iveDepositedButtonText,{color:i.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[qn.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[qn.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(kl,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qn.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[qn.processingCardTitle,{color:a.card.titleColor,fontFamily:s.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[qn.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:s.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var qn=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var Ps=(e,t)=>`${t}:${e}`,ph=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Ba({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:w,onDepositError:f,borderTopLeftRadius:y,borderTopRightRadius:b,sheetBorderRadius:m}){let{colors:S,fonts:h,components:p}=O(),T=a&&l?`${a}:${l}`:"solana:mainnet",[x,_]=on.useState("USDC"),[F,k]=on.useState(T),[C,B]=on.useState([]),[E,L]=on.useState(true),[R,H]=on.useState([]),[V,we]=on.useState(true),[We,Xe]=on.useState(false),[ee,ye]=on.useState(false),[ze,Fe]=on.useState(false),[Ue,ie]=on.useState(false),[Ge,Ve]=on.useState([]),[Ye,dt]=on.useState(new Map),[at]=on.useState(()=>new Date),[ht,He]=on.useState(null),[Lt,J]=on.useState(false),[q,Te]=on.useState(null),[wt,he]=on.useState(false),_e=new Map;R.forEach(U=>{U.chains.forEach(Z=>{let pe=`${Z.chain_type}:${Z.chain_id}`;_e.has(pe)||_e.set(pe,Z);});});let Je=Array.from(_e.values()),mt=ph(F),et=Je.find(U=>U.chain_type===mt.chainType&&U.chain_id===mt.chainId)?.chain_type||"ethereum",Ht=bo(C,et),lt=Ht?.address||"",Re=on.useRef(false);on.useEffect(()=>{async function U(){try{we(!0),He(null);let pe=await kn(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(H(pe.data),pe.data.length>0&&!Re.current){Re.current=!0;let oe,X;if(a&&l)if(d)for(let ce of pe.data){let nt=ce.chains.find(Xt=>Xt.chain_type===a&&Xt.chain_id===l&&Xt.token_address.toLowerCase()===d.toLowerCase());if(nt){oe=ce,X=nt;break}}else for(let ce of pe.data){let nt=ce.chains.find(Xt=>Xt.chain_type===a&&Xt.chain_id===l);if(nt){oe=ce,X=nt;break}}if(!oe&&i)for(let ce of pe.data){let nt=ce.chains.find(Xt=>Xt.token_address.toLowerCase()===i.toLowerCase());if(nt){oe=ce,X=nt;break}}oe||(oe=pe.data.find(ce=>ce.symbol==="USDC"),oe&&oe.chains.length>0&&(X=oe.chains[0])),oe||(oe=pe.data.find(ce=>ce.symbol==="USDT"),oe&&oe.chains.length>0&&(X=oe.chains[0])),oe||(oe=pe.data[0],oe.chains.length>0&&(X=oe.chains[0])),oe&&_(oe.symbol),X&&k(Ps(X.chain_id,X.chain_type));}}catch(Z){console.error("Error fetching supported tokens:",Z),He("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:Z});}finally{we(false);}}U();},[t,f,a,l,d,i,n,o]),on.useEffect(()=>{async function U(){try{L(!0),He(null);let Z=await yo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);B(Z.data);}catch(Z){console.error("Error fetching wallets:",Z),He("Failed to load wallets"),f?.({message:"Failed to load wallets",error:Z});}finally{L(false);}}U();},[e,r,o,n,i,t,f]);let Nt=Ht?.id??"",{showWaitingUi:Bt,handleIveDeposited:Cr}=Is({depositConfirmationMode:c,depositAddress:lt,chain:F,externalUserId:e,publishableKey:t,modalOpenedAt:at,depositWalletId:Nt,depositExecutions:Ge,trackedExecutions:Ye,setDepositExecutions:Ve,setTrackedExecutions:dt,setLatestExecution:Te,setShowStatusSheet:J,onDepositSuccess:w,onExecutionsChange:g,onDepositError:f});on.useEffect(()=>{if(!R.length)return;let U=R.find(pe=>pe.symbol===x);if(!U||U.chains.length===0)return;if(!U.chains.some(pe=>Ps(pe.chain_id,pe.chain_type)===F)){let pe=U.chains[0];k(Ps(pe.chain_id,pe.chain_type));}},[x,R,F]);let xe=R.find(U=>U.symbol===x),je=xe?.chains||[],$e=je.find(U=>Ps(U.chain_id,U.chain_type)===F),ur=async()=>{if(lt)try{reactNative.Clipboard.setString(lt),Xe(!0),setTimeout(()=>Xe(!1),2e3);}catch(U){console.error("Failed to copy:",U);}},N=$e?.estimated_price_impact_percent??0,re=$e?.max_slippage_percent??.25,ue=$e?.minimum_deposit_amount_usd??3;if(V)return jsxRuntime.jsxs(reactNative.View,{style:I.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[I.loadingText,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Loading currencies..."})]});if(ht&&R.length===0)return jsxRuntime.jsxs(reactNative.View,{style:I.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[I.errorText,{color:S.error,fontFamily:h.regular}],children:ht}),jsxRuntime.jsx(reactNative.Text,{style:[I.errorHint,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Please check your network connection and try again."})]});let le=()=>jsxRuntime.jsxs(Qe,{visible:ze,onClose:()=>Fe(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??y,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??b,children:[jsxRuntime.jsxs(reactNative.View,{style:[I.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:I.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[I.sheetTitle,{color:p.header.titleColor,fontFamily:h.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Fe(false),style:I.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:I.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:R.map(U=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(U.symbol),Fe(false);},activeOpacity:.7,style:[I.sheetItem,{backgroundColor:x===U.symbol?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(U,"png"))},style:I.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:I.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[I.sheetItemTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:U.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[I.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:h.regular}],children:[U.chains.length," network",U.chains.length!==1?"s":""," available"]})]}),x===U.symbol&&jsxRuntime.jsx(Ae,{size:20,color:S.primary,strokeWidth:2})]},U.symbol))})]}),Le=()=>jsxRuntime.jsxs(Qe,{visible:Ue,onClose:()=>ie(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??y,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??b,children:[jsxRuntime.jsxs(reactNative.View,{style:[I.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:I.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[I.sheetTitle,{color:p.header.titleColor,fontFamily:h.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ie(false),style:I.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:I.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:je.map(U=>{let Z=Ps(U.chain_id,U.chain_type),pe=F===Z;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k(Z),ie(false);},activeOpacity:.7,style:[I.sheetItem,{backgroundColor:pe?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(U,"png"))},style:I.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:I.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[I.sheetItemTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:U.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[I.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:h.regular}],children:["Min deposit: $",U.minimum_deposit_amount_usd]})]}),pe&&jsxRuntime.jsx(Ae,{size:20,color:S.primary,strokeWidth:2})]},Z)})})]});return jsxRuntime.jsxs(reactNative.View,{style:I.container,children:[jsxRuntime.jsxs(reactNative.View,{style:I.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[I.selectorLabel,{color:p.card.labelColor,fontFamily:h.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Fe(true),style:[I.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[xe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(xe,"png"))},style:I.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[I.selectorText,{color:p.card.titleColor,fontFamily:h.medium}],children:x}),jsxRuntime.jsx(yt,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:I.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[I.selectorLabel,{color:p.card.labelColor,fontFamily:h.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[I.minDeposit,{fontFamily:h.regular}],children:["($",ue," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ie(true),style:[I.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[$e&&jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae($e,"png"))},style:I.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[I.selectorText,{color:p.card.titleColor,fontFamily:h.medium}],numberOfLines:1,children:$e?.chain_name||"Select network"}),jsxRuntime.jsx(yt,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:I.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[I.qrWrapper,{backgroundColor:S.background,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth>0?p.card.borderWidth:1,borderColor:p.card.borderColor}],children:E?jsxRuntime.jsxs(reactNative.View,{style:I.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[I.loadingText,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Loading..."})]}):lt?jsxRuntime.jsx(Ai,{value:lt,size:160,logoUri:K(ae($e,"png")||Mt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:I.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[I.errorText,{color:S.error,fontFamily:h.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:I.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:I.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[I.addressLabel,{color:p.card.labelColor,fontFamily:h.medium}],children:"Deposit Address"}),We&&jsxRuntime.jsxs(reactNative.View,{style:I.copiedIndicator,children:[jsxRuntime.jsx(Ae,{size:14,color:S.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[I.copiedText,{color:S.success,fontFamily:h.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Et,{cardTokens:p.transferCrypto.depositAddress.card,onPress:!E&&lt?ur:void 0,contentStyle:I.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[I.addressText,{color:p.card.titleColor,fontFamily:h.regular}],numberOfLines:2,children:E?"Loading...":lt||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:I.addressCopyIcon,children:jsxRuntime.jsx(Cn,{size:16,color:p.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[I.detailsCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(!ee),style:I.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:I.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[I.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[I.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:I.chevronContainer,children:ee?jsxRuntime.jsx(qr,{size:16,color:p.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(yt,{size:16,color:p.card.actionColor,strokeWidth:2})})]}),ee&&jsxRuntime.jsxs(reactNative.View,{style:I.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:I.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[I.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ho,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[I.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:["Price impact: ",N.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:I.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[I.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[I.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:["Slippage: Auto \u2022 ",re.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:I.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[I.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zs,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[I.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Va,{depositConfirmationMode:c,depositAddress:lt,showWaitingUi:Bt,latestExecution:q,onIveDeposited:Cr}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:I.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[I.termsText,{color:S.primary,fontFamily:h.regular}],children:"Terms apply"})}),le(),Le(),jsxRuntime.jsxs(Qe,{visible:wt,onClose:()=>he(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:m?.infoSheet?.borderTopLeftRadius??y,borderTopRightRadius:m?.infoSheet?.borderTopRightRadius??b,children:[jsxRuntime.jsxs(reactNative.View,{style:[I.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:I.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[I.sheetTitle,{color:p.header.titleColor,fontFamily:h.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(false),style:I.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:I.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[I.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:I.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[I.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ho,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[I.infoCardTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[I.infoCardValue,{color:p.card.titleColor,fontFamily:h.medium}],children:[N.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[I.infoCardDescription,{color:p.card.descriptionColor,fontFamily:h.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:[I.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:I.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[I.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[I.infoCardTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[I.infoCardValue,{color:p.card.titleColor,fontFamily:h.medium}],children:[re.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[I.infoCardDescription,{color:p.card.descriptionColor,fontFamily:h.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."})]})]})]}),q&&jsxRuntime.jsx(Ei,{visible:Lt,status:q.status,tokenIconUrl:q.destination_token_metadata?.icon_urls?.find(U=>U.format==="png")?.url||q.destination_token_metadata?.icon_url||ae(xe,"png"),explorerUrl:q.explorer_url,completionExplorerUrl:q.destination_explorer_url,date:q.created_at?new Date(q.created_at):void 0,amountUsd:q.source_amount_usd?parseFloat(q.source_amount_usd):void 0,onClose:()=>J(false),borderTopLeftRadius:m?.depositStatus?.borderTopLeftRadius??y,borderTopRightRadius:m?.depositStatus?.borderTopRightRadius??b})]})}var I=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:{maxHeight:400,paddingTop:8},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 Wa({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Qn.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(e,"png"))},style:Qn.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Ae,{size:16,color:o.primary,strokeWidth:2})]})}var Qn=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 Ds({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:cp.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[cp.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(Wa,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var cp=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Ea({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:d,components:c}=O(),[g,w]=on.useState(""),f=o.map(T=>r.find(x=>x.currency_code.toLowerCase()===T.toLowerCase())).filter(T=>T!==void 0),y=r.filter(T=>!o.includes(T.currency_code.toLowerCase())),b=T=>{if(!g)return T;let x=g.toLowerCase();return T.filter(_=>_.name.toLowerCase().includes(x)||_.currency_code.toLowerCase().includes(x))},m=b(f),S=b(y),h=T=>{i(T),t(false),w("");},p=()=>{t(false),w("");};return jsxRuntime.jsxs(Qe,{visible:e,onClose:p,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(cr,{title:"Currency",showBack:false,onClose:p}),jsxRuntime.jsx(reactNative.View,{style:Kn.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Kn.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:d.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:g,onChangeText:w,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Kn.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Kn.listContent,children:[jsxRuntime.jsx(Ds,{title:"Popular currencies",currencies:m,selectedCurrency:n,onSelect:h}),m.length>0&&S.length>0&&jsxRuntime.jsx(reactNative.View,{style:Kn.sectionSpacer}),jsxRuntime.jsx(Ds,{title:"All currencies",currencies:S,selectedCurrency:n,onSelect:h}),m.length===0&&S.length===0&&jsxRuntime.jsx(reactNative.View,{style:Kn.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Kn.noResultsText,{color:c.container.subtitleColor,fontFamily:d.regular}],children:"No currencies found"})})]})})]})}var Kn=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:24},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Dc(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 Ua({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:d,onDepositError:c,borderTopLeftRadius:g,borderTopRightRadius:w,sheetBorderRadius:f}){let{colors:y,fonts:b,components:m}=O(),[S,h]=on.useState(""),[p,T]=on.useState("usd"),[x,_]=on.useState(false),[F,k]=on.useState(false),[C,B]=on.useState([]),[E,L]=on.useState(false),[R,H]=on.useState(null),[V,we]=on.useState(null),[We,Xe]=on.useState("amount"),[ee,ye]=on.useState(null),[ze,Fe]=on.useState(true),[Ue,ie]=on.useState(null),[Ge,Ve]=on.useState(false),Ye=on.useRef(null),dt=on.useRef(false);on.useEffect(()=>{Ye.current=ee;},[ee]),on.useEffect(()=>{dt.current=Ge;},[Ge]);let[at,ht]=on.useState([]),[He,Lt]=on.useState(true),[J,q]=on.useState(60),[Te,wt]=on.useState([]),[he,_e]=on.useState([]),[Je,mt]=on.useState(null),[Se,et]=on.useState(null),[Ht,lt]=on.useState(true),[Re,Nt]=on.useState(null),[Bt,Cr]=on.useState(false),[xe,je]=on.useState(null),[$e,ur]=on.useState(false),[N,re]=on.useState(false),[ue,le]=on.useState(false),[Le,U]=on.useState(null),Z=r??We,pe=on.useRef(null),oe=Te.find(v=>v.currency_code.toLowerCase()===p.toLowerCase()),X=on.useCallback(v=>{Xe(v),v==="quotes"?o?.(v,C.length):o?.(v);},[C.length,o]);on.useEffect(()=>{async function v(){try{let M=await rs();et(M);}catch(M){console.error("Error fetching user IP:",M);}finally{lt(false);}}v();},[]),on.useEffect(()=>{async function v(){try{let M=await yo({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);ht(M.data);}catch(M){console.error("Error fetching wallets:",M),H("Failed to load wallet addresses");}finally{Lt(false);}}v();},[e,i,s,a,l,t]);let ce=n||Je?.symbol.toUpperCase()||"USDC",nt=ci(Je?.icon_urls,"png")||Je?.icon_url,Xt=ci(Je?.chain_icon_urls,"png")||Je?.chain_icon_url;on.useEffect(()=>{async function v(){try{let M=await Wl(t);wt(M.data),_e(M.preferred||[]);}catch(M){console.error("Error fetching fiat currencies:",M);}}v();},[t]),on.useEffect(()=>{if(x||Te.length===0||!Se?.alpha2)return;let v=Se.alpha2.toUpperCase(),M=Te.find(ke=>ke.country_codes.includes(v));if(M)T(M.currency_code.toLowerCase()),!S&&!F&&h(String(M.default_amount??100));else if(!S&&!F){let ke=Te.find(gt=>gt.currency_code.toLowerCase()==="usd");ke&&h(String(ke.default_amount??100));}},[Te,Se,x,S,F]),on.useEffect(()=>{if(Te.length!==0){if(pe.current!==null&&pe.current!==p){let v=Te.find(M=>M.currency_code.toLowerCase()===p.toLowerCase());v&&h(String(v.default_amount??100));}pe.current=p;}},[p,Te]),on.useEffect(()=>{async function v(){try{let M=await Fl({chain_type:s||"",chain_id:a||"",token_address:l||""},t);mt(M);}catch(M){console.error("Error fetching supported tokens:",M);}}v();},[s,a,l,t]),on.useEffect(()=>{async function v(){if(!(!l||!a||!s)&&!Ht){Cr(true);try{let M=await Bl({country_code:Se?.alpha2?.toUpperCase()||"US",subdivision_code:Se?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);Nt(M);}catch(M){console.error("Error fetching default onramp token:",M);}finally{Cr(false);}}}v();},[l,a,s,Se,Ht,t]),on.useEffect(()=>{let v=parseFloat(S);if(isNaN(v)||v<=0){B([]),we(null);return}if(!Re||Bt){B([]),ye(null);return}let M=Te.find(gt=>gt.currency_code.toLowerCase()===p.toLowerCase());if(M){if(v<M.minimum_amount){B([]),ye(null),we(`Minimum amount is ${Dc(p)}${M.minimum_amount.toLocaleString()}`);return}if(v>M.maximum_amount){B([]),ye(null),we(`Maximum amount is ${Dc(p)}${M.maximum_amount.toLocaleString()}`);return}}we(null);let ke=setTimeout(()=>{bn(v);},500);return ()=>clearTimeout(ke)},[S,p,t,Re,Bt,Te]);let bn=async v=>{if(!Re){H("Loading token information...");return}L(true),H(null);try{let M={country_code:Se?.alpha2?.toUpperCase()||"US",source_amount:v.toString(),source_currency:p.toLowerCase(),destination_currency:Re.destination_currency,destination_network:Re.destination_network,subdivision_code:Se?.state||void 0},ke=await Vl(M,t);B(ke.data);let gt=dt.current,zo=Ye.current;if(gt&&zo){let wr=ke.data.find(ir=>ir.service_provider===zo.service_provider);if(wr){if(ye(wr),ke.data.length>0){let ir=ke.data.reduce((Tt,Uo)=>Uo.destination_amount>Tt.destination_amount?Uo:Tt);Ue||ie(ir.service_provider),Fe(wr.service_provider===Ue);}}else if(ke.data.length>0){let ir=ke.data.reduce((Tt,Uo)=>Uo.destination_amount>Tt.destination_amount?Uo:Tt);ye(ir),ie(ir.service_provider),Fe(!0),Ve(!1);}}else if(ke.data.length>0){let wr=ke.data.reduce((ir,Tt)=>Tt.destination_amount>ir.destination_amount?Tt:ir);ye(wr),ie(wr.service_provider),Fe(!0);}q(60);}catch(M){console.error("Failed to fetch quotes:",M),H("Failed to fetch quotes. Please try again."),B([]);}finally{L(false);}};on.useEffect(()=>{if(C.length===0)return;let v=setInterval(()=>{q(M=>{if(M<=1){let ke=parseFloat(S);return !isNaN(ke)&&ke>0&&bn(ke),60}return M-1});},1e3);return ()=>clearInterval(v)},[C.length,S]);let ul=v=>{(/^\d*\.?\d{0,2}$/.test(v)||v==="")&&(h(v),k(true));},pl=v=>{h(v.toString()),k(true);},ml=async()=>{if(ee&&Re)try{let v=Re.destination_token_metadata.chain_type,M=bo(at,v);if(!M?.address){H("Wallet address not available");return}let ke={service_provider:ee.service_provider,country_code:ee.country_code?.toUpperCase()||Se?.alpha2?.toUpperCase()||"US",source_currency:ee.source_currency,source_amount:S,destination_currency:ee.destination_currency,destination_network:ee.destination_network,wallet_address:M.address,subdivision_code:Se?.state||void 0},gt=await Ll(ke,t);je({provider:ee,sourceCurrency:p,sourceAmount:S,sessionUrl:gt.url}),U(gt.url),le(!0);}catch(v){console.error("Failed to create session:",v),H("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:v});}},P=Dc(p),Y=()=>{le(false),X("onramp"),d?.({message:"Payment flow completed"});},ne=()=>jsxRuntime.jsx(vh,{visible:ue,onClose:Y,url:Le,providerName:ee?.service_provider_display_name||"Complete Payment",colors:y,fonts:b,borderTopLeftRadius:f?.webView?.borderTopLeftRadius??g,borderTopRightRadius:f?.webView?.borderTopRightRadius??w});return Z==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:z.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:z.scrollContainer,contentContainerStyle:z.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:z.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ur(true),style:[z.currencyButton,{backgroundColor:m.card.backgroundColor,borderRadius:m.input.borderRadius,borderWidth:m.input.borderWidth,borderColor:m.input.borderColor}],children:[oe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(oe,"png"))},style:z.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[z.currencyText,{color:m.card.titleColor,fontFamily:b.medium}],children:p.toUpperCase()}),jsxRuntime.jsx(yt,{size:16,color:m.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Ea,{open:$e,onOpenChange:ur,currencies:Te,preferredCurrencyCodes:he,selectedCurrency:p,onSelectCurrency:v=>{T(v.toLowerCase()),_(true);},borderTopLeftRadius:f?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:f?.currencyModal?.borderTopRightRadius??w}),jsxRuntime.jsx(reactNative.View,{style:z.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:z.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.currencySymbol,{color:m.container.titleColor,fontFamily:b.medium}],children:P}),jsxRuntime.jsx(reactNative.TextInput,{style:[z.amountInput,{color:m.container.titleColor,fontFamily:b.medium}],value:S,onChangeText:ul,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:y.foregroundMuted})]})}),oe?.suggested_amounts&&oe.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:z.quickAmounts,children:oe.suggested_amounts.map(v=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>pl(v),style:[z.quickAmountButton,{backgroundColor:m.card.backgroundColor,borderRadius:m.button.borderRadius,borderWidth:parseFloat(S)===v?2:m.button.borderWidth,borderColor:parseFloat(S)===v?y.primary:m.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[z.quickAmountText,{color:m.card.titleColor,fontFamily:b.medium}],children:[P,v.toLocaleString()]})},v))}),V&&jsxRuntime.jsx(reactNative.Text,{style:[z.validationError,{color:y.error,fontFamily:b.regular}],children:V}),jsxRuntime.jsxs(reactNative.View,{style:z.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:z.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.providerLabel,{color:m.card.labelColor,fontFamily:b.medium}],children:"Provider"}),C.length>0&&!E&&jsxRuntime.jsxs(reactNative.Text,{style:[z.refreshText,{color:m.card.labelRightColor,fontFamily:b.regular}],children:["Refreshing in ",J,"s"]})]}),jsxRuntime.jsx(Et,{cardTokens:m.depositCard.quoteProvider.card,onPress:E||C.length===0?void 0:()=>re(true),contentStyle:reactNative.StyleSheet.flatten([z.providerButton,(E||C.length===0)&&z.disabled]),children:E?jsxRuntime.jsxs(reactNative.View,{style:z.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:m.container.subtitleColor,fontFamily:b.regular}],children:"Finding best rates..."})]}):ee?jsxRuntime.jsxs(reactNative.View,{style:z.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:z.providerInfo,children:[ze&&jsxRuntime.jsx(reactNative.Text,{style:[z.autoPickedText,{color:m.container.subtitleColor,fontFamily:b.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:z.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ra(ee.icon_urls,"png",ee.icon_url))},style:z.providerIconImage},`provider-${ee.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[z.providerName,{color:m.card.titleColor,fontFamily:b.medium}],children:ee.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[z.bestPriceText,{color:y.success,fontFamily:b.regular}],children:["Best price \u2022 ",ee.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Br,{size:20,color:m.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[z.noProviderText,{color:m.container.subtitleColor,fontFamily:b.regular}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),R&&jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:y.error,fontFamily:b.regular}],children:R})]}),jsxRuntime.jsxs(Qe,{visible:N,onClose:()=>re(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:f?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:f?.providerModal?.borderTopRightRadius??w,children:[jsxRuntime.jsx(cr,{title:"Select Provider",showBack:false,onClose:()=>re(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:z.providerModalList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsx(reactNative.View,{style:z.quotesList,children:[...C].sort((v,M)=>M.destination_amount-v.destination_amount).map((v,M)=>{let ke=ee?.service_provider===v.service_provider,gt=M===0;return jsxRuntime.jsxs(Et,{cardTokens:m.depositCard.quoteProvider.card,onPress:()=>{ye(v),Ve(true),Fe(v.service_provider===Ue),re(false);},contentStyle:reactNative.StyleSheet.flatten([z.quoteItem,ke&&{borderWidth:2,borderColor:y.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:z.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ra(v.icon_urls,"png",v.icon_url))},style:z.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[z.quoteName,{color:m.card.titleColor,fontFamily:b.medium}],children:v.service_provider_display_name}),gt&&jsxRuntime.jsx(reactNative.Text,{style:[z.bestPriceLabel,{color:y.success,fontFamily:b.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:z.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[z.quoteAmount,{color:m.card.textRightColor,fontFamily:b.medium}],children:[v.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[z.quoteSource,{color:m.card.subtextRightColor,fontFamily:b.regular}],children:["Fee: ",P,v.total_fee.toFixed(2)]})]})]},v.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[z.continueButtonContainer,{backgroundColor:y.background}],children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:ml,disabled:E||He||!ee||parseFloat(S)<=0,style:[z.continueButton,{backgroundColor:m.container.buttonColor,borderRadius:m.button.borderRadius,borderWidth:m.button.borderWidth,borderColor:m.button.borderColor},(E||He||!ee)&&z.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:[z.continueButtonText,{color:m.container.buttonTitleColor,fontFamily:b.medium}],children:He?"Loading...":"Continue"})})})]}),ne()]}):Z==="onramp"&&xe?jsxRuntime.jsxs(reactNative.View,{style:z.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ra(xe.provider.icon_urls,"png",xe.provider.icon_url))},style:z.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[z.onrampTitle,{color:m.container.titleColor,fontFamily:b.medium}],children:["Complete transaction with ",xe.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[z.onrampSubtitle,{color:m.container.subtitleColor,fontFamily:b.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[z.flowDiagram,{backgroundColor:m.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Mt(`/icons/currencies/png/${xe.sourceCurrency.toLowerCase()}.png`)},style:z.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowLabel,{color:m.card.subtitleColor,fontFamily:b.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowValue,{color:m.card.titleColor,fontFamily:b.medium}],children:xe.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Br,{size:16,color:m.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:z.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:z.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ci(Re?.destination_token_metadata?.icon_urls,"png")||Re?.destination_token_metadata?.icon_url||Mt("/icons/tokens/png/usdc.png")},style:z.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ci(Re?.destination_token_metadata?.chain?.icon_urls,"png")||Re?.destination_token_metadata?.chain?.icon_url||Mt("/icons/networks/png/polygon.png")},style:[z.flowNetworkBadge,{borderColor:y.background,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowLabel,{color:m.card.subtitleColor,fontFamily:b.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowValue,{color:m.card.titleColor,fontFamily:b.medium}],children:"USDC"})]}),jsxRuntime.jsx(Br,{size:16,color:m.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:z.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:z.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:nt||Mt("/icons/tokens/png/usdc.png")},style:z.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Xt||Mt("/icons/networks/png/polygon.png")},style:[z.flowNetworkBadge,{borderColor:y.background,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowLabel,{color:m.card.subtitleColor,fontFamily:b.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowValue,{color:m.card.titleColor,fontFamily:b.medium}],children:ce})]})]}),jsxRuntime.jsx(reactNative.View,{style:[z.onrampInfoBox,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[z.onrampInfoText,{color:m.card.descriptionColor,fontFamily:b.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 vh({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(Qe,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Gn.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Gn.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ae,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Gn.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Gn.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Gn.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Gn.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Gn.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Gn=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"}}),z=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:24},continueButton:{paddingVertical:16,alignItems:"center"},disabledButton:{opacity:.5},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:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Dh(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 Fh(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ja({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=K(ae(e.destination_token_metadata,"png")||Mt("/icons/tokens/png/usdc.png")),d=s?"Deposit Processing":"Deposit Completed",c=Dh(e.created_at||new Date().toISOString()),g=Fh(e.source_amount_usd);return jsxRuntime.jsxs(Et,{cardTokens:i,onPress:t,contentStyle:Oo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Oo.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Oo.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Oo.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(Us,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ae,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Oo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Oo.title,{color:i.titleColor,fontFamily:o.medium}],children:d}),jsxRuntime.jsx(reactNative.Text,{style:[Oo.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:Oo.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Oo.amount,{color:i.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(Br,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var Oo=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 hp(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 gp(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 Ah(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var yp=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function bp(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Eh(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 qa({visible:e,onClose:t,executions:r,externalUserId:o,publishableKey:n,borderTopLeftRadius:i,borderTopRightRadius:s}){let{height:a}=reactNative.useWindowDimensions(),{colors:l,fonts:d,components:c}=O(),[g,w]=on.useState(r),[f,y]=on.useState(false),[b,m]=on.useState(null),[S,h]=on.useState(false),p=on.useRef(null);on.useEffect(()=>{if(!e||!o)return;let C=async()=>{y(true);try{let L=[...(await Co(o,n)).data].sort((R,H)=>{let V=R.created_at?new Date(R.created_at).getTime():0;return (H.created_at?new Date(H.created_at).getTime():0)-V});w(L);}catch(E){console.error("Failed to fetch executions:",E),w(r);}finally{y(false);}};C();let B=setInterval(C,1e4);return ()=>clearInterval(B)},[e,o,n,r]),on.useEffect(()=>{r.length>0&&w(C=>{let B=new Set(C.map(L=>L.id)),E=r.filter(L=>!B.has(L.id));return E.length>0?[...E,...C]:C});},[r]),on.useEffect(()=>{e||m(null);},[e]);let T=C=>{m(C);},x=()=>{m(null),h(false);},_=()=>{m(null),t();};return jsxRuntime.jsxs(Qe,{visible:e,onClose:_,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(cr,{title:b?"Deposit Details":"Deposit Tracker",onClose:_,showClose:!b,showBack:!!b,onBack:x}),b?(()=>{if(!b)return null;let C=b,B=C.status==="pending"||C.status==="waiting"||C.status==="delayed",E=C.status==="succeeded",L=K(ae(C.destination_token_metadata,"png")||Mt("/icons/tokens/png/usdc.png")),R=C.provider_metadata?.details,H=R?.currencyIn,V=R?.currencyOut;H?.currency?.symbol||"USDC";V?.currency?.symbol||"USDC";let Xe=gp(C.source_amount_base_unit,C.source_token_metadata?.decimals),ee=gp(C.destination_amount_base_unit,C.destination_token_metadata?.decimals),ye=Ah(C.source_amount_usd),ze=hp(C.source_chain_type,C.source_chain_id),Fe=hp(C.destination_chain_type,C.destination_chain_id),Ue=()=>{C.explorer_url&&reactNative.Linking.openURL(C.explorer_url);},ie=()=>{C.destination_explorer_url&&reactNative.Linking.openURL(C.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:p,style:[te.scrollContainer,{maxHeight:a*.7}],contentContainerStyle:te.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:te.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:te.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L},style:te.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[te.statusBadge,{backgroundColor:B?l.warning:l.success,borderColor:l.background}],children:B?jsxRuntime.jsx(yt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Ae,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:te.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[te.statusDot,{backgroundColor:B?l.warning:l.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[te.statusText,{color:c.container.titleColor,fontFamily:d.semibold}],children:B?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[te.dateText,{color:c.container.subtitleColor,fontFamily:d.regular}],children:Eh(C.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[te.card,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:[Xe," ",bp(C.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:[ee," ",bp(C.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:ye})]}),jsxRuntime.jsx(reactNative.View,{style:[te.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:ze})]}),jsxRuntime.jsx(reactNative.View,{style:[te.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:Fe})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ge=!S;h(Ge),Ge?setTimeout(()=>{p.current?.scrollToEnd({animated:true});},100):p.current?.scrollTo({y:0,animated:true});},style:te.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.toggleText,{color:c.container.actionTitle,fontFamily:d.regular}],children:S?"See less":"See more details"}),S?jsxRuntime.jsx(qr,{size:14,color:c.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(yt,{size:14,color:c.container.actionColor,strokeWidth:2})]}),S&&jsxRuntime.jsxs(reactNative.View,{style:[te.card,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[C.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ue,style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:te.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:yp(C.transaction_hash)}),jsxRuntime.jsx($r,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[te.cardDivider,{backgroundColor:l.border}]})]}),C.destination_explorer_url&&E&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ie,style:te.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:te.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:yp(C.destination_transaction_hashes[0])}),jsxRuntime.jsx($r,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:[te.scrollContainer,{maxHeight:a*.7}],contentContainerStyle:te.scrollContent,showsVerticalScrollIndicator:false,children:g.length===0?jsxRuntime.jsxs(reactNative.View,{style:te.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[te.emptyText,{color:c.container.titleColor,fontFamily:d.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[te.emptySubtext,{color:c.container.subtitleColor,fontFamily:d.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:te.executionsList,children:g.map(C=>jsxRuntime.jsx(ja,{execution:C,onPress:()=>T(C)},C.id))})})]})}var te=reactNative.StyleSheet.create({scrollContainer:{paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},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 Fs(e,t=true){let[r,o]=on.useState(null),[n,i]=on.useState(null),[s,a]=on.useState(false),[l,d]=on.useState(false),[c,g]=on.useState(null),[w,f]=on.useState(null);on.useEffect(()=>{!t||r||(a(true),rs().then(S=>{o(S),g(null);}).catch(S=>{g(S instanceof Error?S:new Error(String(S)));}).finally(()=>{a(false);}));},[t,r]),on.useEffect(()=>{!t||!e||n||(d(true),ts(e).then(S=>{i(S),f(null);}).catch(S=>{f(S instanceof Error?S:new Error(String(S)));}).finally(()=>{d(false);}));},[t,e,n]);let y=s||l,b=c||w||null,m=null;if(r&&n){let S=n.blocked_country_codes||[],h=r.alpha2.toUpperCase();m=!S.some(p=>p.toUpperCase()===h);}return {isAllowed:m,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:y,error:b}}var Ac="unifold_recent_tokens",Uh=5,kp=[{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 Ga(){try{let e=await Wc__default.default.getItem(Ac);return e?JSON.parse(e):[]}catch{return []}}async function Hh(e){try{let r=(await Ga()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Uh);await Wc__default.default.setItem(Ac,JSON.stringify(o));}catch{}}async function Nh(e){try{let r=(await Ga()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Wc__default.default.setItem(Ac,JSON.stringify(r)),r}catch{return []}}function Ec({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:d,components:c}=O(),[g,w]=on.useState(""),[f,y]=on.useState([]);on.useEffect(()=>{e&&Ga().then(y);},[e]),on.useEffect(()=>{e||w("");},[e]);let b=on.useMemo(()=>{let x=[];return r.forEach(_=>{_.chains.forEach(F=>{x.push({token:_,chain:F});});}),x},[r]),m=on.useMemo(()=>{let x=[],_=new Set,F=(k,C,B,E)=>{let L=`${k}-${C}:${B}`;if(_.has(L))return;let R=r.find(V=>V.symbol===k);if(!R)return;let H=R.chains.find(V=>V.chain_type===C&&V.chain_id===B);H&&(_.add(L),x.push({token:R,chain:H,isRecent:E}));};return f.forEach(k=>{F(k.symbol,k.chainType,k.chainId,true);}),kp.forEach(k=>{F(k.symbol,k.chainType,k.chainId,false);}),x},[r,f]),S=on.useMemo(()=>{if(!g.trim())return b;let x=g.toLowerCase();return b.filter(({token:_,chain:F})=>_.symbol.toLowerCase().includes(x)||_.name.toLowerCase().includes(x)||F.chain_name.toLowerCase().includes(x))},[b,g]),h=(x,_,F)=>kp.some(k=>k.symbol===x&&k.chainType===_&&k.chainId===F),p=async(x,_)=>{let F=`${_.chain_type}:${_.chain_id}`;if(!h(x.symbol,_.chain_type,_.chain_id)){await Hh({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});let k=await Ga();y(k);}w(""),i(x.symbol,F),t();},T=async(x,_)=>{let F=await Nh({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});y(F);};return jsxRuntime.jsxs(Qe,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.header,children:[jsxRuntime.jsx(reactNative.View,{style:Ke.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.headerTitle,{color:c.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ke.closeButton,children:jsxRuntime.jsx(tt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Ke.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ke.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:d.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:g,onChangeText:w,autoCapitalize:"none",autoCorrect:false})}),m.length>0&&!g&&jsxRuntime.jsxs(reactNative.View,{style:Ke.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.sectionLabel,{color:c.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ke.quickSelectScroll,children:m.map(({token:x,chain:_,isRecent:F})=>{let k=`${_.chain_type}:${_.chain_id}`;x.symbol===o&&k===n;return jsxRuntime.jsxs(reactNative.View,{children:[F&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>T(x,_),style:Ke.removeButton,children:jsxRuntime.jsx(tt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(x,_),activeOpacity:.7,style:[Ke.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(x,"png"))},style:Ke.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(_,"png"))},style:[Ke.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.quickSelectSymbol,{color:c.card.titleColor,fontFamily:d.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.quickSelectChain,{color:c.card.subtitleColor,fontFamily:d.regular}],children:_.chain_name})]})]})]},`quick-${x.symbol}-${k}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.sectionLabel,{color:c.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(reactNative.ScrollView,{style:Ke.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ke.tokenListContent,children:S.length===0?jsxRuntime.jsx(reactNative.View,{style:Ke.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ke.emptyText,{color:l.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):S.map(({token:x,chain:_})=>{let F=`${_.chain_type}:${_.chain_id}`,k=x.symbol===o&&F===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(x,_),activeOpacity:.7,style:[Ke.tokenItem,{backgroundColor:k?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(x,"png"))},style:Ke.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(_,"png"))},style:[Ke.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.tokenSymbol,{color:c.card.titleColor,fontFamily:d.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.tokenChainName,{color:c.card.subtitleColor,fontFamily:d.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Ke.minDeposit,{color:c.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${x.symbol}-${F}`)})})]})}var Ke=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:24,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 Ja=(e,t)=>`${t}:${e}`,Kh=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Mc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:w,onDepositError:f,wallets:y,borderTopLeftRadius:b,borderTopRightRadius:m,sheetBorderRadius:S}){let{colors:h,fonts:p,components:T}=O(),x=a&&l?`${a}:${l}`:"solana:mainnet",[_,F]=on.useState("USDC"),[k,C]=on.useState(x),[B,E]=on.useState([]),[L,R]=on.useState(!y?.length),H=y?.length?y:B,[V,we]=on.useState([]),[We,Xe]=on.useState(true),[ee,ye]=on.useState(false),[ze,Fe]=on.useState(false),[Ue,ie]=on.useState(false),[Ge,Ve]=on.useState([]),[Ye,dt]=on.useState(new Map),[at]=on.useState(()=>new Date),[ht,He]=on.useState(null),[Lt,J]=on.useState(false),[q,Te]=on.useState(null),[wt,he]=on.useState(false),_e=new Map;V.forEach(le=>{le.chains.forEach(Le=>{let U=`${Le.chain_type}:${Le.chain_id}`;_e.has(U)||_e.set(U,Le);});});let Je=Array.from(_e.values()),mt=Kh(k),Se=Je.find(le=>le.chain_type===mt.chainType&&le.chain_id===mt.chainId),et=Se?.chain_type||"ethereum",Ht=bo(H,et),lt=Ht?.address||"",Re=on.useRef(false);on.useEffect(()=>{async function le(){try{Xe(!0),He(null);let U=await kn(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(we(U.data),U.data.length>0&&!Re.current){Re.current=!0;let Z,pe;if(a&&l)if(d)for(let oe of U.data){let X=oe.chains.find(ce=>ce.chain_type===a&&ce.chain_id===l&&ce.token_address.toLowerCase()===d.toLowerCase());if(X){Z=oe,pe=X;break}}else for(let oe of U.data){let X=oe.chains.find(ce=>ce.chain_type===a&&ce.chain_id===l);if(X){Z=oe,pe=X;break}}if(!Z&&i)for(let oe of U.data){let X=oe.chains.find(ce=>ce.token_address.toLowerCase()===i.toLowerCase());if(X){Z=oe,pe=X;break}}Z||(Z=U.data.find(oe=>oe.symbol==="USDC"),Z&&Z.chains.length>0&&(pe=Z.chains[0])),Z||(Z=U.data.find(oe=>oe.symbol==="USDT"),Z&&Z.chains.length>0&&(pe=Z.chains[0])),Z||(Z=U.data[0],Z.chains.length>0&&(pe=Z.chains[0])),Z&&F(Z.symbol),pe&&C(Ja(pe.chain_id,pe.chain_type));}}catch(Le){console.error("Error fetching supported tokens:",Le),He("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:Le});}finally{Xe(false);}}le();},[t,i,n,o,a,l,d,f]),on.useEffect(()=>{g&&g(Ge);},[Ge,g]),on.useEffect(()=>{if(y?.length){R(false);return}if(B.length>0){R(false);return}let le=null,Le=false,U=async()=>{if(!Le){R(true);try{let Z=await yo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);Le||(E(Z.data),He(null),R(!1));}catch(Z){console.error("Error fetching wallets, retrying in 5s:",Z),Le||(He(Z instanceof Error?Z.message:"Failed to load wallets"),R(false),le=setTimeout(U,5e3));}}};return U(),()=>{Le=true,le&&clearTimeout(le);}},[e,r,o,n,i,t,y,B.length]);let Nt=Ht?.id??"",{showWaitingUi:Bt,handleIveDeposited:Cr}=Is({depositConfirmationMode:c,depositAddress:lt,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:at,depositWalletId:Nt,depositExecutions:Ge,trackedExecutions:Ye,setDepositExecutions:Ve,setTrackedExecutions:dt,setLatestExecution:Te,setShowStatusSheet:J,onDepositSuccess:w,onExecutionsChange:g,onDepositError:f});on.useEffect(()=>{if(!V.length)return;let le=V.find(U=>U.symbol===_);if(!le||le.chains.length===0)return;if(!le.chains.some(U=>Ja(U.chain_id,U.chain_type)===k)){let U=le.chains[0];C(Ja(U.chain_id,U.chain_type));}},[_,V,k]);let xe=V.find(le=>le.symbol===_),$e=(xe?.chains||[]).find(le=>Ja(le.chain_id,le.chain_type)===k),ur=async()=>{if(lt)try{reactNative.Clipboard.setString(lt),ye(!0),setTimeout(()=>ye(!1),2e3);}catch(le){console.error("Failed to copy:",le);}},N=$e?.estimated_price_impact_percent??0,re=$e?.max_slippage_percent??.25,ue=$e?.minimum_deposit_amount_usd??3;return We?jsxRuntime.jsxs(reactNative.View,{style:A.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:h.primary}),jsxRuntime.jsx(reactNative.Text,{style:[A.loadingText,{color:h.foregroundMuted,fontFamily:p.regular}],children:"Loading currencies..."})]}):ht&&V.length===0?jsxRuntime.jsxs(reactNative.View,{style:A.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.errorText,{color:h.error,fontFamily:p.regular}],children:ht}),jsxRuntime.jsx(reactNative.Text,{style:[A.errorHint,{color:h.foregroundMuted,fontFamily:p.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:A.container,children:[jsxRuntime.jsxs(reactNative.View,{style:A.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.selectorLabel,{color:T.card.labelColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ie(true),disabled:We||V.length===0,style:[A.tokenSelectorButton,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],activeOpacity:.7,children:We?jsxRuntime.jsxs(reactNative.View,{style:A.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[A.loadingIcon,{backgroundColor:h.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:A.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[A.loadingLine,{backgroundColor:h.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[A.loadingLine,{backgroundColor:h.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:A.tokenIconWrapper,children:[xe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(xe,"png"))},style:A.tokenMainIcon}),($e||Se)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae($e||Se,"png"))},style:[A.tokenChainBadge,{borderColor:T.card.backgroundColor,borderRadius:T.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:A.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.tokenSelectorSymbol,{color:T.card.titleColor,fontFamily:p.semibold}],children:xe?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[A.tokenSelectorNetwork,{color:T.card.subtitleColor,fontFamily:p.regular}],numberOfLines:1,children:$e?.chain_name||Se?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:A.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[A.minDepositText,{color:T.card.labelHighlightRightColor,fontFamily:p.medium}],children:["$",ue," min"]}),jsxRuntime.jsx(Br,{size:16,color:T.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Ec,{visible:Ue,onClose:()=>ie(false),tokens:V,selectedToken:_,selectedChainKey:k,onSelect:(le,Le)=>{F(le),C(Le);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??b,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??m}),jsxRuntime.jsx(reactNative.View,{style:A.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[A.qrWrapper,{backgroundColor:h.background,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth>0?T.card.borderWidth:1,borderColor:T.card.borderColor}],children:L?jsxRuntime.jsxs(reactNative.View,{style:A.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:h.primary}),jsxRuntime.jsx(reactNative.Text,{style:[A.loadingText,{color:h.foregroundMuted,fontFamily:p.regular}],children:"Loading..."})]}):lt?jsxRuntime.jsx(Ai,{value:lt,size:180,logoUri:K(ae($e,"png")||Mt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:A.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[A.errorText,{color:h.error,fontFamily:p.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:A.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:A.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.addressLabel,{color:T.card.labelColor,fontFamily:p.medium}],children:"Deposit Address"}),ee&&jsxRuntime.jsxs(reactNative.View,{style:A.copiedIndicator,children:[jsxRuntime.jsx(Ae,{size:14,color:h.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[A.copiedText,{color:h.success,fontFamily:p.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Et,{cardTokens:T.transferCrypto.depositAddress.card,onPress:!L&&lt?ur:void 0,contentStyle:A.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.addressText,{color:T.card.titleColor,fontFamily:p.regular}],numberOfLines:2,children:L?"Loading...":lt||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:A.addressCopyIcon,children:jsxRuntime.jsx(Cn,{size:16,color:T.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[A.detailsCard,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Fe(!ze),style:A.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:T.card.iconBackgroundColor,borderRadius:T.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:T.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[A.detailsLabel,{color:T.card.titleColor,fontFamily:p.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:A.chevronContainer,children:ze?jsxRuntime.jsx(qr,{size:16,color:T.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(yt,{size:16,color:T.card.actionColor,strokeWidth:2})})]}),ze&&jsxRuntime.jsxs(reactNative.View,{style:A.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:T.card.iconBackgroundColor,borderRadius:T.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ho,{size:12,color:T.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[A.detailsLabel,{color:T.card.titleColor,fontFamily:p.regular}],children:["Price impact: ",N.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:T.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:T.card.iconBackgroundColor,borderRadius:T.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:12,color:T.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[A.detailsLabel,{color:T.card.titleColor,fontFamily:p.regular}],children:["Slippage: Auto \u2022 ",re.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:T.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:T.card.iconBackgroundColor,borderRadius:T.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zs,{size:12,color:T.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[A.detailsLabel,{color:T.card.titleColor,fontFamily:p.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Va,{depositConfirmationMode:c,depositAddress:lt,showWaitingUi:Bt,latestExecution:q,onIveDeposited:Cr}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:A.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[A.termsText,{color:h.primary,fontFamily:p.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Qe,{visible:wt,onClose:()=>he(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??b,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??m,children:[jsxRuntime.jsxs(reactNative.View,{style:[A.sheetHeader,{borderBottomColor:h.border}],children:[jsxRuntime.jsx(reactNative.View,{style:A.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[A.sheetTitle,{color:T.header.titleColor,fontFamily:p.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(false),style:A.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:T.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[A.infoCard,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:A.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[A.infoCardIcon,{backgroundColor:T.card.iconBackgroundColor,borderRadius:T.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ho,{size:16,color:T.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardTitle,{color:T.card.titleColor,fontFamily:p.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[A.infoCardValue,{color:T.card.titleColor,fontFamily:p.medium}],children:[N.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardDescription,{color:T.card.descriptionColor,fontFamily:p.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[A.infoCard,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:A.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[A.infoCardIcon,{backgroundColor:T.card.iconBackgroundColor,borderRadius:T.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:16,color:T.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardTitle,{color:T.card.titleColor,fontFamily:p.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[A.infoCardValue,{color:T.card.titleColor,fontFamily:p.medium}],children:[re.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardDescription,{color:T.card.descriptionColor,fontFamily:p.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),q&&jsxRuntime.jsx(Ei,{visible:Lt,status:q.status,tokenIconUrl:q.destination_token_metadata?.icon_urls?.find(le=>le.format==="png")?.url||q.destination_token_metadata?.icon_url||ae(xe,"png"),explorerUrl:q.explorer_url,completionExplorerUrl:q.destination_explorer_url,date:q.created_at?new Date(q.created_at):void 0,amountUsd:q.source_amount_usd?parseFloat(q.source_amount_usd):void 0,onClose:()=>J(false),borderTopLeftRadius:S?.depositStatus?.borderTopLeftRadius??b,borderTopRightRadius:S?.depositStatus?.borderTopRightRadius??m})]})}var A=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 Fo={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 Zh(){let{colors:e,components:t}=O(),r=on.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;on.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]);let i=({rightIcons:s=2})=>jsxRuntime.jsxs(reactNative.View,{style:[fn.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[fn.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:fn.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[fn.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[fn.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:fn.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[fn.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:fn.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var fn=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 Xh({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,defaultChainType:c,defaultChainId:g,defaultTokenAddress:w,showBalance:f=false,hideDepositTracker:y=false,enableStripeLinkPay:b=false,StripeOnrampComponent:m,stripeOnrampEmail:S,stripeOnrampPhone:h,stripeMerchantIdentifier:p,stripeTheme:T,depositConfirmationMode:x="auto_ui",transferInputVariant:_="double_input",onDepositSuccess:F,onDepositError:k,sheetBorderRadius:C}){let B=C?.globalBorderTopLeftRadius,E=C?.globalBorderTopRightRadius,{colors:L,fonts:R}=O(),[H,V]=on.useState([]),[we,We]=on.useState(false),[Xe,ee]=on.useState(false),[ye,ze]=on.useState(false),[Fe,Ue]=on.useState(false),[ie,Ge]=on.useState(null),[Ve,Ye]=on.useState("amount"),{isAllowed:dt,isLoading:at}=Fs(o,e);on.useEffect(()=>{if(!e||ie)return;let he=false;return ts(o).then(async _e=>{if(he)return;let Je=[];for(let mt of _e?.transfer_crypto?.networks??[]){let Se=mt.icon_urls.find(et=>et.format==="png")?.url||mt.icon_urls.find(et=>et.format==="svg")?.url;Se&&Je.push(K(Se));}for(let mt of _e?.payment_networks?.networks??[]){let Se=mt.icon_urls.find(et=>et.format==="png")?.url||mt.icon_urls.find(et=>et.format==="svg")?.url;Se&&Je.push(K(Se));}Je.length>0&&await dc(Je),he||Ge(_e);}).catch(console.error),()=>{he=true;}},[e,ie,o]);let ht=()=>{t();},He=H.filter(he=>he.status==="pending"||he.status==="waiting").length,J=!!(s&&a&&l&&d&&o)&&f!==false&&!!ie,q=at||e&&!ie,Te=dt===false,wt=null;if(Fe&&m){let he=jsxRuntime.jsx(m,{publishableKey:o,email:S,phone:h,externalUserId:r,recipientAddress:s??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,merchantIdentifier:p,onClose:()=>Ue(false)});wt=T?jsxRuntime.jsx(Di,{...T,children:he}):he;}return jsxRuntime.jsxs(Qe,{visible:e,onClose:ht,closeOnBackdropPress:false,showHandle:false,borderTopLeftRadius:C?.main?.borderTopLeftRadius??B,borderTopRightRadius:C?.main?.borderTopRightRadius??E,children:[jsxRuntime.jsx(cr,{title:n,showBack:false,onClose:ht,showBalance:J,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:ie?.project_name}),q&&jsxRuntime.jsx(Zh,{}),!q&&Te&&jsxRuntime.jsxs(reactNative.View,{style:Vo.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Vo.iconContainer,{backgroundColor:L.cardHover}],children:jsxRuntime.jsx(Ns,{size:32,color:L.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Vo.blockedTitle,{color:L.foreground,fontFamily:R.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Vo.blockedDescription,{color:L.foreground,opacity:.7,fontFamily:R.regular}],children:"There are no supported tokens available from your current location."})]}),!q&&!Te&&jsxRuntime.jsxs(reactNative.View,{style:Vo.optionsContainer,children:[jsxRuntime.jsx(Ss,{onPress:()=>ee(true),title:Fo.transferCrypto.title,subtitle:Fo.transferCrypto.subtitle,featuredTokens:ie?.transfer_crypto?.networks}),jsxRuntime.jsx(xs,{onPress:()=>ze(true),title:Fo.depositWithCard.title,subtitle:Fo.depositWithCard.subtitle,paymentNetworks:ie?.payment_networks?.networks}),b&&m&&jsxRuntime.jsx(vs,{onPress:()=>Ue(true),title:Fo.stripeLinkPay.title,subtitle:Fo.stripeLinkPay.subtitle}),!y&&jsxRuntime.jsx(_s,{onPress:()=>We(true),title:Fo.depositTracker.title,subtitle:Fo.depositTracker.subtitle,badge:He>0?He:void 0})]}),jsxRuntime.jsx(qa,{visible:we,onClose:()=>We(false),executions:H,externalUserId:r,publishableKey:o,borderTopLeftRadius:C?.depositsTracker?.borderTopLeftRadius??B,borderTopRightRadius:C?.depositsTracker?.borderTopRightRadius??E}),jsxRuntime.jsxs(Qe,{visible:Xe,onClose:()=>ee(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:C?.transferCrypto?.borderTopLeftRadius??B,borderTopRightRadius:C?.transferCrypto?.borderTopRightRadius??E,children:[jsxRuntime.jsx(cr,{title:Fo.transferCrypto.title,showBack:false,onClose:()=>ee(false),showBalance:J,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:ie?.project_name}),jsxRuntime.jsx(reactNative.ScrollView,{style:Vo.transferScrollContainer,contentContainerStyle:Vo.scrollContent,showsVerticalScrollIndicator:false,children:_==="single_input"?jsxRuntime.jsx(Mc,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:g,defaultTokenAddress:w,depositConfirmationMode:x,onExecutionsChange:V,onDepositSuccess:F,onDepositError:k,borderTopLeftRadius:B,borderTopRightRadius:E,sheetBorderRadius:{tokenSelector:C?.tokenSelector,infoSheet:C?.infoSheet,depositStatus:C?.depositStatus}}):jsxRuntime.jsx(Ba,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:g,defaultTokenAddress:w,depositConfirmationMode:x,onExecutionsChange:V,onDepositSuccess:F,onDepositError:k,borderTopLeftRadius:B,borderTopRightRadius:E,sheetBorderRadius:{tokenSelector:C?.tokenSelector,chainSelector:C?.chainSelector,infoSheet:C?.infoSheet,depositStatus:C?.depositStatus}})})]}),jsxRuntime.jsxs(Qe,{visible:ye,onClose:()=>{ze(false),Ye("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:C?.buyWithCard?.borderTopLeftRadius??B,borderTopRightRadius:C?.buyWithCard?.borderTopRightRadius??E,children:[jsxRuntime.jsx(cr,{title:`Deposit ${i||"USDC"}`,showBack:Ve==="onramp",onBack:()=>Ye("amount"),onClose:()=>{ze(false),Ye("amount");},showBalance:J,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:ie?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Vo.buyWithCardContainer,children:jsxRuntime.jsx(Ua,{externalUserId:r,publishableKey:o,destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onDepositSuccess:F,onDepositError:k,view:Ve,onViewChange:he=>Ye(he),borderTopLeftRadius:B,borderTopRightRadius:E,sheetBorderRadius:{providerModal:C?.providerModal,webView:C?.webView,currencyModal:C?.currencyModal}})})]}),b&&m&&jsxRuntime.jsx(Qe,{visible:Fe,onClose:()=>Ue(false),closeOnBackdropPress:false,showHandle:false,heightPercent:1,borderTopLeftRadius:0,borderTopRightRadius:0,children:jsxRuntime.jsx(reactNative.View,{style:Vo.stripeLinkPayContainer,children:wt})})]})}function Za({theme:e="auto",...t}){return jsxRuntime.jsx(Xh,{...t})}var Vo=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},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 Xa(e,t=true){return xo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>na(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function zc(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return xo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await kn(i),d=null,c=null,g=null,w=null,f,y,b,m=l.data.some(S=>S.chains.some(h=>{let p=h.chain_type===t&&h.chain_id===r&&h.token_address.toLowerCase()===o.toLowerCase();return p&&(d=h.minimum_deposit_amount_usd,c=h.estimated_processing_time,g=h.max_slippage_percent,w=h.estimated_price_impact_percent,b=h.chain_name,y=S),p}));if(y){let S=ae(y,"png");S&&(f=K(S));}return {isSupported:m,minimumAmountUsd:d,estimatedProcessingTime:c,maxSlippagePercent:g,priceImpactPercent:w,errorMessage:m?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:f,chainName:b}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Uc(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return xo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await ia(t,r,o,n,i);if(l.balance){let d=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",g=l.balance.amount,w=BigInt(g),f=BigInt(10**d),y=w/f,m=(w%f).toString().padStart(d,"0").replace(/0+$/,""),S=m?`${y}.${m}`:y.toString();return {balanceBaseUnit:g,balanceHuman:S,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:d,symbol:c}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var eg=2500,tg=3e3,rg=6e4;function Hc({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=on.useState([]),[l,d]=on.useState(false),c=on.useRef(new Date),g=on.useRef(new Map),w=on.useRef(false),f=on.useRef(n),y=on.useRef(i);return on.useEffect(()=>{f.current=n;},[n]),on.useEffect(()=>{y.current=i;},[i]),on.useEffect(()=>{o&&!w.current&&(c.current=new Date,g.current.clear()),o||g.current.clear(),w.current=o;},[o]),on.useEffect(()=>{if(!e||!o)return;let b=c.current,m=async()=>{try{let h=await Co(e,t,"withdraw"),p=new Date(b.getTime()-rg),T=[...h.data].sort((k,C)=>{let B=k.created_at?new Date(k.created_at).getTime():0;return (C.created_at?new Date(C.created_at).getTime():0)-B}),x=["pending","waiting","delayed"],_=["succeeded","failed"],F=null;for(let k of T){let C=k.created_at?new Date(k.created_at):null;if(!C||C<p)continue;let B=g.current.get(k.id);if(!B){F=k;break}if(x.includes(B)&&_.includes(k.status)){F=k;break}}if(F){let k=F,C=k.created_at?new Date(k.created_at):null;if(!C||C<c.current)return;let B=g.current.get(k.id);g.current.set(k.id,k.status),a(E=>{let L=E.findIndex(R=>R.id===k.id);if(L>=0){let R=[...E];return R[L]=k,R}return [...E,k]}),k.status==="succeeded"&&(!B||x.includes(B))?f.current?.({message:"Withdrawal completed successfully",transaction:k}):k.status==="failed"&&B!=="failed"&&y.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:k});}}catch(h){console.error("Failed to fetch withdraw executions:",h),y.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:h});}};m();let S=setInterval(m,eg);return d(true),()=>{clearInterval(S),d(false);}},[e,t,o]),on.useEffect(()=>{if(!o||!r)return;let b=async()=>{try{await Ml({deposit_wallet_id:r},t);}catch{}};b();let m=setInterval(b,tg);return ()=>clearInterval(m)},[o,r,t]),{executions:s,isPolling:l}}var Nc=(e,t)=>`${t}:${e}`;function Bs({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:d,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:g}){let{colors:w,fonts:f,components:y}=O(),[b,m]=on.useState(false),[S,h]=on.useState(false),p=y.card,T=t?e.find(k=>k.symbol===t):void 0,x=T?.chains||[],_=r?x.find(k=>Nc(k.chain_id,k.chain_type)===r):void 0,F={backgroundColor:p.backgroundColor,borderRadius:p.borderRadius,borderWidth:p.borderWidth||1,borderColor:p.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:De.row,children:[jsxRuntime.jsxs(reactNative.View,{style:De.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[De.label,{color:p.labelColor,fontFamily:f.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[De.selectButton,F],onPress:()=>!i&&e.length>0&&m(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[De.placeholder,{color:p.subtitleColor,fontFamily:f.regular}],children:"Loading..."}):T?jsxRuntime.jsxs(reactNative.View,{style:De.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(T,"png"))},style:De.icon}),jsxRuntime.jsx(reactNative.Text,{style:[De.selectedText,{color:p.titleColor,fontFamily:f.medium}],numberOfLines:1,children:T.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[De.placeholder,{color:p.subtitleColor,fontFamily:f.regular}],children:"Select receive token"}),jsxRuntime.jsx(yt,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:De.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[De.label,{color:p.labelColor,fontFamily:f.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[De.selectButton,F,(!T||x.length===0)&&De.disabled],onPress:()=>!i&&T&&x.length>0&&h(true),activeOpacity:.7,disabled:i||!T||x.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:De.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(_,"png"))},style:De.icon}),jsxRuntime.jsx(reactNative.Text,{style:[De.selectedText,{color:p.titleColor,fontFamily:f.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[De.placeholder,{color:p.subtitleColor,fontFamily:f.regular}],children:"Chain"}),jsxRuntime.jsx(yt,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Qe,{visible:b,onClose:()=>m(false),closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:De.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:De.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[De.pickerTitle,{color:w.foreground,fontFamily:f.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:De.pickerHeaderClose,onPress:()=>m(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:w.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.FlatList,{data:e,keyExtractor:k=>k.symbol,contentContainerStyle:De.listContent,renderItem:({item:k})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[De.pickerItem,{backgroundColor:k.symbol===t?w.cardHover:"transparent"}],onPress:()=>{o(k.symbol),m(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(k,"png"))},style:De.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[De.pickerItemText,{color:w.foreground,fontFamily:f.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[De.pickerItemSub,{color:w.foregroundMuted,fontFamily:f.regular}],children:k.name}),k.symbol===t&&jsxRuntime.jsx(Ae,{size:18,color:w.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Qe,{visible:S,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:c,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:De.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:De.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[De.pickerTitle,{color:w.foreground,fontFamily:f.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:De.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:w.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.FlatList,{data:x,keyExtractor:k=>Nc(k.chain_id,k.chain_type),contentContainerStyle:De.listContent,renderItem:({item:k})=>{let C=Nc(k.chain_id,k.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[De.pickerItem,{backgroundColor:C===r?w.cardHover:"transparent"}],onPress:()=>{n(C),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:K(ae(k,"png"))},style:De.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[De.pickerItemText,{color:w.foreground,fontFamily:f.medium}],children:k.chain_name}),C===r&&jsxRuntime.jsx(Ae,{size:18,color:w.primary,strokeWidth:2.5})]})}})]})]})}var De=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 jc(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:i,enabled:s=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return xo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>El({chain_type:t,chain_id:r,token_address:o,recipient_address:a},i),enabled:s&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function sg(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function ag(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),i=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(i)).toString()}function lg(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function rl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:d,balanceData:c,isLoadingBalance:g,minimumWithdrawAmountUsd:w,estimatedProcessingTime:f,maxSlippagePercent:y,priceImpactPercent:b,canWithdraw:m,onDepositWalletCreation:S,onWithdraw:h,onWithdrawError:p,onWithdrawSubmitted:T,onViewTracker:x}){let _="https://unifold.io/terms",F="https://unifold.io/support",{colors:k,fonts:C,components:B}=O(),[E,L]=on.useState(a||""),[R,H]=on.useState(""),[V,we]=on.useState("crypto"),[We,Xe]=on.useState(false),[ee,ye]=on.useState(null),[ze,Fe]=on.useState(false),[Ue,ie]=on.useState(""),Ge=on.useRef(null);on.useEffect(()=>{L(a||""),H(""),we("crypto"),ye(null);},[a]);let Ve=E.trim();on.useEffect(()=>{let re=setTimeout(()=>ie(Ve),500);return ()=>clearTimeout(re)},[Ve]);let {data:Ye,isLoading:dt,error:at}=jc({chainType:d?.chain_type,chainId:d?.chain_id,tokenAddress:d?.token_address,recipientAddress:Ue,publishableKey:e,enabled:Ue.length>5&&!!d}),ht=Ve!==Ue,He=on.useMemo(()=>!Ve||Ve.length<=5||ht||dt?null:at?"Invalid address":Ye&&!Ye.valid?Ye.failure_code==="account_not_found"?`Account not found on ${d?.chain_name}`:Ye.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${d?.chain_name}`:"Invalid address":null,[Ve,ht,dt,at,Ye,d,l]),Lt=!ht&&!!Ye?.valid&&!He,J=on.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),q=on.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),Te=on.useMemo(()=>c?.balanceUsd?parseFloat(c.balanceUsd):0,[c]),wt=n||c?.symbol||"TOKEN",he=c?.decimals??6,_e=on.useMemo(()=>{let re=parseFloat(R);return !re||re<=0?0:V==="crypto"?re:J>0?re/J:0},[R,V,J]),Je=on.useMemo(()=>{let re=parseFloat(R);return !re||re<=0?0:V==="fiat"?re:re*J},[R,V,J]);on.useMemo(()=>!R||parseFloat(R)<=0?null:V==="crypto"?`$${Je.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`:`${_e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})} ${wt}`,[R,V,Je,_e,wt]);on.useMemo(()=>g||!c?null:V==="crypto"?`${q.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})} ${wt}`:`$${Te.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,[g,c,V,q,Te,wt]);let et=on.useCallback(async()=>{try{let ue=await Gp("expo-clipboard").getStringAsync();ue&&(L(ue.trim()),ye(null));}catch{}},[]),Ht=on.useCallback(()=>{let re=parseFloat(R);if(!re||re<=0||J<=0){we(ue=>ue==="crypto"?"fiat":"crypto"),H("");return}V==="crypto"?(H((re*J).toFixed(2)),we("fiat")):(H((re/J).toFixed(he>6?6:he)),we("crypto"));},[R,V,J,he]),lt=on.useCallback(()=>{if(V==="crypto"){if(q<=0)return;H(c?.balanceHuman??"0");}else {if(Te<=0)return;H((Math.floor(Te*100)/100).toFixed(2));}},[V,q,Te,c]),Re=w!==null&&Je>0&&Je<w,Nt=V==="crypto"?_e>0&&q>0&&_e>q:Je>0&&Te>0&&Je>Te,Bt=Ve.length>0&&R.trim().length>0&&_e>0&&Lt&&!Re&&!Nt&&!!c,Cr=on.useCallback(async()=>{if(!(!l||!d||!Bt||!m)){Xe(true),ye(null);try{let re=await S({destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,recipientAddress:Ve}),ue=ag(_e,he),le=lg(_e,he),Le={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:wt,sourceTokenIconUrl:s,destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,destinationTokenSymbol:l.symbol,destinationChainName:d.chain_name,destinationTokenIconUrl:l?K(ae(l,"png")):void 0,amount:le,amountBaseUnit:ue,submittedAt:new Date,withdrawIntentAddress:re.address,recipientAddress:Ve};await h(Le),T(Le);}catch(re){let ue=re instanceof Error?re.message:"Withdrawal failed. Please try again.",le=ue.length>120?"Withdrawal failed. Please try again.":ue;ye(le),p?.({message:ue,error:re,code:"WITHDRAW_FAILED"});}finally{Xe(false);}}},[l,d,Bt,m,Ve,t,r,o,wt,s,R,V,q,Te,c,_e,he,Je,S,h,p,T]),xe=B.input,je=B.card,$e=B.button,ur=He?k.error:xe.borderColor,N=on.useMemo(()=>We?"Processing...":Nt?"Insufficient balance":Re?`Minimum $${w?.toFixed(2)}`:ee?"Withdrawal failed \u2014 try again":"Withdraw",[We,Nt,Re,w,ee]);return jsxRuntime.jsxs(reactNative.View,{style:Oe.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Oe.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Oe.label,{color:je.labelColor,fontFamily:C.medium}],children:"Recipient address"}),(ht||dt)&&Ve.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.foregroundMuted}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:et,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(ed,{size:16,color:k.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Oe.inputRow,{backgroundColor:xe.backgroundColor,borderRadius:xe.borderRadius,borderWidth:xe.borderWidth,borderColor:ur}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Oe.textInput,{color:xe.textColor,fontFamily:C.regular}],placeholder:"Enter wallet address",placeholderTextColor:xe.placeholderColor,value:E,onChangeText:re=>{L(re),ye(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ge.current?.focus()})}),He?jsxRuntime.jsx(reactNative.Text,{style:[Oe.errorText,{color:k.error,fontFamily:C.regular}],children:He}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Oe.label,{color:je.labelColor,fontFamily:C.medium,paddingBottom:8}],children:["Amount",w!=null&&w>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:k.warning,fontFamily:C.regular},children:` ($${w.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Oe.amountRow,{backgroundColor:xe.backgroundColor,borderRadius:xe.borderRadius,borderWidth:xe.borderWidth,borderColor:xe.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:[Oe.amountInput,{color:xe.textColor,fontFamily:C.regular}],placeholder:"0.00",placeholderTextColor:xe.placeholderColor,value:R,onChangeText:re=>{(re===""||/^\d*\.?\d*$/.test(re))&&(H(re),ye(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:J>0?Ht:void 0,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Oe.unitLabel,{color:k.foregroundMuted,fontFamily:C.medium}],children:V==="crypto"?wt:"USD"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Oe.maxButton,{backgroundColor:`${k.primary}20`}],onPress:lt,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Oe.maxText,{color:k.primary,fontFamily:C.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Oe.detailsCard,{marginTop:24,backgroundColor:je.backgroundColor,borderRadius:je.borderRadius,borderWidth:je.borderWidth||1,borderColor:je.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Oe.detailsToggle,onPress:()=>Fe(!ze),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Oe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Oe.detailIcon,{backgroundColor:je.iconBackgroundColor,borderRadius:je.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:je.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Oe.detailsLabel,{color:je.titleColor,fontFamily:C.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:C.medium},children:sg(f)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ze?"180deg":"0deg"}]},children:jsxRuntime.jsx(yt,{size:16,color:je.actionColor,strokeWidth:2})})]})}),ze&&jsxRuntime.jsxs(reactNative.View,{style:Oe.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Oe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Oe.detailIcon,{backgroundColor:je.iconBackgroundColor,borderRadius:je.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:12,color:je.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Oe.detailsLabel,{color:je.titleColor,fontFamily:C.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:C.medium},children:["Auto \u2022 ",(y??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Oe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Oe.detailIcon,{backgroundColor:je.iconBackgroundColor,borderRadius:je.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ho,{size:12,color:je.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Oe.detailsLabel,{color:je.titleColor,fontFamily:C.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:C.medium},children:[(b??0).toFixed(2),"%"]})]})]})]})]}),ee&&jsxRuntime.jsx(reactNative.Text,{style:[Oe.errorText,{color:k.error,fontFamily:C.regular,textAlign:"center"}],children:ee}),jsxRuntime.jsxs(reactNative.View,{style:Oe.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Oe.withdrawButton,{backgroundColor:$e.primaryBackground,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:$e.borderColor,opacity:!Bt||!m||We?.5:1}],onPress:Cr,disabled:!Bt||!m||We,activeOpacity:.8,children:[We&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:$e.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Oe.withdrawButtonText,{color:$e.primaryText,fontFamily:C.medium}],children:N})]}),jsxRuntime.jsxs(reactNative.View,{style:Oe.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Oe.historyLink,onPress:x,activeOpacity:.7,children:[jsxRuntime.jsx(jr,{size:14,color:k.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Oe.historyText,{color:k.foregroundMuted,fontFamily:C.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Oe.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Oe.legalText,{color:k.foregroundMuted,fontFamily:C.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Oe.legalSeparator,{color:k.foregroundMuted,fontFamily:C.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Oe.legalText,{color:k.foregroundMuted,fontFamily:C.regular}],children:"Help"})})]})]})]})]})}var Oe=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:4,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:4,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"},balanceRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:6,paddingHorizontal:4},convertedText:{fontSize:12},balanceText:{fontSize:12},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 ug(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 pg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function il({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,d=K(ae(e.destination_token_metadata,"png")||Mt("/icons/tokens/png/usdc.png")),c=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",g=ug(e.created_at||new Date().toISOString()),w=pg(e.source_amount_usd);return jsxRuntime.jsxs(Et,{cardTokens:i,onPress:t,contentStyle:Ao.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ao.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:Ao.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ao.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(Gi,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(Us,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ae,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ao.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[Ao.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:Ao.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.amount,{color:i.textRightColor,fontFamily:o.medium}],children:w}),jsxRuntime.jsx(Br,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var Ao=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 qc(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),i=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),l=s>=12?"PM":"AM";s=s%12||12;let d=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${d} ${l}`}catch{return e}}function Up(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 hg(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 Hp(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Np(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Ws({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Ce.divider,{backgroundColor:i.borderColor}]})]})}function Kc({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=O(),[d,c]=on.useState([]),[g,w]=on.useState(!!n),f=l.card,y=l.button,b=l.header,m=l.container;on.useEffect(()=>{Al().then(we=>c(we.data)).catch(()=>{});},[]),on.useEffect(()=>{w(!!n);},[e?.id]);let S=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,h=e?e.status==="failed"||e.status==="refunded":false,p=h?s.error:S?s.warning:s.success,T=h?"Failed":S?"Processing":"Completed",x=e?.destination_token_metadata?K(ae(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?K(t.destinationTokenIconUrl):K(Mt("/icons/tokens/png/usdc.png")),_=e?.created_at?qc(e.created_at):t.submittedAt?qc(t.submittedAt.toISOString()):qc(new Date().toISOString()),F=e?`${Up(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Hp(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,k=e?`${Up(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Hp(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,C=e?hg(e.source_amount_usd,e.source_amount_base_unit):"$0.00",B=e?oa(d,e.source_chain_type,e.source_chain_id):t.sourceChainId,E=e?oa(d,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,L=e?.transaction_hash,R=e?.explorer_url,H=e?.destination_transaction_hashes?.[0],V=e?.destination_explorer_url;return jsxRuntime.jsxs(reactNative.ScrollView,{style:Ce.scroll,contentContainerStyle:Ce.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Xc,{size:22,color:b.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ce.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.headerTitle,{color:b.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Ce.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:b.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:x},style:Ce.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ce.statusBadge,{backgroundColor:p}],children:h?jsxRuntime.jsx(Gi,{size:10,color:"#FFFFFF",strokeWidth:3}):S?jsxRuntime.jsx(reactNative.View,{style:Ce.spinnerDot}):jsxRuntime.jsx(Ae,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.statusText,{color:p,fontFamily:a.medium}],children:T})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.dateText,{color:m.subtitleColor,fontFamily:a.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Ce.detailsCard,{backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth??1,borderColor:f.borderColor}],children:[jsxRuntime.jsx(Ws,{label:"Amount Sent",value:F}),jsxRuntime.jsx(Ws,{label:"Amount Received",value:k}),jsxRuntime.jsx(Ws,{label:"USD Value",value:C}),jsxRuntime.jsx(Ws,{label:"Source Network",value:B}),jsxRuntime.jsx(Ws,{label:"Destination Network",value:E,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ce.moreDetailsRow,onPress:()=>w(we=>!we),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.moreDetailsText,{color:m.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(qr,{size:16,color:m.actionColor,strokeWidth:2}):jsxRuntime.jsx(yt,{size:16,color:m.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[Ce.detailsCard,{backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth??1,borderColor:f.borderColor}],children:L&&R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ce.txRow,onPress:()=>reactNative.Linking.openURL(R),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.txLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.txHash,{color:f.titleColor,fontFamily:a.regular}],children:Np(L)}),jsxRuntime.jsx($r,{size:14,color:f.actionColor,strokeWidth:2})]}),!S&&H&&V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.divider,{backgroundColor:f.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ce.txRow,onPress:()=>reactNative.Linking.openURL(V),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.txLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.txHash,{color:f.titleColor,fontFamily:a.regular}],children:Np(H)}),jsxRuntime.jsx($r,{size:14,color:f.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Ce.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.detailLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Ce.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ce.button,Ce.halfButton,{backgroundColor:y.secondaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.buttonText,{color:y.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ce.button,Ce.halfButton,{backgroundColor:y.primaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.buttonText,{color:y.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var Ce=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 jp(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function sl({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=O(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",d=a?.status==="failed",c={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[ct.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(Ae,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ct.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ct.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",jp(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:ct.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ct.button,ct.halfButton,c,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ct.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ct.button,ct.halfButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ct.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):d?jsxRuntime.jsxs(reactNative.View,{style:ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[ct.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(tt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ct.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[ct.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ct.button,ct.fullButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ct.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(it,{size:80,strokeWidth:4,iconSize:68,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:K(e.sourceTokenIconUrl)},style:ct.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[ct.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[ct.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[ct.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",jp(e.recipientAddress)]})]})}var ct=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 kg(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:K(ae(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:K(ae(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 $p=(e,t)=>`${t}:${e}`;function xg(){let{colors:e}=O(),t=on.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return on.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 cl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,modalTitle:s="Withdraw Crypto",onWithdraw:a,onWithdrawSuccess:l,onWithdrawError:d,heightPercent:c=.92,sheetBorderRadius:g,sourceChainType:w,sourceChainId:f,sourceTokenAddress:y,sourceTokenSymbol:b,sourceChainName:m,sourceTokenIconUrl:S}){let{colors:h,fonts:p}=O(),[T,x]=on.useState("form"),[_,F]=on.useState(w),[k,C]=on.useState(f),[B,E]=on.useState(y),[L,R]=on.useState(b),[H,V]=on.useState(m),[we,We]=on.useState(S),[Xe,ee]=on.useState(null),[ye,ze]=on.useState(null),[Fe,Ue]=on.useState(null),[ie,Ge]=on.useState(),[Ve,Ye]=on.useState([]),[dt,at]=on.useState(null),[ht,He]=on.useState("form"),Lt=on.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,J=on.useRef(null),q=!!_&&!!k&&!!B,{data:Te,isLoading:wt}=Xa(r,e&&T==="form"),he=Te?.data??[],{data:_e,isLoading:Je}=zc({sourceChainType:_,sourceChainId:k,sourceTokenAddress:B,sourceTokenSymbol:L,publishableKey:r,enabled:e&&q&&T==="form"}),{data:mt,isLoading:Se}=Uc({address:n,chainType:_,chainId:k,tokenAddress:B,publishableKey:r,enabled:e&&q}),{executions:et}=Hc({userId:o,publishableKey:r,depositWalletId:ie,enabled:!!ie&&e,onWithdrawSuccess:l,onWithdrawError:d});on.useEffect(()=>{if(!e||T!=="tracker")return;let X=false;return Co(o,r,"withdraw").then(ce=>{X||Ye(ce.data);}).catch(console.error),()=>{X=true;}},[e,T,o,r]),on.useEffect(()=>{e&&(J.current&&(clearTimeout(J.current),J.current=null),x("form"),F(w),C(f),E(y),R(b),V(m),We(S),ee(null),ze(null),Ue(null),Ge(void 0),Ye([]),at(null),He("form"),Lt.setValue(reactNative.Dimensions.get("window").width));},[e]),on.useEffect(()=>()=>{J.current&&clearTimeout(J.current);},[]),on.useEffect(()=>{we||_e?.iconUrl&&We(_e.iconUrl);},[_e?.iconUrl,we]),on.useEffect(()=>{H||_e?.chainName&&V(_e.chainName);},[_e?.chainName,H]),on.useEffect(()=>{T==="confirming"&&et.length>0&&x("details");},[T,et]);let Ht=on.useCallback(()=>{t(),J.current=setTimeout(()=>{x("form"),F(w),C(f),E(y),R(b),V(m),We(S),ee(null),ze(null),Ue(null),Ge(void 0),Ye([]),at(null),He("form"),J.current=null;},300);},[t,w,f,y,b,m,S]),lt=on.useCallback(X=>{let ce=he.find(nt=>nt.symbol===X);ce&&(ee(ce),ce.chains.length>0&&ze(ce.chains[0]));},[he]),Re=on.useCallback(X=>{if(!Xe)return;let ce=Xe.chains.find(nt=>$p(nt.chain_id,nt.chain_type)===X);ce&&ze(ce);},[Xe]),Nt=on.useCallback(async X=>{let ce=await yo({external_user_id:o,destination_chain_type:X.destinationChainType,destination_chain_id:X.destinationChainId,destination_token_address:X.destinationTokenAddress,recipient_address:X.recipientAddress,action_type:"withdraw"},r),nt=bo(ce.data,_??"");if(!nt)throw new Error(`No deposit wallet found for chain type: ${_}`);return Ge(nt.id),{id:nt.id,address:nt.address}},[o,r,_]),Bt=on.useCallback(X=>{Ue(X),x("confirming");},[]),Cr=on.useCallback(X=>{at(X),Lt.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Lt,{toValue:0,duration:280,useNativeDriver:true}).start();},[Lt]),xe=on.useCallback(()=>{reactNative.Animated.timing(Lt,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>at(null));},[Lt]),je=wt||Je,$e=_e?.isSupported??null,ur=T==="confirming"?"Withdrawal Status":s,N=g?.globalBorderTopLeftRadius,re=g?.globalBorderTopRightRadius,ue=g?.main?.borderTopLeftRadius??N,le=g?.main?.borderTopRightRadius??re,Le=g?.tokenSelector?.borderTopLeftRadius??N,U=g?.tokenSelector?.borderTopRightRadius??re,Z=g?.chainSelector?.borderTopLeftRadius??N,pe=g?.chainSelector?.borderTopRightRadius??re,oe=(()=>{if(T!=="form"||!q||Se||!mt)return;let X=L||mt.symbol,ce=mt.balanceUsd;if(ce!=null){let bn=`$${parseFloat(ce).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return X?`Balance: ${bn} ${X}`:`Balance: ${bn}`}let nt=mt.balanceHuman;if(!(!nt||nt==="0"))return X?`Balance: ${nt} ${X}`:`Balance: ${nt}`})();return jsxRuntime.jsx(Qe,{visible:e,onClose:Ht,closeOnBackdropPress:false,showHandle:false,heightPercent:T==="confirming"?.3:T==="details"?.7:c,borderTopLeftRadius:ue,borderTopRightRadius:le,children:T==="confirming"&&Fe?jsxRuntime.jsx(sl,{txInfo:Fe,executions:et,onClose:Ht,onViewTracker:()=>{He("confirming"),x("tracker");}}):T==="details"&&Fe?jsxRuntime.jsx(Kc,{execution:et.length>0?et[et.length-1]:null,txInfo:Fe,onClose:Ht,onViewHistory:()=>{He("details"),x("tracker");},onHeaderClose:()=>x("form")}):T==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:uo.trackerContainer,children:[jsxRuntime.jsx(cr,{title:"Withdrawal History",onClose:()=>x(ht)}),Ve.length===0?jsxRuntime.jsx(reactNative.View,{style:uo.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[uo.emptyText,{color:h.foregroundMuted,fontFamily:p.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(reactNative.FlatList,{data:Ve,keyExtractor:X=>X.id,contentContainerStyle:uo.listContent,renderItem:({item:X})=>jsxRuntime.jsx(il,{execution:X,onPress:()=>Cr(X)})}),dt&&jsxRuntime.jsx(reactNative.Animated.View,{style:[uo.historyDetailOverlay,{backgroundColor:h.background,transform:[{translateX:Lt}]}],children:jsxRuntime.jsx(Kc,{execution:dt,txInfo:kg(dt),onClose:Ht,onBack:xe,onViewHistory:xe})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(cr,{title:ur,subtitle:oe,onClose:Ht}),je?jsxRuntime.jsx(xg,{}):$e===false?jsxRuntime.jsxs(reactNative.View,{style:uo.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[uo.unsupportedTitle,{color:h.foreground,fontFamily:p.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[uo.unsupportedMessage,{color:h.foregroundMuted,fontFamily:p.regular}],children:_e?.errorMessage})]}):jsxRuntime.jsx(_g,{publishableKey:r,sourceChainType:_??"",sourceChainId:k??"",sourceTokenAddress:B??"",sourceTokenSymbol:L,sourceChainName:H,sourceTokenIconUrl:we,recipientAddressProp:i,destinationTokens:he,selectedToken:Xe,selectedChain:ye,selectedChainKey:ye?$p(ye.chain_id,ye.chain_type):null,onTokenChange:lt,onChainChange:Re,tokensLoading:wt,balanceData:mt??null,isLoadingBalance:Se,sourceValidation:_e??null,onDepositWalletCreation:Nt,onWithdraw:a,onWithdrawError:d,onWithdrawSubmitted:Bt,onViewTracker:()=>{He("form"),x("tracker");},tokenSelectorLeft:Le,tokenSelectorRight:U,chainSelectorLeft:Z,chainSelectorRight:pe})]})})}function _g({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:d,selectedChain:c,selectedChainKey:g,onTokenChange:w,onChainChange:f,tokensLoading:y,balanceData:b,isLoadingBalance:m,sourceValidation:S,onDepositWalletCreation:h,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:x,onViewTracker:_,tokenSelectorLeft:F,tokenSelectorRight:k,chainSelectorLeft:C,chainSelectorRight:B}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(reactNative.ScrollView,{style:{flex:1,paddingTop:16},contentContainerStyle:uo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:uo.doubleInputWrapper,children:jsxRuntime.jsx(Bs,{tokens:l,selectedTokenSymbol:d?.symbol??null,selectedChainKey:g,onTokenChange:w,onChainChange:f,isLoading:y,tokenPickerBorderTopLeftRadius:F,tokenPickerBorderTopRightRadius:k,chainPickerBorderTopLeftRadius:C,chainPickerBorderTopRightRadius:B})}),jsxRuntime.jsx(rl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:d,selectedChain:c,balanceData:b,isLoadingBalance:m,minimumWithdrawAmountUsd:S?.minimumAmountUsd??null,estimatedProcessingTime:S?.estimatedProcessingTime??null,maxSlippagePercent:S?.maxSlippagePercent??null,priceImpactPercent:S?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:h,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:x,onViewTracker:_})]})})}var uo=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 Kp=on.createContext(null);function Bg({children:e,publishableKey:t,config:r}){let[o]=on.useState(()=>new rc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=on.useState(false),[s,a]=on.useState(null),[l,d]=on.useState(false),[c,g]=on.useState(null),w=reactNative.useColorScheme(),f=on.useRef(false);f.current||(Xs({publishableKey:t}),f.current=true);let y=on.useMemo(()=>{let R=r?.appearance||"dark";return R==="auto"?w==="dark"?"dark":"light":R},[r?.appearance,w]);on.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.'),Xs({publishableKey:t});},[t]),on.useEffect(()=>()=>{m.current&&clearTimeout(m.current),_.current&&clearTimeout(_.current);},[]);let b=on.useRef(null),m=on.useRef(null),S=on.useCallback(R=>{m.current&&(clearTimeout(m.current),m.current=null),b.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),b.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),b.current=null);let H=new Promise((V,we)=>{b.current={resolve:V,reject:we};});return a(R),i(true),H},[]),h=on.useCallback(()=>{b.current&&(b.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),b.current=null),i(false),m.current=setTimeout(()=>{a(null),m.current=null;},200);},[]),p=on.useCallback(R=>{s?.onSuccess&&s.onSuccess(R),b.current&&(b.current.resolve(R),b.current=null);},[s]),T=on.useCallback(R=>{console.error("[UnifoldProvider] Deposit error:",R),s?.onError&&s.onError(R),b.current&&(b.current.reject(R),b.current=null);},[s]),x=on.useRef(null),_=on.useRef(null),F=on.useRef(void 0),k=on.useCallback(R=>{_.current&&(clearTimeout(_.current),_.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let H=new Promise((V,we)=>{x.current={resolve:V,reject:we};});return F.current=R.onClose,g(R),d(true),H},[]),C=on.useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),F.current?.(),F.current=void 0,d(false),_.current=setTimeout(()=>{g(null),_.current=null;},200);},[]),B=on.useCallback(R=>{c?.onSuccess&&c.onSuccess(R),x.current&&(x.current.resolve(R),x.current=null);},[c]),E=on.useCallback(R=>{console.error("[UnifoldProvider] Withdraw error:",R),c?.onError&&c.onError(R),x.current&&(x.current.reject(R),x.current=null);},[c]),L=on.useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:h,beginWithdraw:k,closeWithdraw:C}),[t,S,h,k,C]);return jsxRuntime.jsx(ic,{client:o,children:jsxRuntime.jsx(Kp.Provider,{value:L,children:jsxRuntime.jsxs(Di,{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(Za,{visible:n,onClose:h,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:s.externalUserId,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeOnrampEmail:s.stripeOnrampEmail,stripeOnrampPhone:s.stripeOnrampPhone,stripeTheme:{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,StripeOnrampComponent:r?.enableStripeLinkPay?Jd():void 0,onDepositSuccess:p,onDepositError:T,theme:y,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(cl,{visible:l,onClose:C,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,onWithdraw:c.withdraw,onWithdrawSuccess:B,onWithdrawError:E,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Wg(){let e=on.useContext(Kp);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
3
- exports.AmountScreen=Gs;exports.BottomSheet=Qe;exports.KYCWizardScreen=Js;exports.OnrampScreen=pa;exports.StripeOnramp=ma;exports.StripeOnrampPreconfigure=Gd;exports.UnifoldProvider=Bg;exports.getPreferredIcon=ae;exports.getStripePublishableKey=la;exports.getSupportedDestinationTokens=na;exports.normalizeIconUrl=K;exports.registerStripeOnramp=fa;exports.setDevApiUrl=Cd;exports.setStripeOnrampApiUrl=aa;exports.setStripeOnrampPublishableKey=sa;exports.useAllowedCountry=Fs;exports.useStripeOnramp=ca;exports.useTheme=O;exports.useUnifold=Wg;
1
+ 'use strict';var nn=require('react'),reactNative=require('react-native'),xt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),stripeReactNative=require('@stripe/stripe-react-native'),df=require('expo-constants'),reactNativeGestureHandler=require('react-native-gesture-handler'),Xf=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview'),Ac=require('@react-native-async-storage/async-storage');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 nn__namespace=/*#__PURE__*/_interopNamespace(nn);var xt__default=/*#__PURE__*/_interopDefault(xt);var df__default=/*#__PURE__*/_interopDefault(df);var Xf__default=/*#__PURE__*/_interopDefault(Xf);var Ac__default=/*#__PURE__*/_interopDefault(Ac);var Zc=e=>{throw TypeError(e)};var Gp=(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 gl=(e,t,r)=>t.has(e)||Zc("Cannot "+r);var u=(e,t,r)=>(gl(e,t,"read from private field"),r?r.call(e):t.get(e)),q=(e,t,r)=>t.has(e)?Zc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),V=(e,t,r,o)=>(gl(e,t,"write to private field"),t.set(e,r),r),Ce=(e,t,r)=>(gl(e,t,"access private method"),r);var qi=(e,t,r,o)=>({set _(n){V(e,t,n);},get _(){return u(e,t,o)}});var yl={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)"}},bl=yl;function zs(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Qi(e,t,r){let o=r?t?.[r]:void 0,n=(c,g,C)=>{let f=o?.[c]?.[g];if(f!==void 0)return f;let y=t?.[c]?.[g];return y!==void 0?y:C},i={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,d=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:i,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:zs(i,s)},transferCrypto:{depositAddress:{card:zs(i,a)}},depositCard:{quoteProvider:{card:zs(i,l)}},depositTracker:{executionRow:{card:zs(i,d)}}}}function Cl(e,t,r){let n={...yl[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var wl=nn.createContext(null);function O(){let e=nn.useContext(wl);if(!e){let t=bl.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Qi(t,void 0,"dark"),isDark:true}}return e}function Sl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(xt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ki({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ar({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(xt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ed({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(xt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ct({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(xt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Cn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.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 Ue({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(xt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function xl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.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(xt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function No({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.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 Us({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.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(xt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(xt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Hs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.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 ri({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.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(xt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ns({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.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(xt.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 Yi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.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(xt.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(xt.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(xt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function td({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(xt.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(xt.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(xt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(xt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function od({size:e=28}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(xt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(xt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(xt.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 id({size:e=28}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(xt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(xt.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(xt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(xt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(xt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(xt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(xt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(xt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(xt.Defs,{children:jsxRuntime.jsx(xt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(xt.Rect,{width:28,height:28,fill:"white"})})})]})}function ld({size:e=28}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(xt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(xt.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(xt.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(xt.Defs,{children:jsxRuntime.jsx(xt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(xt.Rect,{width:28,height:28,fill:"white"})})})]})}function cd({size:e=28}){return jsxRuntime.jsxs(xt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(xt.Defs,{children:[jsxRuntime.jsxs(xt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(xt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(xt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(xt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(xt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(xt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(xt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(xt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(xt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(xt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(xt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(xt.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(xt.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(xt.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 dd({size:e=28}){return jsxRuntime.jsx(xt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(xt.G,{children:[jsxRuntime.jsx(xt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(xt.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 ii=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:od},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:id},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:ld},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:cd},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:dd}];function ud(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function js(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 $s(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=ii.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=ii.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Dt({onPress:e,title:t}){let{components:r,fonts:o}=O(),n=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:si.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(tt,{size:20,color:r.header.buttonColor,strokeWidth:2})});return t?jsxRuntime.jsxs(reactNative.View,{style:si.headerWithTitle,children:[jsxRuntime.jsx(reactNative.View,{style:si.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[si.headerTitleText,{color:r.header.titleColor},...o.bold?[{fontFamily:o.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),n]}):jsxRuntime.jsxs(reactNative.View,{style:si.header,children:[jsxRuntime.jsx(reactNative.View,{style:si.headerSpacer}),n]})}var qs={paddingTop:60,paddingBottom:16},si=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...qs},headerWithTitle:{flexDirection:"row",alignItems:"center",...qs},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Kt({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[pd.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[pd.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var pd=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function $o({quote:e,label:t,value:r,mono:o,last:n}){return jsxRuntime.jsxs(nn.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,o&&e.rowMono],children:r})]}),n?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function Pl({quote:e,label:t,address:r,last:o}){let[n,i]=nn.useState(false),{colors:s,components:a}=O(),l=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},d=ud(r);return jsxRuntime.jsxs(nn.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,e.rowMono,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:d}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:l,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:n?jsxRuntime.jsx(Ue,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(Cn,{size:14,color:a.card.actionIcon,strokeWidth:2})})]})]}),o?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function ai(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return nn.useMemo(()=>{let l=s.borderRadius,d=reactNative.Platform.OS==="ios"?"Menlo":"monospace",c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:48},content:{flex:1,paddingTop:16},title:{fontSize:28,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:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},g={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}:{}},numpad:{gap:4,marginBottom:24},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:68,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}:{}}},C={heroBox:{backgroundColor:s.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:l,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}},rowMono:{fontFamily:d,fontSize:13}},f=Math.max(16,Math.min(l,22)),y={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:f,borderTopRightRadius:f,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:f,borderBottomRightRadius:f,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},b={input:{fontSize:14,fontFamily:d},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},m={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:C,pm:y,wallet:b,flow:m,amount:g}},[e,t,o,n,i,s,a])}var _m=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function Gs({initialAmount:e="",currency:t="USD",onConfirm:r,onCancel:o}){let n=ai(),[i,s]=nn.useState(e),a=g=>{if(g==="\u232B"){s(C=>C.slice(0,-1));return}if(g==="."){if(i.includes("."))return;s(C=>C===""?"0.":C+".");return}s(C=>{let f=C.indexOf(".");return f!==-1&&C.length-f>2?C:C==="0"&&g!=="."?g:C+g});},l=i===""?"0":i,d=parseFloat(i),c=i!==""&&!isNaN(d)&&d>0;return jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:o,title:"Enter amount"}),jsxRuntime.jsxs(reactNative.View,{style:n.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:n.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[n.amount.amountText,l==="0"&&n.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",l]}),jsxRuntime.jsx(reactNative.Text,{style:n.amount.currencyLabel,children:t.toUpperCase()})]}),jsxRuntime.jsx(reactNative.View,{style:n.amount.numpad,children:_m.map((g,C)=>jsxRuntime.jsx(reactNative.View,{style:n.amount.numpadRow,children:g.map(f=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:n.amount.numpadKey,onPress:()=>a(f),activeOpacity:.6,children:jsxRuntime.jsx(reactNative.Text,{style:f==="\u232B"?n.amount.backspaceText:n.amount.numpadKeyText,children:f})},f))},C))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!c&&n.form.continueBtnDisabled],onPress:()=>c&&r(i),disabled:!c,children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!c&&n.form.continueBtnTextDisabled],children:"Continue"})})]})]})}function st({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=O(),l=i??a.warning,d=s??"#FBBF24",c=nn.useRef(new reactNative.Animated.Value(0)).current,g=nn.useId(),C=nn.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),f=(e-t)/2,y=2*Math.PI*f,b=e/2,m=o??Math.max(0,Math.round(e-t*2-8)),T=(e-m)/2;nn.useEffect(()=>{let p=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return p.start(),()=>p.stop()},[c]);let h=c.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:h}]},children:jsxRuntime.jsxs(xt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(xt.Defs,{children:jsxRuntime.jsxs(xt.LinearGradient,{id:C,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(xt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(xt.Stop,{offset:"100%",stopColor:d})]})}),jsxRuntime.jsx(xt.Circle,{cx:b,cy:b,r:f,stroke:`url(#${C})`,strokeWidth:t,fill:"none",strokeDasharray:`${y*.75} ${y*.25}`,strokeLinecap:"round",rotation:-90,origin:`${b}, ${b}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:T+1.5,left:T,width:m,height:m},children:r}):null]})}var es=4;function Js({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=ai(),{colors:i,fonts:s,components:a}=O(),l=a.input.placeholderColor,[d,c]=nn.useState(1),[g,C]=nn.useState(e.firstName??""),[f,y]=nn.useState(e.lastName??""),[b,m]=nn.useState(e.dobMonth??""),[T,h]=nn.useState(e.dobDay??""),[p,w]=nn.useState(e.dobYear??""),[x,_]=nn.useState(e.addressLine1??""),[F,k]=nn.useState(e.addressLine2??""),[S,I]=nn.useState(e.city??""),[E,L]=nn.useState(e.state??""),[R,H]=nn.useState(e.postalCode??""),[B,ge]=nn.useState(e.country??"US"),[je,Je]=nn.useState(e.idNumber??""),re=nn.useRef(null),ue=nn.useRef(null),Ze=nn.useRef(null),Ve=nn.useRef(null),$e=nn.useRef(null),ye=nn.useRef(null),Te=nn.useRef(null),Me=nn.useRef(null),nt=()=>{switch(d){case 1:return g.trim().length>0&&f.trim().length>0;case 2:return b.length===2&&T.length===2&&p.length===4;case 3:return x.trim().length>0&&S.trim().length>0&&E.trim().length>0&&R.trim().length>0;case 4:return je.trim().length>0;default:return false}},et=()=>{nt()&&(d<es?c(Z=>Z+1):r({firstName:g,lastName:f,idNumber:je,dobMonth:b,dobDay:T,dobYear:p,addressLine1:x,addressLine2:F,city:S,state:E,postalCode:R,country:B}));},lt=()=>{d>1?c(Z=>Z-1):o();},pt=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],xe=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],ct=[_t.stepCounter,{color:i.foregroundMuted},...s.semibold?[{fontFamily:s.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:_t.header,children:[jsxRuntime.jsx(reactNative.View,{style:_t.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:_t.iconButton,onPress:lt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:d>1?"Back":"Cancel",children:jsxRuntime.jsx(Ki,{size:20,color:a.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:_t.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:ct,children:[d," of ",es]})}),jsxRuntime.jsx(reactNative.View,{style:_t.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:_t.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(tt,{size:20,color:a.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:_t.progressTrack,children:Array.from({length:es}).map((Z,K)=>jsxRuntime.jsx(reactNative.View,{style:[_t.progressSegment,{backgroundColor:K<d||K+1===d?i.primary:i.border}]},K))}),jsxRuntime.jsxs(reactNative.ScrollView,{style:n.form.flex,contentContainerStyle:_t.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:pt[d-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:xe[d-1]}),d===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bo,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:g,onChangeText:C,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>re.current?.focus()})}),jsxRuntime.jsx(bo,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:re,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:f,onChangeText:y,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:et})})]}),d===2&&jsxRuntime.jsxs(reactNative.View,{style:_t.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:_t.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,_t.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,_t.dobInput],placeholder:"MM",placeholderTextColor:l,value:b,onChangeText:Z=>{let K=Z.replace(/\D/g,"").slice(0,2);m(K),K.length===2&&ue.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:_t.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,_t.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ue,style:[n.form.input,_t.dobInput],placeholder:"DD",placeholderTextColor:l,value:T,onChangeText:Z=>{let K=Z.replace(/\D/g,"").slice(0,2);h(K),K.length===2&&Ze.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:_t.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,_t.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ze,style:[n.form.input,_t.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:p,onChangeText:Z=>{let K=Z.replace(/\D/g,"").slice(0,4);w(K);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:et})]})]}),d===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bo,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:x,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Ve.current?.focus()})}),jsxRuntime.jsx(bo,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ve,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:F,onChangeText:k,returnKeyType:"next",onSubmitEditing:()=>$e.current?.focus()})}),jsxRuntime.jsx(bo,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:$e,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:S,onChangeText:I,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ye.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:_t.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx(bo,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ye,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:E,onChangeText:Z=>L(Z.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx(bo,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:R,onChangeText:H,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Me.current?.focus()})})})]}),jsxRuntime.jsx(bo,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Me,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:B,onChangeText:Z=>ge(Z.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:et})})]}),d===4&&jsxRuntime.jsxs(bo,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:je,onChangeText:Je,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:et}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,_t.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&d===es?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!nt()&&n.form.continueBtnDisabled],onPress:et,disabled:!nt(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!nt()&&n.form.continueBtnTextDisabled],children:d===es?"Submit":"Continue"})})})]})})}function bo({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 _t=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Mm="https://api.unifold.io",Fl="__UnifoldDevApiBaseUrl__",ar="pk_test_123",Zs={};function zm(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Fl];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function At(){return zm()??Mm}function Xs(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.'),ar=e.publishableKey;}e.defaultConfig&&(Zs=e.defaultConfig);}function wd(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[Fl]=t:delete globalThis[Fl];}function ts(){return At()}function ea(){return ar}function xr(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 zt(e){let t=e.startsWith("/")?e:`/${e}`;return `${At()}/api/public${t}`}function Q(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,At()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${At()}${e}`:`${At()}/api/public${e}`:""}async function wo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Zs.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||Zs.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Zs.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||ar;xr(n);let i=await fetch(`${At()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function To(e,t){return e.find(r=>r.chain_type===t)}async function So(e,t,r){let o=t||ar;xr(o);let n=await fetch(`${At()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function ta(e,t){let r=t||ar;xr(r);let o=await fetch(`${At()}/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 se(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 kn(e,t){let r=e||ar;xr(r);let o=`${At()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Vl(e,t){let r=t||ar;xr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${At()}/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 ra(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Ll(e,t){let r=t||ar;xr(r);let o=await fetch(`${At()}/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 Bl(e,t){let r=t||ar;xr(r);let o=await fetch(`${At()}/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 Wl(e,t){let r=t||ar;xr(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(`${At()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function Al(e){let t=e||ar;xr(t);let r=await fetch(`${At()}/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 ci(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 rs(e){let t=e||ar;xr(t);let r=await fetch(`${At()}/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 El(){let e=await fetch(`${At()}/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 oa(e,t,r){let o=e.find(i=>i.chain_id===r);if(o)return o.chain_name;let n=e.find(i=>i.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function os(){let e=await fetch(`${At()}/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 na(e){let t=e||ar;xr(t);let r=await fetch(`${At()}/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 Ml(e,t){let r=t||ar;xr(r);let o=await fetch(`${At()}/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 zl(e,t){return ta(e.deposit_wallet_id,t)}async function ia(e,t,r,o,n){let i=n||ar;xr(i);let s=await fetch(`${At()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}var Td="",Sd;function sa(e){Td=e;}function aa(e){Sd=e;}function Jr(){let e=Td||ea();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Zr(){return Sd??ts()}async function la(){let e=`${Zr()}/v1/public/onramps/headless/stripe/config`,t=Jr(),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 kd(e){let t=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 xd(e){let t=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Jr(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!t.ok)throw new Error(`Failed to exchange auth intent for tokens: ${t.status}`);return t.json()}async function _d(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(`${Zr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Rd(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 vd(e,t){let r=`${Zr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Jr(),"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 Id(e,t){let r=`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Jr(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function Pd(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Dd(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(`${Zr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Jr(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}async function Od(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Jr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}var $m=5,Fd={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function ca(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:i,authorize:s,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:d,registerWalletAddress:c,collectPaymentMethod:g,createCryptoPaymentToken:C}=stripeReactNative.useOnramp(),[f,y]=nn.useState(r),[b,m]=nn.useState(false),[T,h]=nn.useState(""),[p,w]=nn.useState(null),[x,_]=nn.useState(e?.email??""),[F,k]=nn.useState(e?.phone??""),[S,I]=nn.useState(""),[E,L]=nn.useState("US"),[R,H]=nn.useState(""),[B,ge]=nn.useState(""),[je,Je]=nn.useState(false),[re,ue]=nn.useState(false),Ze=nn.useRef(0),Ve=nn.useRef(false),$e=nn.useRef(false),ye=nn.useRef(false),Te=nn.useRef(""),Me=nn.useRef(null),[nt,et]=nn.useState(Fd),[lt,pt]=nn.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[xe,ct]=nn.useState(""),[Z,K]=nn.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[be,yt]=nn.useState(e?.defaultSourceAmount??"100"),[ze,Le]=nn.useState(e?.defaultSourceCurrency??"usd"),[_e,St]=nn.useState(e?.defaultDestinationCurrency??"usdc"),[Re,dt]=nn.useState(null),[ht,Be]=nn.useState(false),Ie=nn.useRef(null),Nt=nn.useRef(false),Wt=nn.useRef(0),wr=nn.useRef(e?.onComplete),ve=nn.useRef(e?.onError),qe=nn.useRef(e?.onStepChange),Qe=nn.useRef(r);nn.useEffect(()=>{wr.current=e?.onComplete;},[e?.onComplete]),nn.useEffect(()=>{ve.current=e?.onError;},[e?.onError]),nn.useEffect(()=>{qe.current=e?.onStepChange;},[e?.onStepChange]);let pr=nn.useRef(r);nn.useEffect(()=>{f!==pr.current&&(qe.current?.(f,pr.current),pr.current=f),Qe.current=f;},[f]);let N=nn.useCallback((D,Y,ne)=>{let v={code:D,message:Y,step:Qe.current,stripeErrorCode:ne};w(v),h(""),ve.current?.(v);},[]),te=nn.useCallback(D=>{let Y={sessionId:D.id,status:D.status,sourceAmount:D.transaction_details.source_amount,sourceCurrency:D.transaction_details.source_currency,destinationAmount:D.transaction_details.destination_amount,destinationCurrency:D.transaction_details.destination_currency,destinationNetwork:D.transaction_details.destination_network,walletAddress:D.transaction_details.wallet_address,fees:{networkFee:D.transaction_details.fees.network_fee_amount,transactionFee:D.transaction_details.fees.transaction_fee_amount}};return wr.current?.(Y),Y},[]),de=nn.useCallback(()=>w(null),[]);nn.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){Be(false);return}let Y=false;return stripeReactNative.isPlatformPaySupported().then(ne=>{Y||Be(ne);}),()=>{Y=true;}},[e?.merchantIdentifier]),nn.useEffect(()=>(Nt.current=false,()=>{Nt.current=true,Ie.current&&clearTimeout(Ie.current);}),[]),nn.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||je||re)return;let D=false;ue(true);async function Y(){try{let[ne,v]=await Promise.all([Dd({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?Od({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(kt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",kt?.message),null)):Promise.resolve(null)]);if(D)return;let M=e?.destinationChainType??"ethereum",Se=ne.data.find(kt=>kt.chain_type===M);if(Se?.address){let kt=Se.address.toLowerCase();pt(kt),Te.current=kt,Se.recipient_address&&ct(Se.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",M,"in",ne.data?.length,"wallets");let bt={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},Uo={8453:"base",1:"ethereum",137:"polygon"},Tr=v?.destination_network,sr="none";if(Tr&&bt[Tr])K(bt[Tr]),sr=Tr+" (from default_token API)";else if(e?.destinationChainId&&Uo[e.destinationChainId]){let kt=Uo[e.destinationChainId];bt[kt]&&K(bt[kt]),sr=kt+" (from chain_id "+e.destinationChainId+")";}else bt[M]&&(K(bt[M]),sr=M+" (from chain_type fallback)");v?.destination_currency&&St(v.destination_currency.toLowerCase()),Je(!0),ye.current=!0;}catch(ne){console.error("[useStripeOnramp] Failed to resolve wallet:",ne?.message),Je(true),ye.current=true;}finally{D||ue(false);}}return Y(),()=>{D=true;}},[e?.publishableKey,e?.externalUserId]);let ae=nn.useCallback(async()=>{if(Me.current)return Me.current;let D=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(Y=>(Y.error&&(console.error("[useStripeOnramp] configureSDK error:",Y.error.message,Y.error.code),Me.current=null),Y)).catch(Y=>{throw console.error("[useStripeOnramp] configureSDK threw:",Y?.message??Y),Me.current=null,Y});return Me.current=D,D},[o,e?.merchantDisplayName]);nn.useEffect(()=>{ae();},[]);let Ae=nn.useCallback(async D=>{if(!Ve.current){Ve.current=true,m(true),de(),h("Creating auth intent...");try{let Y=await kd(D);h("Waiting for authorization...");let ne=await s(Y);if(ne?.error){N("authorization_error",ne.error.message,ne.error.code),y("email");return}if(ne?.status==="Denied"){N("authorization_error","Authorization denied by user."),y("email");return}if(ne?.status!=="Consented"||!ne.customerId){N("authorization_error","Authorization was canceled."),y("email");return}h("Exchanging tokens...");let v=await xd(Y),M=ne.customerId,Se=v.access_token;H(M),ge(Se),h("Checking verification status...");try{let bt=await vd(M,Se),Uo=bt.verifications.find(go=>go.name==="kyc_verified"),Tr=bt.verifications.find(go=>go.name==="id_document_verified"),sr=Uo?.status==="verified",kt=Uo?.status==="rejected",Ho=Tr?.status==="verified",hl=bt.provided_fields.includes("first_name");if(h(""),kt&&!hl)N("kyc_error","KYC was previously rejected. Please submit with correct info."),y("kyc");else if(kt&&hl)y(Ho?"wallet":"identity");else if(!sr&&!hl)y("kyc");else if(!Ho)y("identity");else if(ye.current&&Te.current)try{let go=await c(Te.current,Z);go?.error?(N("wallet_error",go.error.message,go.error.code),y("wallet")):y(t?"payment_method":"session_params");}catch(go){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",go?.message),y("wallet");}else y("wallet");}catch(bt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",bt?.message),h(""),y("kyc");}}catch(Y){N("authorization_error",Y?.message??String(Y)),y("email");}finally{Ve.current=false,m(false);}}},[s,de,N,c,Z,t]),U=nn.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!x){N("validation_error","Please enter an email address.");return}m(true),de(),h("");try{h("Configuring...");let D=await ae();if(D.error){N("configuration_error",D.error.message,D.error.code);return}h("Checking Link account...");let Y=await n(x);if(Y.error){N("authorization_error",Y.error.message,Y.error.code);return}Y.hasLinkAccount?await Ae(x):(h(""),y("register"));}catch(D){N("unknown_error",D?.message??String(D));}finally{m(false);}},[de,ae,x,N,n,Ae]),J=nn.useCallback(async()=>{if(!F){N("validation_error","Please enter your phone number.");return}m(true),de(),h("");try{h("Creating Link account...");let D=await i({email:x,phone:F,fullName:S||x,country:E||"US"});if(D.error){N("registration_error",D.error.message,D.error.code);return}await Ae(x);}catch(D){N("registration_error",D?.message??String(D));}finally{m(false);}},[de,E,x,N,S,F,i,Ae]);nn.useEffect(()=>{if(f!=="email"||!e?.email)return;let D=++Ze.current,Y=false,ne=()=>Y||Ze.current!==D;return e?.phone?(async()=>{m(true),de();try{h("Configuring...");let v=await ae();if(ne())return;if(v.error){N("configuration_error",v.error.message,v.error.code);return}h("Checking Link account...");let M=await n(e.email);if(ne())return;if(M.error){N("authorization_error",M.error.message,M.error.code);return}if(M.hasLinkAccount){if(ne())return;await Ae(e.email);}else {h("Creating Link account...");let Se=await i({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(ne())return;if(Se.error){N("registration_error",Se.error.message,Se.error.code);return}if(ne())return;await Ae(e.email);}}catch(v){ne()||N("unknown_error",v?.message??String(v));}finally{m(false);}})():(async()=>{m(true),de();try{h("Configuring...");let v=await ae();if(ne())return;if(v.error){N("configuration_error",v.error.message,v.error.code);return}h("Checking Link account...");let M=await n(e.email);if(ne())return;if(M.error){N("authorization_error",M.error.message,M.error.code);return}if(M.hasLinkAccount){if(ne())return;await Ae(e.email);}else {if(ne())return;h(""),y("register");}}catch(v){ne()||N("unknown_error",v?.message??String(v));}finally{m(false);}})(),()=>{Y=true;}},[f,e?.email,e?.phone]);let pe=nn.useCallback(async D=>{m(true),de(),h(""),et(D);try{let Y={firstName:D.firstName,lastName:D.lastName,idNumber:D.idNumber||void 0,dateOfBirth:{day:parseInt(D.dobDay,10),month:parseInt(D.dobMonth,10),year:parseInt(D.dobYear,10)},address:{line1:D.addressLine1,line2:D.addressLine2||void 0,city:D.city,state:D.state,postalCode:D.postalCode,country:D.country}},ne=await a(Y);if(ne?.error){if(ne.error.stripeErrorCode==="consumer_person_already_verified"){h(""),y("identity");return}N("kyc_error",ne.error.message,ne.error.stripeErrorCode??ne.error.code),y("kyc");return}h("Please review your KYC information...");let v=await l(null);if(v?.error){N("kyc_error",v.error.message,v.error.stripeErrorCode??v.error.code),y("kyc");return}if(v?.status==="UpdateAddress"){N("kyc_error","Please update your address and resubmit."),y("kyc");return}h(""),y("identity");}catch(Y){N("kyc_error",Y?.message??String(Y)),y("kyc");}finally{m(false);}},[a,de,N,l]),oe=nn.useCallback(async()=>{if(!$e.current){$e.current=true,m(true),de(),h("Launching identity verification...");try{let D=await d();if(D?.error){N("identity_error",D.error.message,D.error.code);return}h(""),y("wallet");}catch(D){N("identity_error",D?.message??String(D));}finally{$e.current=false,m(false);}}},[de,N,d]);nn.useEffect(()=>{f==="identity"&&!b&&oe();},[f]);let X=nn.useCallback(async()=>{if(!lt){N("validation_error","Please enter a wallet address.");return}m(true),de(),h("");try{let D=await c(lt.toLowerCase(),Z);if(D?.error){N("wallet_error",D.error.message,D.error.code);return}h(""),y(t?"payment_method":"session_params");}catch(D){N("wallet_error",D?.message??String(D));}finally{m(false);}},[de,N,lt,Z,c,t]);nn.useEffect(()=>{f==="wallet"&&je&&lt&&!b&&X();},[f,je,lt]);let le=nn.useCallback((D,Y)=>{Nt.current=false,Wt.current=0;let ne=async()=>{try{let v=await Id(D,Y);if(Nt.current)return;Wt.current=0,v.status==="fulfillment_complete"?(dt(v),y("success"),te(v)):Ie.current=setTimeout(ne,3e3);}catch(v){if(Nt.current)return;if(Wt.current+=1,console.error("[pollSessionStatus] error:",v?.message),Wt.current>=$m){N("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}Ie.current=setTimeout(ne,5e3);}};Ie.current=setTimeout(ne,3e3);},[te,N]),it=nn.useCallback(()=>{Qe.current==="processing"&&(!Re?.id||!B||(de(),Wt.current=0,Ie.current&&(clearTimeout(Ie.current),Ie.current=null),le(Re.id,B)));},[B,de,le,Re?.id]),Xt=nn.useCallback(async D=>{m(true),de(),h("");try{h("Confirming purchase...");let Y=await Rd(D,B);dt(Y),y("processing"),h(""),le(Y.id,B);}finally{m(false);}},[B,de,le]),bn=nn.useCallback(async()=>{if(Re)try{await Xt(Re.id);}catch(D){N("session_error",D?.message??String(D)),y("quote");}},[N,Xt,Re]),pl=nn.useCallback(async(D=false)=>{if(!be||isNaN(Number(be))||Number(be)<=0){N("validation_error","Please enter a valid amount.");return}m(true),de(),h("");try{let Y;if(D){if(!e?.merchantIdentifier?.trim()){N("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),y("payment_method");return}h("Opening Apple Pay...");let Se={applePay:{merchantCountryCode:"US",currencyCode:ze.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${_e.toUpperCase()} purchase + fees`,amount:be||"0.00"}]}};Y=await g("PlatformPay",Se);}else h("Select a payment method..."),Y=await g("Card");if(Y?.error){N("payment_error",Y.error.message,Y.error.code),y("payment_method");return}if(!Y?.displayData){N("payment_error","Payment method selection was canceled."),y("payment_method");return}h("Creating payment token...");let ne=await C();if(ne?.error){N("payment_error",ne.error.message,ne.error.code),y("payment_method");return}let v=ne.cryptoPaymentToken;h("Creating onramp session...");let M=await _d({cryptoCustomerId:R,paymentToken:v,sourceAmount:Number(be),sourceCurrency:ze,destinationCurrency:_e,walletAddress:lt.toLowerCase(),destinationNetwork:Z},B);dt(M),h(""),D?await Xt(M.id):y("quote");}catch(Y){N("session_error",Y?.message??String(Y)),y("payment_method");}finally{m(false);}},[B,de,g,C,R,_e,N,Xt,be,ze,lt,Z,e?.merchantIdentifier]),ml=nn.useCallback(async()=>{if(Re){m(true),de(),h("");try{let D=await Pd(Re.id,B);dt(D);}catch(D){N("session_error",D?.message??String(D));}finally{m(false);}}},[B,de,N,Re]),fl=nn.useCallback(()=>{Nt.current=true,Wt.current=0,Ie.current&&(clearTimeout(Ie.current),Ie.current=null),y(r),m(false),h(""),w(null),_(e?.email??""),k(e?.phone??""),I(""),L("US"),H(""),ge(""),Je(false),ue(false),et(Fd),pt(e?.recipientAddress??""),K(stripeReactNative.Onramp.CryptoNetwork.ethereum),yt(e?.defaultSourceAmount??"100"),Le(e?.defaultSourceCurrency??"usd"),St(e?.defaultDestinationCurrency??"usdc"),dt(null),Ze.current+=1,Ve.current=false,$e.current=false;},[e,r]);return {step:f,loading:b,status:T,error:p,email:x,phone:F,fullName:S,country:E,customerId:R,accessToken:B,session:Re,kycData:nt,walletAddress:lt,resolvedRecipientAddress:xe,walletNetwork:Z,sourceAmount:be,sourceCurrency:ze,destinationCurrency:_e,applePaySupported:ht,walletReady:je,walletLoading:re,setStep:y,setStatus:h,setEmail:_,setPhone:k,setFullName:I,setCountry:L,setWalletAddress:pt,setWalletNetwork:K,setSourceAmount:yt,setSourceCurrency:Le,setDestinationCurrency:St,checkEmail:U,register:J,attachKyc:pe,verifyIdentity:oe,registerWallet:X,collectPaymentMethod:pl,refreshQuote:ml,confirmCheckout:bn,reset:fl,clearError:de,resumeFulfillmentPolling:it,amountFirst:t}}function Vd({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:d}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(st,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kt,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kt,{error:n,progress:i,loading:o})]})]})})}function Bd({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(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(Kt,{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 Ad({styles:e,loading:t,error:r,status:o,sourceAmount:n,sourceCurrency:i,destinationCurrency:s,walletNetwork:a,applePaySupported:l,collectPaymentMethod:d,onClose:c}){let{colors:g}=O(),C=ii.find(b=>b.value===a)?.label??a,f=n===""||n===void 0?"0":n,y=g.primaryForeground;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:c,title:"How do you want to pay?"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.payHint,children:"Select a payment method to continue"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.stackWrapper,children:[jsxRuntime.jsxs(reactNative.View,{style:[e.pm.swapCard,e.pm.swapCardTop],children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.summaryLabel,children:"You pay"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.swapRow,children:[jsxRuntime.jsxs(reactNative.Text,{style:e.pm.swapSpendAmount,numberOfLines:1,adjustsFontSizeToFit:true,children:["$",f]}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapPill,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapPillText,children:i.toUpperCase()})})]})]}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapConnectorWrap,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:e.pm.swapConnectorCircle,children:jsxRuntime.jsx(Ct,{size:20,color:y,strokeWidth:2.5})})}),jsxRuntime.jsxs(reactNative.View,{style:[e.pm.swapCard,e.pm.swapCardBottom],children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.summaryLabel,children:"You receive"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.swapRow,children:[jsxRuntime.jsx(reactNative.View,{style:e.pm.swapLeftCol,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapReceivePrimary,numberOfLines:1,adjustsFontSizeToFit:true,children:s.toUpperCase()})}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapPill,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapPillText,children:C.toUpperCase()})})]})]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[t?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.pm.applePayBtn,onPress:()=>d(true),children:jsxRuntime.jsxs(reactNative.Text,{style:e.pm.applePayBtnText,children:["Pay with ","\uF8FF"," Pay"]})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:()=>d(false),children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Pay with Card"})})]}),jsxRuntime.jsx(Kt,{error:r,progress:o,loading:t})]})]})}function Md({styles:e,error:t,status:r,loading:o,onClose:n,onRetryStatusCheck:i}){let s=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[s?jsxRuntime.jsx(Dt,{onPress:n}):jsxRuntime.jsx(reactNative.View,{style:qs}),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})}),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."]})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Kt,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Ud({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,refreshQuote:s,onClose:a}){let l=t.transaction_details,d=new Date(l.quote_expiration*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),c=l.wallet_address.slice(0,6)+"..."+l.wallet_address.slice(-4),g=js(l.destination_amount,l.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:a,title:"Review your purchase"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:e.quote.heroBox,children:[jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroLabel,children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroAmount,children:g}),jsxRuntime.jsxs(reactNative.Text,{style:e.quote.heroNetwork,children:[l.destination_currency.toUpperCase()," ",$s(l.destination_network)]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx($o,{quote:e.quote,label:"You pay",value:`${l.source_amount} ${l.source_currency.toUpperCase()}`}),jsxRuntime.jsx($o,{quote:e.quote,label:"Network fee",value:`$${l.fees.network_fee_amount}`}),jsxRuntime.jsx($o,{quote:e.quote,label:"Transaction fee",value:`$${l.fees.transaction_fee_amount}`}),jsxRuntime.jsx($o,{quote:e.quote,label:"Wallet",value:c,mono:true}),jsxRuntime.jsx($o,{quote:e.quote,label:"Quote expires",value:d,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})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Refresh Quote"})})]}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]})}function Hd({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:d}){let c=O();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(st,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:s,onChangeText:g=>a(g.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:i})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]})})}function Nd({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,onDone:n}){let{colors:i}=O(),s=t.transaction_details,a=js(s.destination_amount,s.destination_currency),l=r||o||"";return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:n,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(reactNative.ScrollView,{style:e.form.flex,contentContainerStyle:e.flow.successScrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.checkCircle,children:jsxRuntime.jsx(Ue,{size:40,color:i.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your crypto is on its way to your wallet."}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.heroBox,e.flow.detailCard],children:[jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroLabel,children:"You received"}),jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroAmount,children:a}),jsxRuntime.jsxs(reactNative.Text,{style:e.quote.heroNetwork,children:[s.destination_currency.toUpperCase()," ",$s(s.destination_network)]})]}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,e.flow.detailCard],children:[jsxRuntime.jsx(Pl,{quote:e.quote,label:"Deposit Address",address:s.wallet_address}),l?jsxRuntime.jsx(Pl,{quote:e.quote,label:"Recipient Address",address:l,last:true}):jsxRuntime.jsx($o,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),mono:true,last:true})]})]})}),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:"Done"})})})]})}function $d({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:d,registerWallet:c,onClose:g}){let{components:C}=O();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(st,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Dt,{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:C.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:ii.map(f=>{let y=s===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(f.value),d(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,y&&e.wallet.rowTextSelected],children:f.label}),y&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(Ue,{size:14,color:C.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})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:c,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kt,{error:o,progress:n,loading:r})]})]})})}function pa({config:e,onComplete:t}){let r=O(),o=ai(),{step:n,loading:i,status:s,error:a,email:l,phone:d,session:c,kycData:g,walletAddress:C,resolvedRecipientAddress:f,walletNetwork:y,sourceAmount:b,sourceCurrency:m,destinationCurrency:T,applePaySupported:h,setStep:p,setEmail:w,setPhone:x,setWalletAddress:_,setWalletNetwork:F,setSourceAmount:k,setDestinationCurrency:S,checkEmail:I,register:E,attachKyc:L,verifyIdentity:R,registerWallet:H,collectPaymentMethod:B,refreshQuote:ge,confirmCheckout:je,reset:Je,resumeFulfillmentPolling:re,amountFirst:ue}=ca(e),Ze=!!e?.email,Ve=!!e?.phone,$e=!!e?.publishableKey&&!!e?.externalUserId,ye=()=>{Je(),t?.();};return n==="email"?jsxRuntime.jsx(Vd,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Ze,loading:i,error:a,status:s,email:l,setEmail:w,checkEmail:I,onClose:ye}):n==="register"?jsxRuntime.jsx(Hd,{styles:o,hasPrefilledPhone:Ve,loading:i,error:a,status:s,email:l,phone:d,setPhone:x,register:E,onClose:ye}):n==="kyc"?jsxRuntime.jsx(Js,{initialData:g,loading:i,onComplete:L,onCancel:()=>p("email")}):n==="identity"?jsxRuntime.jsx(Bd,{styles:o,loading:i,status:s,error:a,verifyIdentity:R,onClose:ye}):n==="wallet"?jsxRuntime.jsx($d,{styles:o,hasAutoWallet:$e,loading:i,error:a,status:s,walletAddress:C,walletNetwork:y,setWalletAddress:_,setWalletNetwork:F,setDestinationCurrency:S,registerWallet:H,onClose:ye}):n==="session_params"?jsxRuntime.jsx(Gs,{initialAmount:b,currency:m,onConfirm:Te=>{k(Te),p(ue?"email":"payment_method");},onCancel:()=>{ue?ye():p("wallet");}}):n==="payment_method"?jsxRuntime.jsx(Ad,{styles:o,loading:i,error:a,status:s,sourceAmount:b,sourceCurrency:m,destinationCurrency:T,walletNetwork:y,applePaySupported:h,collectPaymentMethod:B,onClose:ye}):n==="quote"&&c?jsxRuntime.jsx(Ud,{styles:o,session:c,loading:i,error:a,status:s,confirmCheckout:je,refreshQuote:ge,onClose:ye}):n==="processing"?jsxRuntime.jsx(Md,{styles:o,error:a,status:s,loading:i,onClose:ye,onRetryStatusCheck:re}):n==="success"&&c?jsxRuntime.jsx(Nd,{styles:o,session:c,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,onDone:()=>{Je(),t?.();}}):null}function qd(){try{let e=df__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}}catch{}}function ma({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:d,onError:c,onStepChange:g,onClose:C,merchantIdentifier:f="",urlScheme:y="unifoldOnramp"}){let b=e||ea(),m=nn.useMemo(()=>{let _=f.trim();return _.length>0?_:qd()??""},[f]),[T,h]=nn.useState("loading"),[p,w]=nn.useState(null);nn.useEffect(()=>{let _=false;async function F(){try{b&&(sa(b),aa(ts()));let k=await la();if(_)return;let S=m.trim();if(await stripeReactNative.initStripe({publishableKey:k,urlScheme:y,...S?{merchantIdentifier:S}:{}}),_)return;h("ready");}catch(k){if(_)return;console.error("[StripeOnramp] Init failed:",k),w(k?.message??"Failed to load Stripe configuration"),h("error");}}return F(),()=>{_=true;}},[b,m,y]);let x=nn.useMemo(()=>{let _={publishableKey:b,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:d,onError:c,onStepChange:g};return a&&(_.destinationTokenAddress=a),l&&(_.recipientAddress=l),t&&(_.email=t),r&&(_.phone=r),n&&(_.flowOrder=n),_.merchantIdentifier=m,_},[b,o,i,s,a,l,t,r,n,m,d,c,g]);return T==="error"?jsxRuntime.jsxs(reactNative.View,{style:hi.centered,children:[jsxRuntime.jsx(reactNative.Text,{style:hi.errorText,children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:hi.errorDetail,children:p}),C&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hi.retryBtn,onPress:C,children:jsxRuntime.jsx(reactNative.Text,{style:hi.retryBtnText,children:"Go Back"})})]}):T==="loading"?jsxRuntime.jsx(reactNative.View,{style:hi.centered,children:jsxRuntime.jsx(st,{size:56,strokeWidth:3})}):jsxRuntime.jsx(pa,{config:x,onComplete:C})}var hi=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000",paddingHorizontal:24},errorText:{color:"#FF453A",fontSize:18,fontWeight:"600",marginBottom:8},errorDetail:{color:"#8E8E93",fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{backgroundColor:"#00D924",borderRadius:24,paddingVertical:14,paddingHorizontal:32},retryBtnText:{color:"#000000",fontSize:16,fontWeight:"700"}});function Yd(){let{configure:e}=stripeReactNative.useOnramp(),t=nn.useRef(false);return nn.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 Jd="__unifold_stripe_onramp__";function fa(e){globalThis[Jd]=e;}function Zd(){return globalThis[Jd]}fa(ma);var eo=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 Dn,Yo,gi,Xd,Cf=(Xd=class extends eo{constructor(){super();q(this,Dn);q(this,Yo);q(this,gi);V(this,gi,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){u(this,Yo)||this.setEventListener(u(this,gi));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Yo))==null||t.call(this),V(this,Yo,void 0));}setEventListener(t){var r;V(this,gi,t),(r=u(this,Yo))==null||r.call(this),V(this,Yo,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){u(this,Dn)!==t&&(V(this,Dn,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof u(this,Dn)=="boolean"?u(this,Dn):globalThis.document?.visibilityState!=="hidden"}},Dn=new WeakMap,Yo=new WeakMap,gi=new WeakMap,Xd),yi=new Cf;var wf={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},to,On,eu,Tf=(eu=class{constructor(){q(this,to,wf);q(this,On,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&u(this,On)&&e!==u(this,to)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:u(this,to),provider:e}),V(this,to,e),process.env.NODE_ENV!=="production"&&V(this,On,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&V(this,On,true),u(this,to).setTimeout(e,t)}clearTimeout(e){u(this,to).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&V(this,On,true),u(this,to).setInterval(e,t)}clearInterval(e){u(this,to).clearInterval(e);}},to=new WeakMap,On=new WeakMap,eu),ro=new Tf;function tu(e){setTimeout(e,0);}var Nl=typeof window>"u"||"Deno"in globalThis;function Et(){}function nu(e,t){return typeof e=="function"?e(t):e}function us(e){return typeof e=="number"&&e>=0&&e!==1/0}function ga(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Hr(e,t){return typeof e=="function"?e(t):e}function gr(e,t){return typeof e=="function"?e(t):e}function ya(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==ps(s,t.options))return false}else if(!Ln(t.queryKey,s))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||i&&!i(t))}function ba(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(Fn(t.options.mutationKey)!==Fn(i))return false}else if(!Ln(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function ps(e,t){return (t?.queryKeyHashFn||Fn)(e)}function Fn(e){return JSON.stringify(e,(t,r)=>Hl(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Ln(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Ln(e[r],t[r])):false}var Sf=Object.prototype.hasOwnProperty;function ha(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=ru(e)&&ru(t);if(!o&&!(Hl(e)&&Hl(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},d=0;for(let c=0;c<a;c++){let g=o?c:s[c],C=e[g],f=t[g];if(C===f){l[g]=C,(o?c<i:Sf.call(e,g))&&d++;continue}if(C===null||f===null||typeof C!="object"||typeof f!="object"){l[g]=f;continue}let y=ha(C,f,r+1);l[g]=y,y===C&&d++;}return i===a&&d===i?e:l}function Ca(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 ru(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hl(e){if(!ou(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!ou(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ou(e){return Object.prototype.toString.call(e)==="[object Object]"}function iu(e){return new Promise(t=>{ro.setTimeout(t,e);})}function ms(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 ha(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 ha(e,t)}return t}function su(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function au(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Vn=Symbol();function wa(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Vn&&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===Vn?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ta(e,t){return typeof e=="function"?e(...t):!!e}function lu(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 oo=(()=>{let e=()=>Nl;return {isServer(){return e()},setIsServer(t){e=t;}}})();function fs(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var cu=tu;function kf(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=cu,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var mt=kf();var bi,Jo,Ci,du,xf=(du=class extends eo{constructor(){super();q(this,bi,true);q(this,Jo);q(this,Ci);V(this,Ci,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){u(this,Jo)||this.setEventListener(u(this,Ci));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Jo))==null||t.call(this),V(this,Jo,void 0));}setEventListener(t){var r;V(this,Ci,t),(r=u(this,Jo))==null||r.call(this),V(this,Jo,t(this.setOnline.bind(this)));}setOnline(t){u(this,bi)!==t&&(V(this,bi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return u(this,bi)}},bi=new WeakMap,Jo=new WeakMap,Ci=new WeakMap,du),wi=new xf;function _f(e){return Math.min(1e3*2**e,3e4)}function jl(e){return (e??"online")==="online"?wi.isOnline():true}var Sa=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function ka(e){let t=false,r=0,o,n=fs(),i=()=>n.status!=="pending",s=b=>{if(!i()){let m=new Sa(b);C(m),e.onCancel?.(m);}},a=()=>{t=true;},l=()=>{t=false;},d=()=>yi.isFocused()&&(e.networkMode==="always"||wi.isOnline())&&e.canRun(),c=()=>jl(e.networkMode)&&e.canRun(),g=b=>{i()||(o?.(),n.resolve(b));},C=b=>{i()||(o?.(),n.reject(b));},f=()=>new Promise(b=>{o=m=>{(i()||d())&&b(m);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),y=()=>{if(i())return;let b,m=r===0?e.initialPromise:void 0;try{b=m??e.fn();}catch(T){b=Promise.reject(T);}Promise.resolve(b).then(g).catch(T=>{if(i())return;let h=e.retry??(oo.isServer()?0:3),p=e.retryDelay??_f,w=typeof p=="function"?p(r,T):p,x=h===true||typeof h=="number"&&r<h||typeof h=="function"&&h(r,T);if(t||!x){C(T);return}r++,e.onFail?.(r,T),iu(w).then(()=>d()?void 0:f()).then(()=>{t?C(T):y();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?y():f().then(y),n)}}var Bn,uu,xa=(uu=class{constructor(){q(this,Bn);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),us(this.gcTime)&&V(this,Bn,ro.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(oo.isServer()?1/0:300*1e3));}clearGcTimeout(){u(this,Bn)!==void 0&&(ro.clearTimeout(u(this,Bn)),V(this,Bn,void 0));}},Bn=new WeakMap,uu);var Wn,Ti,Vr,An,$t,hs,En,vr,gu,xo,fu,hu=(fu=class extends xa{constructor(t){super();q(this,vr);q(this,Wn);q(this,Ti);q(this,Vr);q(this,An);q(this,$t);q(this,hs);q(this,En);V(this,En,false),V(this,hs,t.defaultOptions),this.setOptions(t.options),this.observers=[],V(this,An,t.client),V(this,Vr,u(this,An).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,V(this,Wn,mu(this.options)),this.state=t.state??u(this,Wn),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return u(this,$t)?.promise}setOptions(t){if(this.options={...u(this,hs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=mu(this.options);r.data!==void 0&&(this.setState(pu(r.data,r.dataUpdatedAt)),V(this,Wn,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&u(this,Vr).remove(this);}setData(t,r){let o=ms(this.state.data,t,this.options);return Ce(this,vr,xo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Ce(this,vr,xo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=u(this,$t)?.promise;return u(this,$t)?.cancel(t),r?r.then(Et).catch(Et):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return u(this,Wn)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>gr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Hr(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!ga(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),u(this,$t)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),u(this,$t)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),u(this,Vr).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(u(this,$t)&&(u(this,En)||Ce(this,vr,gu).call(this)?u(this,$t).cancel({revert:true}):u(this,$t).cancelRetry()),this.scheduleGc()),u(this,Vr).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,vr,xo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&u(this,$t)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(u(this,$t))return u(this,$t).continueRetry(),u(this,$t).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(d=>d.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:()=>(V(this,En,true),o.signal)});},i=()=>{let l=wa(this.options,r),c=(()=>{let g={client:u(this,An),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return V(this,En,false),this.options.persister?this.options.persister(l,c,this):l(c)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:u(this,An),state:this.state,fetchFn:i};return n(l),l})();this.options.behavior?.onFetch(a,this),V(this,Ti,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Ce(this,vr,xo).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),V(this,$t,ka({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Sa&&l.revert&&this.setState({...u(this,Ti),fetchStatus:"idle"}),o.abort();},onFail:(l,d)=>{Ce(this,vr,xo).call(this,{type:"failed",failureCount:l,error:d});},onPause:()=>{Ce(this,vr,xo).call(this,{type:"pause"});},onContinue:()=>{Ce(this,vr,xo).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await u(this,$t).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),u(this,Vr).config.onSuccess?.(l,this),u(this,Vr).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Sa){if(l.silent)return u(this,$t).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Ce(this,vr,xo).call(this,{type:"error",error:l}),u(this,Vr).config.onError?.(l,this),u(this,Vr).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Wn=new WeakMap,Ti=new WeakMap,Vr=new WeakMap,An=new WeakMap,$t=new WeakMap,hs=new WeakMap,En=new WeakMap,vr=new WeakSet,gu=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},xo=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,...$l(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...pu(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return V(this,Ti,t.manual?n:void 0),n;case "error":let i=t.error;return {...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),mt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),u(this,Vr).notify({query:this,type:"updated",action:t});});},fu);function $l(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pu(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function mu(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 yr,Pe,ys,cr,Mn,Si,_o,Zo,bs,ki,xi,zn,Un,Xo,_i,Ke,gs,ql,Ql,Kl,Gl,Yl,Jl,Zl,wu,Cu,ec=(Cu=class extends eo{constructor(t,r){super();q(this,Ke);q(this,yr);q(this,Pe);q(this,ys);q(this,cr);q(this,Mn);q(this,Si);q(this,_o);q(this,Zo);q(this,bs);q(this,ki);q(this,xi);q(this,zn);q(this,Un);q(this,Xo);q(this,_i,new Set);this.options=r,V(this,yr,t),V(this,Zo,null),V(this,_o,fs()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(u(this,Pe).addObserver(this),yu(u(this,Pe),this.options)?Ce(this,Ke,gs).call(this):this.updateResult(),Ce(this,Ke,Gl).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Xl(u(this,Pe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xl(u(this,Pe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,Ke,Yl).call(this),Ce(this,Ke,Jl).call(this),u(this,Pe).removeObserver(this);}setOptions(t){let r=this.options,o=u(this,Pe);if(this.options=u(this,yr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof gr(this.options.enabled,u(this,Pe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,Ke,Zl).call(this),u(this,Pe).setOptions(this.options),r._defaulted&&!Ca(this.options,r)&&u(this,yr).getQueryCache().notify({type:"observerOptionsUpdated",query:u(this,Pe),observer:this});let n=this.hasListeners();n&&bu(u(this,Pe),o,this.options,r)&&Ce(this,Ke,gs).call(this),this.updateResult(),n&&(u(this,Pe)!==o||gr(this.options.enabled,u(this,Pe))!==gr(r.enabled,u(this,Pe))||Hr(this.options.staleTime,u(this,Pe))!==Hr(r.staleTime,u(this,Pe)))&&Ce(this,Ke,ql).call(this);let i=Ce(this,Ke,Ql).call(this);n&&(u(this,Pe)!==o||gr(this.options.enabled,u(this,Pe))!==gr(r.enabled,u(this,Pe))||i!==u(this,Xo))&&Ce(this,Ke,Kl).call(this,i);}getOptimisticResult(t){let r=u(this,yr).getQueryCache().build(u(this,yr),t),o=this.createResult(r,t);return vf(this,o)&&(V(this,cr,o),V(this,Si,this.options),V(this,Mn,u(this,Pe).state)),o}getCurrentResult(){return u(this,cr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&u(this,_o).status==="pending"&&u(this,_o).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){u(this,_i).add(t);}getCurrentQuery(){return u(this,Pe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=u(this,yr).defaultQueryOptions(t),o=u(this,yr).getQueryCache().build(u(this,yr),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Ce(this,Ke,gs).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),u(this,cr)))}createResult(t,r){let o=u(this,Pe),n=this.options,i=u(this,cr),s=u(this,Mn),a=u(this,Si),d=t!==o?t.state:u(this,ys),{state:c}=t,g={...c},C=false,f;if(r._optimisticResults){let S=this.hasListeners(),I=!S&&yu(t,r),E=S&&bu(t,o,r,n);(I||E)&&(g={...g,...$l(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:y,errorUpdatedAt:b,status:m}=g;f=g.data;let T=false;if(r.placeholderData!==void 0&&f===void 0&&m==="pending"){let S;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(S=i.data,T=true):S=typeof r.placeholderData=="function"?r.placeholderData(u(this,xi)?.state.data,u(this,xi)):r.placeholderData,S!==void 0&&(m="success",f=ms(i?.data,S,r),C=true);}if(r.select&&f!==void 0&&!T)if(i&&f===s?.data&&r.select===u(this,bs))f=u(this,ki);else try{V(this,bs,r.select),f=r.select(f),f=ms(i?.data,f,r),V(this,ki,f),V(this,Zo,null);}catch(S){V(this,Zo,S);}u(this,Zo)&&(y=u(this,Zo),f=u(this,ki),b=Date.now(),m="error");let h=g.fetchStatus==="fetching",p=m==="pending",w=m==="error",x=p&&h,_=f!==void 0,k={status:m,fetchStatus:g.fetchStatus,isPending:p,isSuccess:m==="success",isError:w,isInitialLoading:x,isLoading:x,data:f,dataUpdatedAt:g.dataUpdatedAt,error:y,errorUpdatedAt:b,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:h,isRefetching:h&&!p,isLoadingError:w&&!_,isPaused:g.fetchStatus==="paused",isPlaceholderData:C,isRefetchError:w&&_,isStale:tc(t,r),refetch:this.refetch,promise:u(this,_o),isEnabled:gr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let S=k.data!==void 0,I=k.status==="error"&&!S,E=H=>{I?H.reject(k.error):S&&H.resolve(k.data);},L=()=>{let H=V(this,_o,k.promise=fs());E(H);},R=u(this,_o);switch(R.status){case "pending":t.queryHash===o.queryHash&&E(R);break;case "fulfilled":(I||k.data!==R.value)&&L();break;case "rejected":(!I||k.error!==R.reason)&&L();break}}return k}updateResult(){let t=u(this,cr),r=this.createResult(u(this,Pe),this.options);if(V(this,Mn,u(this,Pe).state),V(this,Si,this.options),u(this,Mn).data!==void 0&&V(this,xi,u(this,Pe)),Ca(r,t))return;V(this,cr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!u(this,_i).size)return true;let s=new Set(i??u(this,_i));return this.options.throwOnError&&s.add("error"),Object.keys(u(this,cr)).some(a=>{let l=a;return u(this,cr)[l]!==t[l]&&s.has(l)})};Ce(this,Ke,wu).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,Ke,Gl).call(this);}},yr=new WeakMap,Pe=new WeakMap,ys=new WeakMap,cr=new WeakMap,Mn=new WeakMap,Si=new WeakMap,_o=new WeakMap,Zo=new WeakMap,bs=new WeakMap,ki=new WeakMap,xi=new WeakMap,zn=new WeakMap,Un=new WeakMap,Xo=new WeakMap,_i=new WeakMap,Ke=new WeakSet,gs=function(t){Ce(this,Ke,Zl).call(this);let r=u(this,Pe).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Et)),r},ql=function(){Ce(this,Ke,Yl).call(this);let t=Hr(this.options.staleTime,u(this,Pe));if(oo.isServer()||u(this,cr).isStale||!us(t))return;let o=ga(u(this,cr).dataUpdatedAt,t)+1;V(this,zn,ro.setTimeout(()=>{u(this,cr).isStale||this.updateResult();},o));},Ql=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(u(this,Pe)):this.options.refetchInterval)??false},Kl=function(t){Ce(this,Ke,Jl).call(this),V(this,Xo,t),!(oo.isServer()||gr(this.options.enabled,u(this,Pe))===false||!us(u(this,Xo))||u(this,Xo)===0)&&V(this,Un,ro.setInterval(()=>{(this.options.refetchIntervalInBackground||yi.isFocused())&&Ce(this,Ke,gs).call(this);},u(this,Xo)));},Gl=function(){Ce(this,Ke,ql).call(this),Ce(this,Ke,Kl).call(this,Ce(this,Ke,Ql).call(this));},Yl=function(){u(this,zn)!==void 0&&(ro.clearTimeout(u(this,zn)),V(this,zn,void 0));},Jl=function(){u(this,Un)!==void 0&&(ro.clearInterval(u(this,Un)),V(this,Un,void 0));},Zl=function(){let t=u(this,yr).getQueryCache().build(u(this,yr),this.options);if(t===u(this,Pe))return;let r=u(this,Pe);V(this,Pe,t),V(this,ys,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},wu=function(t){mt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(u(this,cr));}),u(this,yr).getQueryCache().notify({query:u(this,Pe),type:"observerResultsUpdated"});});},Cu);function Rf(e,t){return gr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function yu(e,t){return Rf(e,t)||e.state.data!==void 0&&Xl(e,t,t.refetchOnMount)}function Xl(e,t,r){if(gr(t.enabled,e)!==false&&Hr(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&tc(e,t)}return false}function bu(e,t,r,o){return (e!==t||gr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&tc(e,r)}function tc(e,t){return gr(t.enabled,e)!==false&&e.isStaleByTime(Hr(t.staleTime,e))}function vf(e,t){return !Ca(e.getCurrentResult(),t)}function rc(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,d=async()=>{let c=false,g=y=>{lu(y,()=>t.signal,()=>c=true);},C=wa(t.options,t.fetchOptions),f=async(y,b,m)=>{if(c)return Promise.reject();if(b==null&&y.pages.length)return Promise.resolve(y);let h=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:b,direction:m?"backward":"forward",meta:t.options.meta};return g(_),_})(),p=await C(h),{maxPages:w}=t.options,x=m?au:su;return {pages:x(y.pages,p,w),pageParams:x(y.pageParams,b,w)}};if(n&&i.length){let y=n==="backward",b=y?If:Tu,m={pages:i,pageParams:s},T=b(o,m);a=await f(m,T,y);}else {let y=e??i.length;do{let b=l===0?s[0]??o.initialPageParam:Tu(o,a);if(l>0&&b==null)break;a=await f(a,b),l++;}while(l<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d;}}}function Tu(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 If(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Cs,no,rr,Hn,io,en,Su,ku=(Su=class extends xa{constructor(t){super();q(this,io);q(this,Cs);q(this,no);q(this,rr);q(this,Hn);V(this,Cs,t.client),this.mutationId=t.mutationId,V(this,rr,t.mutationCache),V(this,no,[]),this.state=t.state||Pf(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){u(this,no).includes(t)||(u(this,no).push(t),this.clearGcTimeout(),u(this,rr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){V(this,no,u(this,no).filter(r=>r!==t)),this.scheduleGc(),u(this,rr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){u(this,no).length||(this.state.status==="pending"?this.scheduleGc():u(this,rr).remove(this));}continue(){return u(this,Hn)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Ce(this,io,en).call(this,{type:"continue"});},o={client:u(this,Cs),meta:this.options.meta,mutationKey:this.options.mutationKey};V(this,Hn,ka({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{Ce(this,io,en).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{Ce(this,io,en).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(this,rr).canRun(this)}));let n=this.state.status==="pending",i=!u(this,Hn).canStart();try{if(n)r();else {Ce(this,io,en).call(this,{type:"pending",variables:t,isPaused:i}),u(this,rr).config.onMutate&&await u(this,rr).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Ce(this,io,en).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await u(this,Hn).start();return await u(this,rr).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await u(this,rr).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),Ce(this,io,en).call(this,{type:"success",data:s}),s}catch(s){try{await u(this,rr).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await u(this,rr).config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Ce(this,io,en).call(this,{type:"error",error:s}),s}finally{u(this,rr).runNext(this);}}},Cs=new WeakMap,no=new WeakMap,rr=new WeakMap,Hn=new WeakMap,io=new WeakSet,en=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),mt.batch(()=>{u(this,no).forEach(o=>{o.onMutationUpdate(t);}),u(this,rr).notify({mutation:this,type:"updated",action:t});});},Su);function Pf(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Ro,Nr,ws,xu,_u=(xu=class extends eo{constructor(t={}){super();q(this,Ro);q(this,Nr);q(this,ws);this.config=t,V(this,Ro,new Set),V(this,Nr,new Map),V(this,ws,0);}build(t,r,o){let n=new ku({client:t,mutationCache:this,mutationId:++qi(this,ws)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){u(this,Ro).add(t);let r=_a(t);if(typeof r=="string"){let o=u(this,Nr).get(r);o?o.push(t):u(this,Nr).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(u(this,Ro).delete(t)){let r=_a(t);if(typeof r=="string"){let o=u(this,Nr).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&u(this,Nr).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=_a(t);if(typeof r=="string"){let n=u(this,Nr).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=_a(t);return typeof r=="string"?u(this,Nr).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){mt.batch(()=>{u(this,Ro).forEach(t=>{this.notify({type:"removed",mutation:t});}),u(this,Ro).clear(),u(this,Nr).clear();});}getAll(){return Array.from(u(this,Ro))}find(t){let r={exact:true,...t};return this.getAll().find(o=>ba(r,o))}findAll(t={}){return this.getAll().filter(r=>ba(t,r))}notify(t){mt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return mt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Et))))}},Ro=new WeakMap,Nr=new WeakMap,ws=new WeakMap,xu);function _a(e){return e.options.scope?.id}var so,Ru,vu=(Ru=class extends eo{constructor(t={}){super();q(this,so);this.config=t,V(this,so,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??ps(n,r),s=this.get(i);return s||(s=new hu({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){u(this,so).has(t.queryHash)||(u(this,so).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=u(this,so).get(t.queryHash);r&&(t.destroy(),r===t&&u(this,so).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){mt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return u(this,so).get(t)}getAll(){return [...u(this,so).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>ya(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>ya(t,o)):r}notify(t){mt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){mt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){mt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},so=new WeakMap,Ru);var Rt,tn,rn,Ri,vi,on,Ii,Pi,Iu,oc=(Iu=class{constructor(e={}){q(this,Rt);q(this,tn);q(this,rn);q(this,Ri);q(this,vi);q(this,on);q(this,Ii);q(this,Pi);V(this,Rt,e.queryCache||new vu),V(this,tn,e.mutationCache||new _u),V(this,rn,e.defaultOptions||{}),V(this,Ri,new Map),V(this,vi,new Map),V(this,on,0);}mount(){qi(this,on)._++,u(this,on)===1&&(V(this,Ii,yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Rt).onFocus());})),V(this,Pi,wi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Rt).onOnline());})));}unmount(){var e,t;qi(this,on)._--,u(this,on)===0&&((e=u(this,Ii))==null||e.call(this),V(this,Ii,void 0),(t=u(this,Pi))==null||t.call(this),V(this,Pi,void 0));}isFetching(e){return u(this,Rt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return u(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Rt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=u(this,Rt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Hr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return u(this,Rt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=u(this,Rt).get(o.queryHash)?.state.data,s=nu(t,i);if(s!==void 0)return u(this,Rt).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return mt.batch(()=>u(this,Rt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Rt).get(t.queryHash)?.state}removeQueries(e){let t=u(this,Rt);mt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=u(this,Rt);return mt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=mt.batch(()=>u(this,Rt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Et).catch(Et)}invalidateQueries(e,t={}){return mt.batch(()=>(u(this,Rt).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=mt.batch(()=>u(this,Rt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(Et)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(Et)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=u(this,Rt).build(this,t);return r.isStaleByTime(Hr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Et).catch(Et)}fetchInfiniteQuery(e){return e.behavior=rc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Et).catch(Et)}ensureInfiniteQueryData(e){return e.behavior=rc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return wi.isOnline()?u(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(this,Rt)}getMutationCache(){return u(this,tn)}getDefaultOptions(){return u(this,rn)}setDefaultOptions(e){V(this,rn,e);}setQueryDefaults(e,t){u(this,Ri).set(Fn(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...u(this,Ri).values()],r={};return t.forEach(o=>{Ln(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){u(this,vi).set(Fn(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...u(this,vi).values()],r={};return t.forEach(o=>{Ln(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(this,rn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=ps(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===Vn&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(this,rn).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){u(this,Rt).clear(),u(this,tn).clear();}},Rt=new WeakMap,tn=new WeakMap,rn=new WeakMap,Ri=new WeakMap,vi=new WeakMap,on=new WeakMap,Ii=new WeakMap,Pi=new WeakMap,Iu);var nc=nn__namespace.createContext(void 0),ic=e=>{let t=nn__namespace.useContext(nc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},sc=({client:e,children:t})=>(nn__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(nc.Provider,{value:e,children:t}));var Pu=nn__namespace.createContext(false),Du=()=>nn__namespace.useContext(Pu);Pu.Provider;function Of(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Ff=nn__namespace.createContext(Of()),Ou=()=>nn__namespace.useContext(Ff);var Vu=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Ta(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Lu=e=>{nn__namespace.useEffect(()=>{e.clearReset();},[e]);},Bu=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Ta(r,[e.error,o]));var Wu=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));}},Au=(e,t)=>e.isLoading&&e.isFetching&&!t,Eu=(e,t)=>e?.suspense&&t.isPending,ac=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Mu(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=Du(),n=Ou(),i=ic(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",Wu(s),Vu(s,n,a),Lu(n);let l=!i.getQueryCache().get(s.queryHash),[d]=nn__namespace.useState(()=>new t(i,s)),c=d.getOptimisticResult(s),g=!o&&e.subscribed!==false;if(nn__namespace.useSyncExternalStore(nn__namespace.useCallback(C=>{let f=g?d.subscribe(mt.batchCalls(C)):Et;return d.updateResult(),f},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),nn__namespace.useEffect(()=>{d.setOptions(s);},[s,d]),Eu(s,c))throw ac(s,d,n);if(Bu({result:c,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!oo.isServer()&&Au(c,o)&&(l?ac(s,d,n):a?.promise)?.catch(Et).finally(()=>{d.updateResult();}),s.notifyOnChangeProps?c:d.trackResult(c)}function vo(e,t){return Mu(e,ec)}function Oi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=nn.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),d=nn.useMemo(()=>{let f=o?.[l];return Cl(l,f,r)},[l,o,r]),c=nn.useMemo(()=>Qi(d,s,l),[d,s,l]),g=nn.useMemo(()=>i?{regular:i.regular||n,medium:i.medium||n,semibold:i.semibold||n,bold:i.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,i]),C=nn.useMemo(()=>({mode:l,colors:d,fonts:g,components:c,isDark:l==="dark"}),[l,d,g,c]);return jsxRuntime.jsx(wl.Provider,{value:C,children:e})}function Ge({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,showHandle:n=true,heightPercent:i,noPadding:s=false,borderTopLeftRadius:a=24,borderTopRightRadius:l=24}){let{colors:d,components:c}=O(),{height:g}=reactNative.useWindowDimensions(),C=nn.useRef(g);C.current=g;let f=nn.useRef(new reactNative.Animated.Value(g)).current,y=nn.useRef(new reactNative.Animated.Value(0)).current,b=i!=null&&i>=1;nn.useEffect(()=>{let T=C.current;e?(f.setValue(T),y.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(f,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(f,{toValue:T,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,f,y]);let m=()=>{o&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:[sn.container,reactNative.Platform.OS==="android"&&{paddingTop:reactNative.StatusBar.currentHeight}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[sn.backdrop,{backgroundColor:"#000000",opacity:y}],pointerEvents:"none"}),!b&&jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:m,children:jsxRuntime.jsx(reactNative.View,{style:sn.backdropTouchArea})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[sn.sheet,{maxHeight:g*.9,backgroundColor:d.background,borderTopLeftRadius:a,borderTopRightRadius:l,overflow:"hidden",transform:[{translateY:f}],shadowColor:c.sheet.shadowColor,shadowOffset:c.sheet.shadowOffset,shadowOpacity:c.sheet.shadowOpacity,shadowRadius:c.sheet.shadowRadius,elevation:c.sheet.elevation,...i&&{height:g*i,maxHeight:g*i},...b&&{paddingBottom:0},...s&&{paddingBottom:0}}],children:[n&&jsxRuntime.jsx(reactNative.View,{style:sn.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[sn.handle,{backgroundColor:d.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[sn.content,i&&sn.contentFlex],children:r})]})]})})}var sn=reactNative.StyleSheet.create({container:{flex:1},backdrop:{...reactNative.StyleSheet.absoluteFillObject},backdropTouchArea:{flex:1},sheet:{paddingBottom:reactNative.Platform.OS==="ios"?34:24},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});var Vi=new Map;function Nu({width:e,height:t,borderRadius:r,color:o}){let n=nn.useRef(new reactNative.Animated.Value(.3)).current;return nn.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ln({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=O(),[d,c]=nn.useState(false),[g,C]=nn.useState(false),[f,y]=nn.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=Vi.get(e);return x?{uri:e,xml:x}:null}),b=e?.toLowerCase().endsWith(".svg"),m=b&&e&&f?.uri===e?f.xml:null;nn.useEffect(()=>{c(false),C(false);},[e]),nn.useEffect(()=>{if(!b||!e)return;if(Vi.has(e)){y({uri:e,xml:Vi.get(e)});return}let x=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{x||(Vi.set(e,_),y({uri:e,xml:_}));}).catch(()=>{x||c(true);}),()=>{x=true;}},[e,b]);let T=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:T},a]});let h={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},p=t-n*2,w=r-n*2;return d?jsxRuntime.jsx(reactNative.View,{style:[h,{backgroundColor:s||T}]}):b?jsxRuntime.jsxs(reactNative.View,{style:h,children:[!!!m&&jsxRuntime.jsx(Nu,{width:p,height:w,borderRadius:o,color:T}),m?jsxRuntime.jsx(xt.SvgXml,{xml:m,width:p,height:w,onError:()=>c(true)}):jsxRuntime.jsx(xt.SvgUri,{uri:e,width:p,height:w,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:h,children:[!g&&jsxRuntime.jsx(Nu,{width:p,height:w,borderRadius:o,color:T}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:p,height:w},resizeMode:"contain",onLoad:()=>C(true),onError:()=>c(true)})]})}function uc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Vi.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Vi.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function dr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:d,balanceChainId:c,balanceTokenAddress:g,publishableKey:C,projectName:f,leftIcon:y,onLeftAction:b}){let{colors:m,fonts:T,components:h}=O(),[p,w]=nn.useState(null),[x,_]=nn.useState(false),F=nn.useState(()=>new reactNative.Animated.Value(0))[0];nn.useEffect(()=>{if(!x)return;let S=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(F,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(F,{toValue:0,duration:700,useNativeDriver:true})]));return S.start(),()=>S.stop()},[x,F]),nn.useEffect(()=>{if(!a||!l||!d||!c||!g||!C){w(null),_(false);return}let S=false;return _(true),ia(l,d,c,g,C).then(I=>{if(S)return;let E=I.balance,L=null;E&&(E.amount_usd!=null&&E.amount_usd!==""?L=`$${E.amount_usd}`:L="$0.00"),w(L);}).catch(()=>{S||w(null);}).finally(()=>{S||_(false);}),()=>{S=true;}},[a,l,d,c,g,C]);let k=F.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:or.header,children:[jsxRuntime.jsx(reactNative.View,{style:or.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[or.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ki,{size:20,color:h.header.buttonColor,strokeWidth:2})}):y&&b?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:b,style:[or.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:y}):jsxRuntime.jsx(reactNative.View,{style:or.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:or.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:or.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[or.title,{color:h.header.titleColor,fontFamily:T.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[or.titleBadge,{backgroundColor:m.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[or.titleBadgeText,{color:m.foregroundMuted,fontFamily:T.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[or.balanceText,{color:m.foregroundMuted,fontFamily:T.regular}],children:t}):null,a&&(x?jsxRuntime.jsx(reactNative.Animated.View,{style:[or.balanceSkeleton,{backgroundColor:m.cardHover,opacity:k}]}):p!=null?jsxRuntime.jsxs(reactNative.Text,{style:[or.balanceText,{color:m.foregroundMuted,fontFamily:T.regular}],children:[f?`${f} `:"","Balance: ",p]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:or.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[or.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:h.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:or.spacer})})]})}var or=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 Mt({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=O(),a=i??s.card,l=a.backShadowColor!=="transparent",d={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},c=[Qu.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[d,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Qu.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 Qu=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function ks({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=O(),s=i.depositMenu.card,a=o?[...o].sort((l,d)=>l.position-d.position):[];return jsxRuntime.jsxs(Mt,{cardTokens:s,onPress:e,style:lo.wrapper,contentStyle:lo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:lo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[lo.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Sl,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:lo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[lo.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[lo.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:lo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:lo.networkIcons,children:a.map((l,d)=>{let c=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[lo.networkIconWrapper,{marginLeft:d===0?0:-6,zIndex:a.length-d}],children:jsxRuntime.jsx(ln,{uri:Q(c),width:20,height:20})},l.name)})})})]})}var lo=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 _s({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=O(),s=i.depositMenu.card;return jsxRuntime.jsxs(Mt,{cardTokens:s,onPress:e,style:Io.wrapper,contentStyle:Io.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Io.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Io.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(kl,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Io.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Io.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Io.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Io.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Io.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(d=>d.format==="png")?.url||a.icon_urls.find(d=>d.format==="svg")?.url;return jsxRuntime.jsx(ln,{uri:Q(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var Io=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 Rs({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=O(),s=i.depositMenu.card;return jsxRuntime.jsx(Mt,{cardTokens:s,onPress:e,style:Po.wrapper,contentStyle:Po.container,children:jsxRuntime.jsxs(reactNative.View,{style:Po.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Po.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx(qr,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Po.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Po.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Po.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Po.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Po.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Po=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 Is({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),i=n.depositMenu.card;return jsxRuntime.jsxs(Mt,{cardTokens:i,onPress:e,style:co.wrapper,contentStyle:co.container,children:[jsxRuntime.jsxs(reactNative.View,{style:co.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[co.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ns,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:co.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[co.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[co.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:co.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:co.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[co.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var co=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 Ju=1e4,Zu=2500,Xu=3e3,ep=6e4;function Ps(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:i,modalOpenedAt:s,depositWalletId:a,depositExecutions:l,trackedExecutions:d,setDepositExecutions:c,setTrackedExecutions:g,setLatestExecution:C,setShowStatusSheet:f,onDepositSuccess:y,onExecutionsChange:b,onDepositError:m}=e,[T,h]=nn.useState(false),[p,w]=nn.useState(false);return nn.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;h(false),t==="auto_ui"&&w(false);let _=setTimeout(()=>{h(true),t==="auto_ui"&&w(true);},Ju);return ()=>clearTimeout(_)},[t,r,o]),nn.useEffect(()=>{if(!n||!s)return;let _=new Date(s.getTime()-ep),F=setInterval(async()=>{try{let I=[...(await So(n,i)).data??[]].sort((L,R)=>{let H=L.created_at?new Date(L.created_at).getTime():0;return (R.created_at?new Date(R.created_at).getTime():0)-H}),E=null;for(let L of I){let R=L.created_at?new Date(L.created_at):null;if(!R||R<=_)continue;let H=d.get(L.id);if(!H){E=L;break}if(["pending","waiting","delayed"].includes(H)&&L.status==="succeeded"){E=L;break}}if(E){let L=E;c(R=>{let H=R.findIndex(B=>B.id===L.id);if(H>=0){let B=[...R];return B[H]=L,B}return [...R,L]}),g(R=>{let H=new Map(R);return H.set(L.id,L.status),H}),C(L),f(!0),L.status==="succeeded"&&y?.({message:"Deposit completed successfully",executionId:L.id}),b?.([...l,L]);}}catch(k){m?.({message:"Failed to check deposit status",error:k});}},Zu);return ()=>clearInterval(F)},[n,i,s,d,l,b,y,m]),nn.useEffect(()=>{if(!T||!a)return;let _=async()=>{try{await ta(a,i);}catch{}};_();let F=setInterval(_,Xu);return ()=>clearInterval(F)},[T,a,i]),{pollingEnabled:T,showWaitingUi:p,handleIveDeposited:()=>{h(true),w(true);}}}function Ai({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:i,isDark:s}=O(),a=s?"#1a1a1a":"#ffffff",l=s?"#ffffff":"#000000",d=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[rp.container,{width:t,height:t}],children:[jsxRuntime.jsx(Xf__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[rp.logoContainer,{width:o+12,height:o+12,backgroundColor:d,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(ln,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var rp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function ip(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function oh(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=s<10?`0${s}`:s;return `${r} ${o}, ${n} at ${i}:${l}${a}`}function Ei({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:d}){let{colors:c,fonts:g,components:C}=O(),[f,y]=nn.useState(false),b=t==="pending"||t==="waiting"||t==="delayed",m=t==="succeeded",T=()=>{o&&reactNative.Linking.openURL(o);},h=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(Ge,{visible:e,onClose:a,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:d,children:jsxRuntime.jsxs(reactNative.View,{style:wt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wt.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:C.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:wt.iconContainer,children:b?jsxRuntime.jsx(st,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(r)},style:wt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[wt.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(r)},style:wt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[wt.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[wt.statusBadge,{backgroundColor:C.container.iconBackgroundColor}],children:jsxRuntime.jsx(Ue,{size:16,color:C.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[wt.title,{color:C.container.titleColor,fontFamily:g.semibold}],children:b?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[wt.amount,{color:C.container.titleColor,fontFamily:g.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsxRuntime.jsx(reactNative.Text,{style:[wt.date,{color:C.container.subtitleColor,fontFamily:g.regular}],children:oh(i)}),jsxRuntime.jsx(reactNative.Text,{style:[wt.subtitle,{color:C.container.subtitleColor,fontFamily:g.regular}],children:b?"This usually takes less than a minute.":"Your account has been credited successfully!"}),m&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:wt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[wt.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:wt.detailsToggle,onPress:()=>y(!f),children:[jsxRuntime.jsx(reactNative.Text,{style:[wt.detailsToggleText,{color:C.container.actionTitle,fontFamily:g.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(Kr,{size:18,color:C.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ct,{size:18,color:C.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:wt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[wt.txButton,{backgroundColor:C.card.backgroundColor,borderColor:c.border}],onPress:T,children:[jsxRuntime.jsx(reactNative.Text,{style:[wt.txLabel,{color:C.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[wt.txHash,{color:C.card.subtitleColor,fontFamily:g.regular}],children:ip(o)}),jsxRuntime.jsx(Qr,{size:16,color:C.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[wt.txButton,{backgroundColor:C.card.backgroundColor,borderColor:c.border}],onPress:h,children:[jsxRuntime.jsx(reactNative.Text,{style:[wt.txLabel,{color:C.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[wt.txHash,{color:C.card.subtitleColor,fontFamily:g.regular}],children:ip(n)}),jsxRuntime.jsx(Qr,{size:16,color:C.card.actionColor,strokeWidth:2})]})]})]})]})})}var wt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function Va({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:i,fonts:s,components:a}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[qn.iveDepositedButton,{backgroundColor:i.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[qn.iveDepositedButtonText,{color:i.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[qn.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[qn.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(xl,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qn.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[qn.processingCardTitle,{color:a.card.titleColor,fontFamily:s.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[qn.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:s.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var qn=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var Ds=(e,t)=>`${t}:${e}`,ph=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Ba({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:C,onDepositError:f,borderTopLeftRadius:y,borderTopRightRadius:b,sheetBorderRadius:m}){let{colors:T,fonts:h,components:p}=O(),w=a&&l?`${a}:${l}`:"solana:mainnet",[x,_]=nn.useState("USDC"),[F,k]=nn.useState(w),[S,I]=nn.useState([]),[E,L]=nn.useState(true),[R,H]=nn.useState([]),[B,ge]=nn.useState(true),[je,Je]=nn.useState(false),[re,ue]=nn.useState(false),[Ze,Ve]=nn.useState(false),[$e,ye]=nn.useState(false),[Te,Me]=nn.useState([]),[nt,et]=nn.useState(new Map),[lt]=nn.useState(()=>new Date),[pt,xe]=nn.useState(null),[ct,Z]=nn.useState(false),[K,be]=nn.useState(null),[yt,ze]=nn.useState(false),Le=new Map;R.forEach(U=>{U.chains.forEach(J=>{let pe=`${J.chain_type}:${J.chain_id}`;Le.has(pe)||Le.set(pe,J);});});let _e=Array.from(Le.values()),St=ph(F),dt=_e.find(U=>U.chain_type===St.chainType&&U.chain_id===St.chainId)?.chain_type||"ethereum",ht=To(S,dt),Be=ht?.address||"",Ie=nn.useRef(false);nn.useEffect(()=>{async function U(){try{ge(!0),xe(null);let pe=await kn(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(H(pe.data),pe.data.length>0&&!Ie.current){Ie.current=!0;let oe,X;if(a&&l)if(d)for(let le of pe.data){let it=le.chains.find(Xt=>Xt.chain_type===a&&Xt.chain_id===l&&Xt.token_address.toLowerCase()===d.toLowerCase());if(it){oe=le,X=it;break}}else for(let le of pe.data){let it=le.chains.find(Xt=>Xt.chain_type===a&&Xt.chain_id===l);if(it){oe=le,X=it;break}}if(!oe&&i)for(let le of pe.data){let it=le.chains.find(Xt=>Xt.token_address.toLowerCase()===i.toLowerCase());if(it){oe=le,X=it;break}}oe||(oe=pe.data.find(le=>le.symbol==="USDC"),oe&&oe.chains.length>0&&(X=oe.chains[0])),oe||(oe=pe.data.find(le=>le.symbol==="USDT"),oe&&oe.chains.length>0&&(X=oe.chains[0])),oe||(oe=pe.data[0],oe.chains.length>0&&(X=oe.chains[0])),oe&&_(oe.symbol),X&&k(Ds(X.chain_id,X.chain_type));}}catch(J){console.error("Error fetching supported tokens:",J),xe("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:J});}finally{ge(false);}}U();},[t,f,a,l,d,i,n,o]),nn.useEffect(()=>{async function U(){try{L(!0),xe(null);let J=await wo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);I(J.data);}catch(J){console.error("Error fetching wallets:",J),xe("Failed to load wallets"),f?.({message:"Failed to load wallets",error:J});}finally{L(false);}}U();},[e,r,o,n,i,t,f]);let Nt=ht?.id??"",{showWaitingUi:Wt,handleIveDeposited:wr}=Ps({depositConfirmationMode:c,depositAddress:Be,chain:F,externalUserId:e,publishableKey:t,modalOpenedAt:lt,depositWalletId:Nt,depositExecutions:Te,trackedExecutions:nt,setDepositExecutions:Me,setTrackedExecutions:et,setLatestExecution:be,setShowStatusSheet:Z,onDepositSuccess:C,onExecutionsChange:g,onDepositError:f});nn.useEffect(()=>{if(!R.length)return;let U=R.find(pe=>pe.symbol===x);if(!U||U.chains.length===0)return;if(!U.chains.some(pe=>Ds(pe.chain_id,pe.chain_type)===F)){let pe=U.chains[0];k(Ds(pe.chain_id,pe.chain_type));}},[x,R,F]);let ve=R.find(U=>U.symbol===x),qe=ve?.chains||[],Qe=qe.find(U=>Ds(U.chain_id,U.chain_type)===F),pr=async()=>{if(Be)try{reactNative.Clipboard.setString(Be),Je(!0),setTimeout(()=>Je(!1),2e3);}catch(U){console.error("Failed to copy:",U);}},N=Qe?.estimated_price_impact_percent??0,te=Qe?.max_slippage_percent??.25,de=Qe?.minimum_deposit_amount_usd??3;if(B)return jsxRuntime.jsxs(reactNative.View,{style:P.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[P.loadingText,{color:T.foregroundMuted,fontFamily:h.regular}],children:"Loading currencies..."})]});if(pt&&R.length===0)return jsxRuntime.jsxs(reactNative.View,{style:P.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[P.errorText,{color:T.error,fontFamily:h.regular}],children:pt}),jsxRuntime.jsx(reactNative.Text,{style:[P.errorHint,{color:T.foregroundMuted,fontFamily:h.regular}],children:"Please check your network connection and try again."})]});let ae=()=>jsxRuntime.jsxs(Ge,{visible:Ze,onClose:()=>Ve(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??y,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??b,children:[jsxRuntime.jsxs(reactNative.View,{style:[P.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:P.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[P.sheetTitle,{color:p.header.titleColor,fontFamily:h.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ve(false),style:P.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:P.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:R.map(U=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(U.symbol),Ve(false);},activeOpacity:.7,style:[P.sheetItem,{backgroundColor:x===U.symbol?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(U,"png"))},style:P.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:P.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[P.sheetItemTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:U.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[P.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:h.regular}],children:[U.chains.length," network",U.chains.length!==1?"s":""," available"]})]}),x===U.symbol&&jsxRuntime.jsx(Ue,{size:20,color:T.primary,strokeWidth:2})]},U.symbol))})]}),Ae=()=>jsxRuntime.jsxs(Ge,{visible:$e,onClose:()=>ye(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??y,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??b,children:[jsxRuntime.jsxs(reactNative.View,{style:[P.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:P.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[P.sheetTitle,{color:p.header.titleColor,fontFamily:h.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(false),style:P.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:P.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:qe.map(U=>{let J=Ds(U.chain_id,U.chain_type),pe=F===J;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k(J),ye(false);},activeOpacity:.7,style:[P.sheetItem,{backgroundColor:pe?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(U,"png"))},style:P.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:P.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[P.sheetItemTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:U.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[P.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:h.regular}],children:["Min deposit: $",U.minimum_deposit_amount_usd]})]}),pe&&jsxRuntime.jsx(Ue,{size:20,color:T.primary,strokeWidth:2})]},J)})})]});return jsxRuntime.jsxs(reactNative.View,{style:P.container,children:[jsxRuntime.jsxs(reactNative.View,{style:P.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[P.selectorLabel,{color:p.card.labelColor,fontFamily:h.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ve(true),style:[P.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[ve&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(ve,"png"))},style:P.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[P.selectorText,{color:p.card.titleColor,fontFamily:h.medium}],children:x}),jsxRuntime.jsx(Ct,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:P.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[P.selectorLabel,{color:p.card.labelColor,fontFamily:h.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[P.minDeposit,{fontFamily:h.regular}],children:["($",de," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(true),style:[P.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[Qe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(Qe,"png"))},style:P.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[P.selectorText,{color:p.card.titleColor,fontFamily:h.medium}],numberOfLines:1,children:Qe?.chain_name||"Select network"}),jsxRuntime.jsx(Ct,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:P.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[P.qrWrapper,{backgroundColor:T.background,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth>0?p.card.borderWidth:1,borderColor:p.card.borderColor}],children:E?jsxRuntime.jsxs(reactNative.View,{style:P.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}),jsxRuntime.jsx(reactNative.Text,{style:[P.loadingText,{color:T.foregroundMuted,fontFamily:h.regular}],children:"Loading..."})]}):Be?jsxRuntime.jsx(Ai,{value:Be,size:160,logoUri:Q(se(Qe,"png")||zt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:P.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[P.errorText,{color:T.error,fontFamily:h.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:P.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:P.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[P.addressLabel,{color:p.card.labelColor,fontFamily:h.medium}],children:"Deposit Address"}),je&&jsxRuntime.jsxs(reactNative.View,{style:P.copiedIndicator,children:[jsxRuntime.jsx(Ue,{size:14,color:T.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[P.copiedText,{color:T.success,fontFamily:h.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Mt,{cardTokens:p.transferCrypto.depositAddress.card,onPress:!E&&Be?pr:void 0,contentStyle:P.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[P.addressText,{color:p.card.titleColor,fontFamily:h.regular}],numberOfLines:2,children:E?"Loading...":Be||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:P.addressCopyIcon,children:jsxRuntime.jsx(Cn,{size:16,color:p.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[P.detailsCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(!re),style:P.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:P.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[P.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(qr,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[P.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:P.chevronContainer,children:re?jsxRuntime.jsx(Kr,{size:16,color:p.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ct,{size:16,color:p.card.actionColor,strokeWidth:2})})]}),re&&jsxRuntime.jsxs(reactNative.View,{style:P.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:P.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[P.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[P.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:["Price impact: ",N.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:P.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[P.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[P.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:["Slippage: Auto \u2022 ",te.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:P.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[P.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Us,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[P.detailsLabel,{color:p.card.titleColor,fontFamily:h.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Va,{depositConfirmationMode:c,depositAddress:Be,showWaitingUi:Wt,latestExecution:K,onIveDeposited:wr}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:P.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[P.termsText,{color:T.primary,fontFamily:h.regular}],children:"Terms apply"})}),ae(),Ae(),jsxRuntime.jsxs(Ge,{visible:yt,onClose:()=>ze(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:m?.infoSheet?.borderTopLeftRadius??y,borderTopRightRadius:m?.infoSheet?.borderTopRightRadius??b,children:[jsxRuntime.jsxs(reactNative.View,{style:[P.sheetHeader,{borderBottomColor:T.border}],children:[jsxRuntime.jsx(reactNative.View,{style:P.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[P.sheetTitle,{color:p.header.titleColor,fontFamily:h.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ze(false),style:P.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:P.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[P.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:P.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[P.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[P.infoCardTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[P.infoCardValue,{color:p.card.titleColor,fontFamily:h.medium}],children:[N.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[P.infoCardDescription,{color:p.card.descriptionColor,fontFamily:h.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:[P.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:P.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[P.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[P.infoCardTitle,{color:p.card.titleColor,fontFamily:h.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[P.infoCardValue,{color:p.card.titleColor,fontFamily:h.medium}],children:[te.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[P.infoCardDescription,{color:p.card.descriptionColor,fontFamily:h.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."})]})]})]}),K&&jsxRuntime.jsx(Ei,{visible:ct,status:K.status,tokenIconUrl:K.destination_token_metadata?.icon_urls?.find(U=>U.format==="png")?.url||K.destination_token_metadata?.icon_url||se(ve,"png"),explorerUrl:K.explorer_url,completionExplorerUrl:K.destination_explorer_url,date:K.created_at?new Date(K.created_at):void 0,amountUsd:K.source_amount_usd?parseFloat(K.source_amount_usd):void 0,onClose:()=>Z(false),borderTopLeftRadius:m?.depositStatus?.borderTopLeftRadius??y,borderTopRightRadius:m?.depositStatus?.borderTopRightRadius??b})]})}var P=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:{maxHeight:400,paddingTop:8},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 Wa({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Qn.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(e,"png"))},style:Qn.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Ue,{size:16,color:o.primary,strokeWidth:2})]})}var Qn=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 Fs({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:dp.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[dp.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(Wa,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var dp=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Ea({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:d,components:c}=O(),[g,C]=nn.useState(""),f=o.map(w=>r.find(x=>x.currency_code.toLowerCase()===w.toLowerCase())).filter(w=>w!==void 0),y=r.filter(w=>!o.includes(w.currency_code.toLowerCase())),b=w=>{if(!g)return w;let x=g.toLowerCase();return w.filter(_=>_.name.toLowerCase().includes(x)||_.currency_code.toLowerCase().includes(x))},m=b(f),T=b(y),h=w=>{i(w),t(false),C("");},p=()=>{t(false),C("");};return jsxRuntime.jsxs(Ge,{visible:e,onClose:p,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(dr,{title:"Currency",showBack:false,onClose:p}),jsxRuntime.jsx(reactNative.View,{style:Kn.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Kn.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:d.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:g,onChangeText:C,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Kn.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Kn.listContent,children:[jsxRuntime.jsx(Fs,{title:"Popular currencies",currencies:m,selectedCurrency:n,onSelect:h}),m.length>0&&T.length>0&&jsxRuntime.jsx(reactNative.View,{style:Kn.sectionSpacer}),jsxRuntime.jsx(Fs,{title:"All currencies",currencies:T,selectedCurrency:n,onSelect:h}),m.length===0&&T.length===0&&jsxRuntime.jsx(reactNative.View,{style:Kn.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Kn.noResultsText,{color:c.container.subtitleColor,fontFamily:d.regular}],children:"No currencies found"})})]})})]})}var Kn=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:24},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Fc(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 Ua({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:d,onDepositError:c,borderTopLeftRadius:g,borderTopRightRadius:C,sheetBorderRadius:f}){let{colors:y,fonts:b,components:m}=O(),[T,h]=nn.useState(""),[p,w]=nn.useState("usd"),[x,_]=nn.useState(false),[F,k]=nn.useState(false),[S,I]=nn.useState([]),[E,L]=nn.useState(false),[R,H]=nn.useState(null),[B,ge]=nn.useState(null),[je,Je]=nn.useState("amount"),[re,ue]=nn.useState(null),[Ze,Ve]=nn.useState(true),[$e,ye]=nn.useState(null),[Te,Me]=nn.useState(false),nt=nn.useRef(null),et=nn.useRef(false);nn.useEffect(()=>{nt.current=re;},[re]),nn.useEffect(()=>{et.current=Te;},[Te]);let[lt,pt]=nn.useState([]),[xe,ct]=nn.useState(true),[Z,K]=nn.useState(60),[be,yt]=nn.useState([]),[ze,Le]=nn.useState([]),[_e,St]=nn.useState(null),[Re,dt]=nn.useState(null),[ht,Be]=nn.useState(true),[Ie,Nt]=nn.useState(null),[Wt,wr]=nn.useState(false),[ve,qe]=nn.useState(null),[Qe,pr]=nn.useState(false),[N,te]=nn.useState(false),[de,ae]=nn.useState(false),[Ae,U]=nn.useState(null),J=r??je,pe=nn.useRef(null),oe=be.find(v=>v.currency_code.toLowerCase()===p.toLowerCase()),X=nn.useCallback(v=>{Je(v),v==="quotes"?o?.(v,S.length):o?.(v);},[S.length,o]);nn.useEffect(()=>{async function v(){try{let M=await os();dt(M);}catch(M){console.error("Error fetching user IP:",M);}finally{Be(false);}}v();},[]),nn.useEffect(()=>{async function v(){try{let M=await wo({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);pt(M.data);}catch(M){console.error("Error fetching wallets:",M),H("Failed to load wallet addresses");}finally{ct(false);}}v();},[e,i,s,a,l,t]);let le=n||_e?.symbol.toUpperCase()||"USDC",it=ci(_e?.icon_urls,"png")||_e?.icon_url,Xt=ci(_e?.chain_icon_urls,"png")||_e?.chain_icon_url;nn.useEffect(()=>{async function v(){try{let M=await Al(t);yt(M.data),Le(M.preferred||[]);}catch(M){console.error("Error fetching fiat currencies:",M);}}v();},[t]),nn.useEffect(()=>{if(x||be.length===0||!Re?.alpha2)return;let v=Re.alpha2.toUpperCase(),M=be.find(Se=>Se.country_codes.includes(v));if(M)w(M.currency_code.toLowerCase()),!T&&!F&&h(String(M.default_amount??100));else if(!T&&!F){let Se=be.find(bt=>bt.currency_code.toLowerCase()==="usd");Se&&h(String(Se.default_amount??100));}},[be,Re,x,T,F]),nn.useEffect(()=>{if(be.length!==0){if(pe.current!==null&&pe.current!==p){let v=be.find(M=>M.currency_code.toLowerCase()===p.toLowerCase());v&&h(String(v.default_amount??100));}pe.current=p;}},[p,be]),nn.useEffect(()=>{async function v(){try{let M=await Vl({chain_type:s||"",chain_id:a||"",token_address:l||""},t);St(M);}catch(M){console.error("Error fetching supported tokens:",M);}}v();},[s,a,l,t]),nn.useEffect(()=>{async function v(){if(!(!l||!a||!s)&&!ht){wr(true);try{let M=await Wl({country_code:Re?.alpha2?.toUpperCase()||"US",subdivision_code:Re?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);Nt(M);}catch(M){console.error("Error fetching default onramp token:",M);}finally{wr(false);}}}v();},[l,a,s,Re,ht,t]),nn.useEffect(()=>{let v=parseFloat(T);if(isNaN(v)||v<=0){I([]),ge(null);return}if(!Ie||Wt){I([]),ue(null);return}let M=be.find(bt=>bt.currency_code.toLowerCase()===p.toLowerCase());if(M){if(v<M.minimum_amount){I([]),ue(null),ge(`Minimum amount is ${Fc(p)}${M.minimum_amount.toLocaleString()}`);return}if(v>M.maximum_amount){I([]),ue(null),ge(`Maximum amount is ${Fc(p)}${M.maximum_amount.toLocaleString()}`);return}}ge(null);let Se=setTimeout(()=>{bn(v);},500);return ()=>clearTimeout(Se)},[T,p,t,Ie,Wt,be]);let bn=async v=>{if(!Ie){H("Loading token information...");return}L(true),H(null);try{let M={country_code:Re?.alpha2?.toUpperCase()||"US",source_amount:v.toString(),source_currency:p.toLowerCase(),destination_currency:Ie.destination_currency,destination_network:Ie.destination_network,subdivision_code:Re?.state||void 0},Se=await Ll(M,t);I(Se.data);let bt=et.current,Uo=nt.current;if(bt&&Uo){let Tr=Se.data.find(sr=>sr.service_provider===Uo.service_provider);if(Tr){if(ue(Tr),Se.data.length>0){let sr=Se.data.reduce((kt,Ho)=>Ho.destination_amount>kt.destination_amount?Ho:kt);$e||ye(sr.service_provider),Ve(Tr.service_provider===$e);}}else if(Se.data.length>0){let sr=Se.data.reduce((kt,Ho)=>Ho.destination_amount>kt.destination_amount?Ho:kt);ue(sr),ye(sr.service_provider),Ve(!0),Me(!1);}}else if(Se.data.length>0){let Tr=Se.data.reduce((sr,kt)=>kt.destination_amount>sr.destination_amount?kt:sr);ue(Tr),ye(Tr.service_provider),Ve(!0);}K(60);}catch(M){console.error("Failed to fetch quotes:",M),H("Failed to fetch quotes. Please try again."),I([]);}finally{L(false);}};nn.useEffect(()=>{if(S.length===0)return;let v=setInterval(()=>{K(M=>{if(M<=1){let Se=parseFloat(T);return !isNaN(Se)&&Se>0&&bn(Se),60}return M-1});},1e3);return ()=>clearInterval(v)},[S.length,T]);let pl=v=>{(/^\d*\.?\d{0,2}$/.test(v)||v==="")&&(h(v),k(true));},ml=v=>{h(v.toString()),k(true);},fl=async()=>{if(re&&Ie)try{let v=Ie.destination_token_metadata.chain_type,M=To(lt,v);if(!M?.address){H("Wallet address not available");return}let Se={service_provider:re.service_provider,country_code:re.country_code?.toUpperCase()||Re?.alpha2?.toUpperCase()||"US",source_currency:re.source_currency,source_amount:T,destination_currency:re.destination_currency,destination_network:re.destination_network,wallet_address:M.address,subdivision_code:Re?.state||void 0},bt=await Bl(Se,t);qe({provider:re,sourceCurrency:p,sourceAmount:T,sessionUrl:bt.url}),U(bt.url),ae(!0);}catch(v){console.error("Failed to create session:",v),H("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:v});}},D=Fc(p),Y=()=>{ae(false),X("onramp"),d?.({message:"Payment flow completed"});},ne=()=>jsxRuntime.jsx(vh,{visible:de,onClose:Y,url:Ae,providerName:re?.service_provider_display_name||"Complete Payment",colors:y,fonts:b,borderTopLeftRadius:f?.webView?.borderTopLeftRadius??g,borderTopRightRadius:f?.webView?.borderTopRightRadius??C});return J==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:z.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:z.scrollContainer,contentContainerStyle:z.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:z.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>pr(true),style:[z.currencyButton,{backgroundColor:m.card.backgroundColor,borderRadius:m.input.borderRadius,borderWidth:m.input.borderWidth,borderColor:m.input.borderColor}],children:[oe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(oe,"png"))},style:z.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[z.currencyText,{color:m.card.titleColor,fontFamily:b.medium}],children:p.toUpperCase()}),jsxRuntime.jsx(Ct,{size:16,color:m.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Ea,{open:Qe,onOpenChange:pr,currencies:be,preferredCurrencyCodes:ze,selectedCurrency:p,onSelectCurrency:v=>{w(v.toLowerCase()),_(true);},borderTopLeftRadius:f?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:f?.currencyModal?.borderTopRightRadius??C}),jsxRuntime.jsx(reactNative.View,{style:z.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:z.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.currencySymbol,{color:m.container.titleColor,fontFamily:b.medium}],children:D}),jsxRuntime.jsx(reactNative.TextInput,{style:[z.amountInput,{color:m.container.titleColor,fontFamily:b.medium}],value:T,onChangeText:pl,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:y.foregroundMuted})]})}),oe?.suggested_amounts&&oe.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:z.quickAmounts,children:oe.suggested_amounts.map(v=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ml(v),style:[z.quickAmountButton,{backgroundColor:m.card.backgroundColor,borderRadius:m.button.borderRadius,borderWidth:parseFloat(T)===v?2:m.button.borderWidth,borderColor:parseFloat(T)===v?y.primary:m.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[z.quickAmountText,{color:m.card.titleColor,fontFamily:b.medium}],children:[D,v.toLocaleString()]})},v))}),B&&jsxRuntime.jsx(reactNative.Text,{style:[z.validationError,{color:y.error,fontFamily:b.regular}],children:B}),jsxRuntime.jsxs(reactNative.View,{style:z.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:z.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.providerLabel,{color:m.card.labelColor,fontFamily:b.medium}],children:"Provider"}),S.length>0&&!E&&jsxRuntime.jsxs(reactNative.Text,{style:[z.refreshText,{color:m.card.labelRightColor,fontFamily:b.regular}],children:["Refreshing in ",Z,"s"]})]}),jsxRuntime.jsx(Mt,{cardTokens:m.depositCard.quoteProvider.card,onPress:E||S.length===0?void 0:()=>te(true),contentStyle:reactNative.StyleSheet.flatten([z.providerButton,(E||S.length===0)&&z.disabled]),children:E?jsxRuntime.jsxs(reactNative.View,{style:z.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:m.container.subtitleColor,fontFamily:b.regular}],children:"Finding best rates..."})]}):re?jsxRuntime.jsxs(reactNative.View,{style:z.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:z.providerInfo,children:[Ze&&jsxRuntime.jsx(reactNative.Text,{style:[z.autoPickedText,{color:m.container.subtitleColor,fontFamily:b.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:z.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(ra(re.icon_urls,"png",re.icon_url))},style:z.providerIconImage},`provider-${re.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[z.providerName,{color:m.card.titleColor,fontFamily:b.medium}],children:re.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[z.bestPriceText,{color:y.success,fontFamily:b.regular}],children:["Best price \u2022 ",re.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Ar,{size:20,color:m.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[z.noProviderText,{color:m.container.subtitleColor,fontFamily:b.regular}],children:parseFloat(T)>0?"No providers available":"Enter an amount to see providers"})}),R&&jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:y.error,fontFamily:b.regular}],children:R})]}),jsxRuntime.jsxs(Ge,{visible:N,onClose:()=>te(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:f?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:f?.providerModal?.borderTopRightRadius??C,children:[jsxRuntime.jsx(dr,{title:"Select Provider",showBack:false,onClose:()=>te(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:z.providerModalList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsx(reactNative.View,{style:z.quotesList,children:[...S].sort((v,M)=>M.destination_amount-v.destination_amount).map((v,M)=>{let Se=re?.service_provider===v.service_provider,bt=M===0;return jsxRuntime.jsxs(Mt,{cardTokens:m.depositCard.quoteProvider.card,onPress:()=>{ue(v),Me(true),Ve(v.service_provider===$e),te(false);},contentStyle:reactNative.StyleSheet.flatten([z.quoteItem,Se&&{borderWidth:2,borderColor:y.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:z.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(ra(v.icon_urls,"png",v.icon_url))},style:z.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[z.quoteName,{color:m.card.titleColor,fontFamily:b.medium}],children:v.service_provider_display_name}),bt&&jsxRuntime.jsx(reactNative.Text,{style:[z.bestPriceLabel,{color:y.success,fontFamily:b.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:z.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[z.quoteAmount,{color:m.card.textRightColor,fontFamily:b.medium}],children:[v.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[z.quoteSource,{color:m.card.subtextRightColor,fontFamily:b.regular}],children:["Fee: ",D,v.total_fee.toFixed(2)]})]})]},v.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[z.continueButtonContainer,{backgroundColor:y.background}],children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:fl,disabled:E||xe||!re||parseFloat(T)<=0,style:[z.continueButton,{backgroundColor:m.container.buttonColor,borderRadius:m.button.borderRadius,borderWidth:m.button.borderWidth,borderColor:m.button.borderColor},(E||xe||!re)&&z.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:[z.continueButtonText,{color:m.container.buttonTitleColor,fontFamily:b.medium}],children:xe?"Loading...":"Continue"})})})]}),ne()]}):J==="onramp"&&ve?jsxRuntime.jsxs(reactNative.View,{style:z.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(ra(ve.provider.icon_urls,"png",ve.provider.icon_url))},style:z.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[z.onrampTitle,{color:m.container.titleColor,fontFamily:b.medium}],children:["Complete transaction with ",ve.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[z.onrampSubtitle,{color:m.container.subtitleColor,fontFamily:b.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[z.flowDiagram,{backgroundColor:m.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:zt(`/icons/currencies/png/${ve.sourceCurrency.toLowerCase()}.png`)},style:z.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowLabel,{color:m.card.subtitleColor,fontFamily:b.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowValue,{color:m.card.titleColor,fontFamily:b.medium}],children:ve.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ar,{size:16,color:m.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:z.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:z.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ci(Ie?.destination_token_metadata?.icon_urls,"png")||Ie?.destination_token_metadata?.icon_url||zt("/icons/tokens/png/usdc.png")},style:z.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ci(Ie?.destination_token_metadata?.chain?.icon_urls,"png")||Ie?.destination_token_metadata?.chain?.icon_url||zt("/icons/networks/png/polygon.png")},style:[z.flowNetworkBadge,{borderColor:y.background,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowLabel,{color:m.card.subtitleColor,fontFamily:b.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowValue,{color:m.card.titleColor,fontFamily:b.medium}],children:"USDC"})]}),jsxRuntime.jsx(Ar,{size:16,color:m.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:z.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:z.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:it||zt("/icons/tokens/png/usdc.png")},style:z.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Xt||zt("/icons/networks/png/polygon.png")},style:[z.flowNetworkBadge,{borderColor:y.background,borderRadius:m.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowLabel,{color:m.card.subtitleColor,fontFamily:b.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[z.flowValue,{color:m.card.titleColor,fontFamily:b.medium}],children:le})]})]}),jsxRuntime.jsx(reactNative.View,{style:[z.onrampInfoBox,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[z.onrampInfoText,{color:m.card.descriptionColor,fontFamily:b.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 vh({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(Ge,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Gn.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Gn.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ue,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Gn.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Gn.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Gn.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Gn.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Gn.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Gn=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"}}),z=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:24},continueButton:{paddingVertical:16,alignItems:"center"},disabledButton:{opacity:.5},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:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Oh(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 Fh(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ja({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=Q(se(e.destination_token_metadata,"png")||zt("/icons/tokens/png/usdc.png")),d=s?"Deposit Processing":"Deposit Completed",c=Oh(e.created_at||new Date().toISOString()),g=Fh(e.source_amount_usd);return jsxRuntime.jsxs(Mt,{cardTokens:i,onPress:t,contentStyle:Vo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Vo.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Vo.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Vo.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(Hs,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Vo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vo.title,{color:i.titleColor,fontFamily:o.medium}],children:d}),jsxRuntime.jsx(reactNative.Text,{style:[Vo.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:Vo.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vo.amount,{color:i.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(Ar,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var Vo=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 gp(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 yp(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 Ah(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var bp=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Cp(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Eh(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 qa({visible:e,onClose:t,executions:r,externalUserId:o,publishableKey:n,borderTopLeftRadius:i,borderTopRightRadius:s}){let{height:a}=reactNative.useWindowDimensions(),{colors:l,fonts:d,components:c}=O(),[g,C]=nn.useState(r),[f,y]=nn.useState(false),[b,m]=nn.useState(null),[T,h]=nn.useState(false),p=nn.useRef(null);nn.useEffect(()=>{if(!e||!o)return;let S=async()=>{y(true);try{let L=[...(await So(o,n)).data].sort((R,H)=>{let B=R.created_at?new Date(R.created_at).getTime():0;return (H.created_at?new Date(H.created_at).getTime():0)-B});C(L);}catch(E){console.error("Failed to fetch executions:",E),C(r);}finally{y(false);}};S();let I=setInterval(S,1e4);return ()=>clearInterval(I)},[e,o,n,r]),nn.useEffect(()=>{r.length>0&&C(S=>{let I=new Set(S.map(L=>L.id)),E=r.filter(L=>!I.has(L.id));return E.length>0?[...E,...S]:S});},[r]),nn.useEffect(()=>{e||m(null);},[e]);let w=S=>{m(S);},x=()=>{m(null),h(false);},_=()=>{m(null),t();};return jsxRuntime.jsxs(Ge,{visible:e,onClose:_,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(dr,{title:b?"Deposit Details":"Deposit Tracker",onClose:_,showClose:!b,showBack:!!b,onBack:x}),b?(()=>{if(!b)return null;let S=b,I=S.status==="pending"||S.status==="waiting"||S.status==="delayed",E=S.status==="succeeded",L=Q(se(S.destination_token_metadata,"png")||zt("/icons/tokens/png/usdc.png")),R=S.provider_metadata?.details,H=R?.currencyIn,B=R?.currencyOut;H?.currency?.symbol||"USDC";B?.currency?.symbol||"USDC";let Je=yp(S.source_amount_base_unit,S.source_token_metadata?.decimals),re=yp(S.destination_amount_base_unit,S.destination_token_metadata?.decimals),ue=Ah(S.source_amount_usd),Ze=gp(S.source_chain_type,S.source_chain_id),Ve=gp(S.destination_chain_type,S.destination_chain_id),$e=()=>{S.explorer_url&&reactNative.Linking.openURL(S.explorer_url);},ye=()=>{S.destination_explorer_url&&reactNative.Linking.openURL(S.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:p,style:[ee.scrollContainer,{maxHeight:a*.7}],contentContainerStyle:ee.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L},style:ee.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ee.statusBadge,{backgroundColor:I?l.warning:l.success,borderColor:l.background}],children:I?jsxRuntime.jsx(Ct,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Ue,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ee.statusDot,{backgroundColor:I?l.warning:l.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.statusText,{color:c.container.titleColor,fontFamily:d.semibold}],children:I?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.dateText,{color:c.container.subtitleColor,fontFamily:d.regular}],children:Eh(S.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[ee.card,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:[Je," ",Cp(S.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ee.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:[re," ",Cp(S.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ee.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:ue})]}),jsxRuntime.jsx(reactNative.View,{style:[ee.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:Ze})]}),jsxRuntime.jsx(reactNative.View,{style:[ee.cardDivider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:Ve})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Te=!T;h(Te),Te?setTimeout(()=>{p.current?.scrollToEnd({animated:true});},100):p.current?.scrollTo({y:0,animated:true});},style:ee.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.toggleText,{color:c.container.actionTitle,fontFamily:d.regular}],children:T?"See less":"See more details"}),T?jsxRuntime.jsx(Kr,{size:14,color:c.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ct,{size:14,color:c.container.actionColor,strokeWidth:2})]}),T&&jsxRuntime.jsxs(reactNative.View,{style:[ee.card,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[S.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:$e,style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ee.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:bp(S.transaction_hash)}),jsxRuntime.jsx(Qr,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ee.cardDivider,{backgroundColor:l.border}]})]}),S.destination_explorer_url&&E&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ye,style:ee.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardLabel,{color:c.card.rowLeftLabel,fontFamily:d.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ee.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.cardValue,{color:c.card.rowRightLabel,fontFamily:d.medium}],children:bp(S.destination_transaction_hashes[0])}),jsxRuntime.jsx(Qr,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:[ee.scrollContainer,{maxHeight:a*.7}],contentContainerStyle:ee.scrollContent,showsVerticalScrollIndicator:false,children:g.length===0?jsxRuntime.jsxs(reactNative.View,{style:ee.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.emptyText,{color:c.container.titleColor,fontFamily:d.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[ee.emptySubtext,{color:c.container.subtitleColor,fontFamily:d.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:ee.executionsList,children:g.map(S=>jsxRuntime.jsx(ja,{execution:S,onPress:()=>w(S)},S.id))})})]})}var ee=reactNative.StyleSheet.create({scrollContainer:{paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},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 Vs(e,t=true){let[r,o]=nn.useState(null),[n,i]=nn.useState(null),[s,a]=nn.useState(false),[l,d]=nn.useState(false),[c,g]=nn.useState(null),[C,f]=nn.useState(null);nn.useEffect(()=>{!t||r||(a(true),os().then(T=>{o(T),g(null);}).catch(T=>{g(T instanceof Error?T:new Error(String(T)));}).finally(()=>{a(false);}));},[t,r]),nn.useEffect(()=>{!t||!e||n||(d(true),rs(e).then(T=>{i(T),f(null);}).catch(T=>{f(T instanceof Error?T:new Error(String(T)));}).finally(()=>{d(false);}));},[t,e,n]);let y=s||l,b=c||C||null,m=null;if(r&&n){let T=n.blocked_country_codes||[],h=r.alpha2.toUpperCase();m=!T.some(p=>p.toUpperCase()===h);}return {isAllowed:m,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:y,error:b}}var Ec="unifold_recent_tokens",Uh=5,xp=[{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 Ga(){try{let e=await Ac__default.default.getItem(Ec);return e?JSON.parse(e):[]}catch{return []}}async function Hh(e){try{let r=(await Ga()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Uh);await Ac__default.default.setItem(Ec,JSON.stringify(o));}catch{}}async function Nh(e){try{let r=(await Ga()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Ac__default.default.setItem(Ec,JSON.stringify(r)),r}catch{return []}}function Mc({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:d,components:c}=O(),[g,C]=nn.useState(""),[f,y]=nn.useState([]);nn.useEffect(()=>{e&&Ga().then(y);},[e]),nn.useEffect(()=>{e||C("");},[e]);let b=nn.useMemo(()=>{let x=[];return r.forEach(_=>{_.chains.forEach(F=>{x.push({token:_,chain:F});});}),x},[r]),m=nn.useMemo(()=>{let x=[],_=new Set,F=(k,S,I,E)=>{let L=`${k}-${S}:${I}`;if(_.has(L))return;let R=r.find(B=>B.symbol===k);if(!R)return;let H=R.chains.find(B=>B.chain_type===S&&B.chain_id===I);H&&(_.add(L),x.push({token:R,chain:H,isRecent:E}));};return f.forEach(k=>{F(k.symbol,k.chainType,k.chainId,true);}),xp.forEach(k=>{F(k.symbol,k.chainType,k.chainId,false);}),x},[r,f]),T=nn.useMemo(()=>{if(!g.trim())return b;let x=g.toLowerCase();return b.filter(({token:_,chain:F})=>_.symbol.toLowerCase().includes(x)||_.name.toLowerCase().includes(x)||F.chain_name.toLowerCase().includes(x))},[b,g]),h=(x,_,F)=>xp.some(k=>k.symbol===x&&k.chainType===_&&k.chainId===F),p=async(x,_)=>{let F=`${_.chain_type}:${_.chain_id}`;if(!h(x.symbol,_.chain_type,_.chain_id)){await Hh({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});let k=await Ga();y(k);}C(""),i(x.symbol,F),t();},w=async(x,_)=>{let F=await Nh({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});y(F);};return jsxRuntime.jsxs(Ge,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Ye.header,children:[jsxRuntime.jsx(reactNative.View,{style:Ye.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.headerTitle,{color:c.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ye.closeButton,children:jsxRuntime.jsx(tt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Ye.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ye.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:d.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:g,onChangeText:C,autoCapitalize:"none",autoCorrect:false})}),m.length>0&&!g&&jsxRuntime.jsxs(reactNative.View,{style:Ye.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ye.sectionLabel,{color:c.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ye.quickSelectScroll,children:m.map(({token:x,chain:_,isRecent:F})=>{let k=`${_.chain_type}:${_.chain_id}`;x.symbol===o&&k===n;return jsxRuntime.jsxs(reactNative.View,{children:[F&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>w(x,_),style:Ye.removeButton,children:jsxRuntime.jsx(tt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(x,_),activeOpacity:.7,style:[Ye.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ye.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(x,"png"))},style:Ye.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(_,"png"))},style:[Ye.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ye.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ye.quickSelectSymbol,{color:c.card.titleColor,fontFamily:d.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.quickSelectChain,{color:c.card.subtitleColor,fontFamily:d.regular}],children:_.chain_name})]})]})]},`quick-${x.symbol}-${k}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.sectionLabel,{color:c.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(reactNative.ScrollView,{style:Ye.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ye.tokenListContent,children:T.length===0?jsxRuntime.jsx(reactNative.View,{style:Ye.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ye.emptyText,{color:l.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):T.map(({token:x,chain:_})=>{let F=`${_.chain_type}:${_.chain_id}`,k=x.symbol===o&&F===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(x,_),activeOpacity:.7,style:[Ye.tokenItem,{backgroundColor:k?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ye.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(x,"png"))},style:Ye.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(_,"png"))},style:[Ye.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ye.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ye.tokenSymbol,{color:c.card.titleColor,fontFamily:d.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.tokenChainName,{color:c.card.subtitleColor,fontFamily:d.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Ye.minDeposit,{color:c.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${x.symbol}-${F}`)})})]})}var Ye=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:24,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 Ja=(e,t)=>`${t}:${e}`,Kh=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function zc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:C,onDepositError:f,wallets:y,borderTopLeftRadius:b,borderTopRightRadius:m,sheetBorderRadius:T}){let{colors:h,fonts:p,components:w}=O(),x=a&&l?`${a}:${l}`:"solana:mainnet",[_,F]=nn.useState("USDC"),[k,S]=nn.useState(x),[I,E]=nn.useState([]),[L,R]=nn.useState(!y?.length),H=y?.length?y:I,[B,ge]=nn.useState([]),[je,Je]=nn.useState(true),[re,ue]=nn.useState(false),[Ze,Ve]=nn.useState(false),[$e,ye]=nn.useState(false),[Te,Me]=nn.useState([]),[nt,et]=nn.useState(new Map),[lt]=nn.useState(()=>new Date),[pt,xe]=nn.useState(null),[ct,Z]=nn.useState(false),[K,be]=nn.useState(null),[yt,ze]=nn.useState(false),Le=new Map;B.forEach(ae=>{ae.chains.forEach(Ae=>{let U=`${Ae.chain_type}:${Ae.chain_id}`;Le.has(U)||Le.set(U,Ae);});});let _e=Array.from(Le.values()),St=Kh(k),Re=_e.find(ae=>ae.chain_type===St.chainType&&ae.chain_id===St.chainId),dt=Re?.chain_type||"ethereum",ht=To(H,dt),Be=ht?.address||"",Ie=nn.useRef(false);nn.useEffect(()=>{async function ae(){try{Je(!0),xe(null);let U=await kn(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(ge(U.data),U.data.length>0&&!Ie.current){Ie.current=!0;let J,pe;if(a&&l)if(d)for(let oe of U.data){let X=oe.chains.find(le=>le.chain_type===a&&le.chain_id===l&&le.token_address.toLowerCase()===d.toLowerCase());if(X){J=oe,pe=X;break}}else for(let oe of U.data){let X=oe.chains.find(le=>le.chain_type===a&&le.chain_id===l);if(X){J=oe,pe=X;break}}if(!J&&i)for(let oe of U.data){let X=oe.chains.find(le=>le.token_address.toLowerCase()===i.toLowerCase());if(X){J=oe,pe=X;break}}J||(J=U.data.find(oe=>oe.symbol==="USDC"),J&&J.chains.length>0&&(pe=J.chains[0])),J||(J=U.data.find(oe=>oe.symbol==="USDT"),J&&J.chains.length>0&&(pe=J.chains[0])),J||(J=U.data[0],J.chains.length>0&&(pe=J.chains[0])),J&&F(J.symbol),pe&&S(Ja(pe.chain_id,pe.chain_type));}}catch(Ae){console.error("Error fetching supported tokens:",Ae),xe("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:Ae});}finally{Je(false);}}ae();},[t,i,n,o,a,l,d,f]),nn.useEffect(()=>{g&&g(Te);},[Te,g]),nn.useEffect(()=>{if(y?.length){R(false);return}if(I.length>0){R(false);return}let ae=null,Ae=false,U=async()=>{if(!Ae){R(true);try{let J=await wo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);Ae||(E(J.data),xe(null),R(!1));}catch(J){console.error("Error fetching wallets, retrying in 5s:",J),Ae||(xe(J instanceof Error?J.message:"Failed to load wallets"),R(false),ae=setTimeout(U,5e3));}}};return U(),()=>{Ae=true,ae&&clearTimeout(ae);}},[e,r,o,n,i,t,y,I.length]);let Nt=ht?.id??"",{showWaitingUi:Wt,handleIveDeposited:wr}=Ps({depositConfirmationMode:c,depositAddress:Be,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:lt,depositWalletId:Nt,depositExecutions:Te,trackedExecutions:nt,setDepositExecutions:Me,setTrackedExecutions:et,setLatestExecution:be,setShowStatusSheet:Z,onDepositSuccess:C,onExecutionsChange:g,onDepositError:f});nn.useEffect(()=>{if(!B.length)return;let ae=B.find(U=>U.symbol===_);if(!ae||ae.chains.length===0)return;if(!ae.chains.some(U=>Ja(U.chain_id,U.chain_type)===k)){let U=ae.chains[0];S(Ja(U.chain_id,U.chain_type));}},[_,B,k]);let ve=B.find(ae=>ae.symbol===_),Qe=(ve?.chains||[]).find(ae=>Ja(ae.chain_id,ae.chain_type)===k),pr=async()=>{if(Be)try{reactNative.Clipboard.setString(Be),ue(!0),setTimeout(()=>ue(!1),2e3);}catch(ae){console.error("Failed to copy:",ae);}},N=Qe?.estimated_price_impact_percent??0,te=Qe?.max_slippage_percent??.25,de=Qe?.minimum_deposit_amount_usd??3;return je?jsxRuntime.jsxs(reactNative.View,{style:A.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:h.primary}),jsxRuntime.jsx(reactNative.Text,{style:[A.loadingText,{color:h.foregroundMuted,fontFamily:p.regular}],children:"Loading currencies..."})]}):pt&&B.length===0?jsxRuntime.jsxs(reactNative.View,{style:A.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.errorText,{color:h.error,fontFamily:p.regular}],children:pt}),jsxRuntime.jsx(reactNative.Text,{style:[A.errorHint,{color:h.foregroundMuted,fontFamily:p.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:A.container,children:[jsxRuntime.jsxs(reactNative.View,{style:A.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.selectorLabel,{color:w.card.labelColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ye(true),disabled:je||B.length===0,style:[A.tokenSelectorButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],activeOpacity:.7,children:je?jsxRuntime.jsxs(reactNative.View,{style:A.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[A.loadingIcon,{backgroundColor:h.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:A.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[A.loadingLine,{backgroundColor:h.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[A.loadingLine,{backgroundColor:h.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:A.tokenIconWrapper,children:[ve&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(ve,"png"))},style:A.tokenMainIcon}),(Qe||Re)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(Qe||Re,"png"))},style:[A.tokenChainBadge,{borderColor:w.card.backgroundColor,borderRadius:w.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:A.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.tokenSelectorSymbol,{color:w.card.titleColor,fontFamily:p.semibold}],children:ve?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[A.tokenSelectorNetwork,{color:w.card.subtitleColor,fontFamily:p.regular}],numberOfLines:1,children:Qe?.chain_name||Re?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:A.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[A.minDepositText,{color:w.card.labelHighlightRightColor,fontFamily:p.medium}],children:["$",de," min"]}),jsxRuntime.jsx(Ar,{size:16,color:w.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Mc,{visible:$e,onClose:()=>ye(false),tokens:B,selectedToken:_,selectedChainKey:k,onSelect:(ae,Ae)=>{F(ae),S(Ae);},borderTopLeftRadius:T?.tokenSelector?.borderTopLeftRadius??b,borderTopRightRadius:T?.tokenSelector?.borderTopRightRadius??m}),jsxRuntime.jsx(reactNative.View,{style:A.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[A.qrWrapper,{backgroundColor:h.background,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth>0?w.card.borderWidth:1,borderColor:w.card.borderColor}],children:L?jsxRuntime.jsxs(reactNative.View,{style:A.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:h.primary}),jsxRuntime.jsx(reactNative.Text,{style:[A.loadingText,{color:h.foregroundMuted,fontFamily:p.regular}],children:"Loading..."})]}):Be?jsxRuntime.jsx(Ai,{value:Be,size:180,logoUri:Q(se(Qe,"png")||zt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:A.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[A.errorText,{color:h.error,fontFamily:p.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:A.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:A.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.addressLabel,{color:w.card.labelColor,fontFamily:p.medium}],children:"Deposit Address"}),re&&jsxRuntime.jsxs(reactNative.View,{style:A.copiedIndicator,children:[jsxRuntime.jsx(Ue,{size:14,color:h.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[A.copiedText,{color:h.success,fontFamily:p.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Mt,{cardTokens:w.transferCrypto.depositAddress.card,onPress:!L&&Be?pr:void 0,contentStyle:A.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[A.addressText,{color:w.card.titleColor,fontFamily:p.regular}],numberOfLines:2,children:L?"Loading...":Be||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:A.addressCopyIcon,children:jsxRuntime.jsx(Cn,{size:16,color:w.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[A.detailsCard,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ve(!Ze),style:A.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:w.card.iconBackgroundColor,borderRadius:w.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(qr,{size:12,color:w.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[A.detailsLabel,{color:w.card.titleColor,fontFamily:p.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:A.chevronContainer,children:Ze?jsxRuntime.jsx(Kr,{size:16,color:w.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ct,{size:16,color:w.card.actionColor,strokeWidth:2})})]}),Ze&&jsxRuntime.jsxs(reactNative.View,{style:A.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:w.card.iconBackgroundColor,borderRadius:w.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:12,color:w.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[A.detailsLabel,{color:w.card.titleColor,fontFamily:p.regular}],children:["Price impact: ",N.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:w.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:w.card.iconBackgroundColor,borderRadius:w.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:12,color:w.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[A.detailsLabel,{color:w.card.titleColor,fontFamily:p.regular}],children:["Slippage: Auto \u2022 ",te.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ri,{size:14,color:w.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[A.detailIcon,{backgroundColor:w.card.iconBackgroundColor,borderRadius:w.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Us,{size:12,color:w.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[A.detailsLabel,{color:w.card.titleColor,fontFamily:p.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Va,{depositConfirmationMode:c,depositAddress:Be,showWaitingUi:Wt,latestExecution:K,onIveDeposited:wr}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:A.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[A.termsText,{color:h.primary,fontFamily:p.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Ge,{visible:yt,onClose:()=>ze(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:T?.infoSheet?.borderTopLeftRadius??b,borderTopRightRadius:T?.infoSheet?.borderTopRightRadius??m,children:[jsxRuntime.jsxs(reactNative.View,{style:[A.sheetHeader,{borderBottomColor:h.border}],children:[jsxRuntime.jsx(reactNative.View,{style:A.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[A.sheetTitle,{color:w.header.titleColor,fontFamily:p.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ze(false),style:A.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:w.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:A.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[A.infoCard,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:A.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[A.infoCardIcon,{backgroundColor:w.card.iconBackgroundColor,borderRadius:w.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:16,color:w.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardTitle,{color:w.card.titleColor,fontFamily:p.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[A.infoCardValue,{color:w.card.titleColor,fontFamily:p.medium}],children:[N.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardDescription,{color:w.card.descriptionColor,fontFamily:p.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[A.infoCard,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:A.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[A.infoCardIcon,{backgroundColor:w.card.iconBackgroundColor,borderRadius:w.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:16,color:w.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardTitle,{color:w.card.titleColor,fontFamily:p.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[A.infoCardValue,{color:w.card.titleColor,fontFamily:p.medium}],children:[te.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[A.infoCardDescription,{color:w.card.descriptionColor,fontFamily:p.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),K&&jsxRuntime.jsx(Ei,{visible:ct,status:K.status,tokenIconUrl:K.destination_token_metadata?.icon_urls?.find(ae=>ae.format==="png")?.url||K.destination_token_metadata?.icon_url||se(ve,"png"),explorerUrl:K.explorer_url,completionExplorerUrl:K.destination_explorer_url,date:K.created_at?new Date(K.created_at):void 0,amountUsd:K.source_amount_usd?parseFloat(K.source_amount_usd):void 0,onClose:()=>Z(false),borderTopLeftRadius:T?.depositStatus?.borderTopLeftRadius??b,borderTopRightRadius:T?.depositStatus?.borderTopRightRadius??m})]})}var A=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 Bo={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 Xh(){let{colors:e,components:t}=O(),r=nn.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;nn.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]);let i=({rightIcons:s=2})=>jsxRuntime.jsxs(reactNative.View,{style:[hn.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hn.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:hn.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hn.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[hn.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:hn.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[hn.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:hn.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var hn=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 eg({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,defaultChainType:c,defaultChainId:g,defaultTokenAddress:C,showBalance:f=false,hideDepositTracker:y=false,enableStripeLinkPay:b=false,StripeOnrampComponent:m,stripeOnrampEmail:T,stripeOnrampPhone:h,stripeMerchantIdentifier:p,stripeTheme:w,depositConfirmationMode:x="auto_ui",transferInputVariant:_="double_input",initialScreen:F="main",onDepositSuccess:k,onDepositError:S,sheetBorderRadius:I}){let E=I?.globalBorderTopLeftRadius,L=I?.globalBorderTopRightRadius,{colors:R,fonts:H}=O(),[B,ge]=nn.useState([]),[je,Je]=nn.useState(()=>F==="tracker"&&!y),[re,ue]=nn.useState(()=>F==="transfer"),[Ze,Ve]=nn.useState(()=>F==="card"),[$e,ye]=nn.useState(false),[Te,Me]=nn.useState(null),[nt,et]=nn.useState("amount"),{isAllowed:lt,isLoading:pt}=Vs(o,e);nn.useEffect(()=>{if(!e||Te)return;let _e=false;return rs(o).then(async St=>{if(_e)return;let Re=[];for(let dt of St?.transfer_crypto?.networks??[]){let ht=dt.icon_urls.find(Be=>Be.format==="png")?.url||dt.icon_urls.find(Be=>Be.format==="svg")?.url;ht&&Re.push(Q(ht));}for(let dt of St?.payment_networks?.networks??[]){let ht=dt.icon_urls.find(Be=>Be.format==="png")?.url||dt.icon_urls.find(Be=>Be.format==="svg")?.url;ht&&Re.push(Q(ht));}Re.length>0&&await uc(Re),_e||Me(St);}).catch(console.error),()=>{_e=true;}},[e,Te,o]);let xe=()=>{t();},ct=F==="main"||F==="tracker"&&y,Z=B.filter(_e=>_e.status==="pending"||_e.status==="waiting").length,be=!!(s&&a&&l&&d&&o)&&f!==false&&!!Te,yt=pt||e&&!Te,ze=lt===false,Le=null;if($e&&m){let _e=jsxRuntime.jsx(m,{publishableKey:o,email:T,phone:h,externalUserId:r,recipientAddress:s??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,merchantIdentifier:p,onClose:()=>ye(false)});Le=w?jsxRuntime.jsx(Oi,{...w,children:_e}):_e;}return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Ge,{visible:e&&ct,onClose:xe,closeOnBackdropPress:false,showHandle:false,borderTopLeftRadius:I?.main?.borderTopLeftRadius??E,borderTopRightRadius:I?.main?.borderTopRightRadius??L,children:[jsxRuntime.jsx(dr,{title:n,showBack:false,onClose:xe,showBalance:be,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Te?.project_name}),yt&&jsxRuntime.jsx(Xh,{}),!yt&&ze&&jsxRuntime.jsxs(reactNative.View,{style:ir.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ir.iconContainer,{backgroundColor:R.cardHover}],children:jsxRuntime.jsx(Yi,{size:32,color:R.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ir.blockedTitle,{color:R.foreground,fontFamily:H.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[ir.blockedDescription,{color:R.foreground,opacity:.7,fontFamily:H.regular}],children:"There are no supported tokens available from your current location."})]}),!yt&&!ze&&jsxRuntime.jsxs(reactNative.View,{style:ir.optionsContainer,children:[jsxRuntime.jsx(ks,{onPress:()=>ue(true),title:Bo.transferCrypto.title,subtitle:Bo.transferCrypto.subtitle,featuredTokens:Te?.transfer_crypto?.networks}),jsxRuntime.jsx(_s,{onPress:()=>Ve(true),title:Bo.depositWithCard.title,subtitle:Bo.depositWithCard.subtitle,paymentNetworks:Te?.payment_networks?.networks}),b&&m&&jsxRuntime.jsx(Is,{onPress:()=>ye(true),title:Bo.stripeLinkPay.title,subtitle:Bo.stripeLinkPay.subtitle}),!y&&jsxRuntime.jsx(Rs,{onPress:()=>Je(true),title:Bo.depositTracker.title,subtitle:Bo.depositTracker.subtitle,badge:Z>0?Z:void 0})]})]}),jsxRuntime.jsx(qa,{visible:e&&je,onClose:()=>{Je(false),ct||xe();},executions:B,externalUserId:r,publishableKey:o,borderTopLeftRadius:I?.depositsTracker?.borderTopLeftRadius??E,borderTopRightRadius:I?.depositsTracker?.borderTopRightRadius??L}),jsxRuntime.jsxs(Ge,{visible:e&&re,onClose:()=>{ue(false),ct||xe();},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:I?.transferCrypto?.borderTopLeftRadius??E,borderTopRightRadius:I?.transferCrypto?.borderTopRightRadius??L,children:[jsxRuntime.jsx(dr,{title:Bo.transferCrypto.title,showBack:false,onClose:()=>{ue(false),ct||xe();},showBalance:be,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Te?.project_name}),pt&&jsxRuntime.jsx(reactNative.View,{style:[ir.centeredContainer,ir.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:R.foreground})}),!pt&&ze&&jsxRuntime.jsxs(reactNative.View,{style:[ir.centeredContainer,ir.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[ir.iconContainer,{backgroundColor:R.cardHover}],children:jsxRuntime.jsx(Yi,{size:32,color:R.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ir.blockedTitle,{color:R.foreground,fontFamily:H.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[ir.blockedDescription,{color:R.foreground,opacity:.7,fontFamily:H.regular}],children:"There are no supported tokens available from your current location."})]}),!pt&&!ze&&jsxRuntime.jsx(reactNative.ScrollView,{style:ir.transferScrollContainer,contentContainerStyle:ir.scrollContent,showsVerticalScrollIndicator:false,children:_==="single_input"?jsxRuntime.jsx(zc,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:g,defaultTokenAddress:C,depositConfirmationMode:x,onExecutionsChange:ge,onDepositSuccess:k,onDepositError:S,borderTopLeftRadius:E,borderTopRightRadius:L,sheetBorderRadius:{tokenSelector:I?.tokenSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}}):jsxRuntime.jsx(Ba,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:g,defaultTokenAddress:C,depositConfirmationMode:x,onExecutionsChange:ge,onDepositSuccess:k,onDepositError:S,borderTopLeftRadius:E,borderTopRightRadius:L,sheetBorderRadius:{tokenSelector:I?.tokenSelector,chainSelector:I?.chainSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}})})]}),jsxRuntime.jsxs(Ge,{visible:e&&Ze,onClose:()=>{Ve(false),et("amount"),ct||xe();},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:I?.buyWithCard?.borderTopLeftRadius??E,borderTopRightRadius:I?.buyWithCard?.borderTopRightRadius??L,children:[jsxRuntime.jsx(dr,{title:`Deposit ${i||"USDC"}`,showBack:nt==="onramp",onBack:()=>et("amount"),onClose:()=>{Ve(false),et("amount"),ct||xe();},showBalance:be,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Te?.project_name}),jsxRuntime.jsx(reactNative.View,{style:ir.buyWithCardContainer,children:jsxRuntime.jsx(Ua,{externalUserId:r,publishableKey:o,destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onDepositSuccess:k,onDepositError:S,view:nt,onViewChange:_e=>et(_e),borderTopLeftRadius:E,borderTopRightRadius:L,sheetBorderRadius:{providerModal:I?.providerModal,webView:I?.webView,currencyModal:I?.currencyModal}})})]}),b&&m&&jsxRuntime.jsx(Ge,{visible:e&&$e,onClose:()=>ye(false),closeOnBackdropPress:false,showHandle:false,heightPercent:1,borderTopLeftRadius:0,borderTopRightRadius:0,children:jsxRuntime.jsx(reactNative.View,{style:ir.stripeLinkPayContainer,children:Le})})]})}function Xa({theme:e="auto",...t}){return jsxRuntime.jsx(eg,{...t})}var ir=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function el(e,t=true){return vo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>na(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Uc(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return vo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await kn(i),d=null,c=null,g=null,C=null,f,y,b,m=l.data.some(T=>T.chains.some(h=>{let p=h.chain_type===t&&h.chain_id===r&&h.token_address.toLowerCase()===o.toLowerCase();return p&&(d=h.minimum_deposit_amount_usd,c=h.estimated_processing_time,g=h.max_slippage_percent,C=h.estimated_price_impact_percent,b=h.chain_name,y=T),p}));if(y){let T=se(y,"png");T&&(f=Q(T));}return {isSupported:m,minimumAmountUsd:d,estimatedProcessingTime:c,maxSlippagePercent:g,priceImpactPercent:C,errorMessage:m?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:f,chainName:b}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Hc(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return vo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await ia(t,r,o,n,i);if(l.balance){let d=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",g=l.balance.amount,C=BigInt(g),f=BigInt(10**d),y=C/f,m=(C%f).toString().padStart(d,"0").replace(/0+$/,""),T=m?`${y}.${m}`:y.toString();return {balanceBaseUnit:g,balanceHuman:T,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:d,symbol:c}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var rg=2500,og=3e3,ng=6e4;function Nc({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=nn.useState([]),[l,d]=nn.useState(false),c=nn.useRef(new Date),g=nn.useRef(new Map),C=nn.useRef(false),f=nn.useRef(n),y=nn.useRef(i);return nn.useEffect(()=>{f.current=n;},[n]),nn.useEffect(()=>{y.current=i;},[i]),nn.useEffect(()=>{o&&!C.current&&(c.current=new Date,g.current.clear()),o||g.current.clear(),C.current=o;},[o]),nn.useEffect(()=>{if(!e||!o)return;let b=c.current,m=async()=>{try{let h=await So(e,t,"withdraw"),p=new Date(b.getTime()-ng),w=[...h.data].sort((k,S)=>{let I=k.created_at?new Date(k.created_at).getTime():0;return (S.created_at?new Date(S.created_at).getTime():0)-I}),x=["pending","waiting","delayed"],_=["succeeded","failed"],F=null;for(let k of w){let S=k.created_at?new Date(k.created_at):null;if(!S||S<p)continue;let I=g.current.get(k.id);if(!I){F=k;break}if(x.includes(I)&&_.includes(k.status)){F=k;break}}if(F){let k=F,S=k.created_at?new Date(k.created_at):null;if(!S||S<c.current)return;let I=g.current.get(k.id);g.current.set(k.id,k.status),a(E=>{let L=E.findIndex(R=>R.id===k.id);if(L>=0){let R=[...E];return R[L]=k,R}return [...E,k]}),k.status==="succeeded"&&(!I||x.includes(I))?f.current?.({message:"Withdrawal completed successfully",transaction:k}):k.status==="failed"&&I!=="failed"&&y.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:k});}}catch(h){console.error("Failed to fetch withdraw executions:",h),y.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:h});}};m();let T=setInterval(m,rg);return d(true),()=>{clearInterval(T),d(false);}},[e,t,o]),nn.useEffect(()=>{if(!o||!r)return;let b=async()=>{try{await zl({deposit_wallet_id:r},t);}catch{}};b();let m=setInterval(b,og);return ()=>clearInterval(m)},[o,r,t]),{executions:s,isPolling:l}}var jc=(e,t)=>`${t}:${e}`;function Ws({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:d,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:g}){let{colors:C,fonts:f,components:y}=O(),[b,m]=nn.useState(false),[T,h]=nn.useState(false),p=y.card,w=t?e.find(k=>k.symbol===t):void 0,x=w?.chains||[],_=r?x.find(k=>jc(k.chain_id,k.chain_type)===r):void 0,F={backgroundColor:p.backgroundColor,borderRadius:p.borderRadius,borderWidth:p.borderWidth||1,borderColor:p.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:We.row,children:[jsxRuntime.jsxs(reactNative.View,{style:We.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[We.label,{color:p.labelColor,fontFamily:f.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[We.selectButton,F],onPress:()=>!i&&e.length>0&&m(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[We.placeholder,{color:p.subtitleColor,fontFamily:f.regular}],children:"Loading..."}):w?jsxRuntime.jsxs(reactNative.View,{style:We.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(w,"png"))},style:We.icon}),jsxRuntime.jsx(reactNative.Text,{style:[We.selectedText,{color:p.titleColor,fontFamily:f.medium}],numberOfLines:1,children:w.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[We.placeholder,{color:p.subtitleColor,fontFamily:f.regular}],children:"Select receive token"}),jsxRuntime.jsx(Ct,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:We.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[We.label,{color:p.labelColor,fontFamily:f.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[We.selectButton,F,(!w||x.length===0)&&We.disabled],onPress:()=>!i&&w&&x.length>0&&h(true),activeOpacity:.7,disabled:i||!w||x.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:We.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(_,"png"))},style:We.icon}),jsxRuntime.jsx(reactNative.Text,{style:[We.selectedText,{color:p.titleColor,fontFamily:f.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[We.placeholder,{color:p.subtitleColor,fontFamily:f.regular}],children:"Chain"}),jsxRuntime.jsx(Ct,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Ge,{visible:b,onClose:()=>m(false),closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:We.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:We.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[We.pickerTitle,{color:C.foreground,fontFamily:f.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:We.pickerHeaderClose,onPress:()=>m(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:C.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.FlatList,{data:e,keyExtractor:k=>k.symbol,contentContainerStyle:We.listContent,renderItem:({item:k})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[We.pickerItem,{backgroundColor:k.symbol===t?C.cardHover:"transparent"}],onPress:()=>{o(k.symbol),m(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(k,"png"))},style:We.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[We.pickerItemText,{color:C.foreground,fontFamily:f.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[We.pickerItemSub,{color:C.foregroundMuted,fontFamily:f.regular}],children:k.name}),k.symbol===t&&jsxRuntime.jsx(Ue,{size:18,color:C.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Ge,{visible:T,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:c,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:We.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:We.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[We.pickerTitle,{color:C.foreground,fontFamily:f.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:We.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:C.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.FlatList,{data:x,keyExtractor:k=>jc(k.chain_id,k.chain_type),contentContainerStyle:We.listContent,renderItem:({item:k})=>{let S=jc(k.chain_id,k.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[We.pickerItem,{backgroundColor:S===r?C.cardHover:"transparent"}],onPress:()=>{n(S),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(se(k,"png"))},style:We.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[We.pickerItemText,{color:C.foreground,fontFamily:f.medium}],children:k.chain_name}),S===r&&jsxRuntime.jsx(Ue,{size:18,color:C.primary,strokeWidth:2.5})]})}})]})]})}var We=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 $c(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:i,enabled:s=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return vo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>Ml({chain_type:t,chain_id:r,token_address:o,recipient_address:a},i),enabled:s&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function lg(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function cg(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),i=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(i)).toString()}function dg(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function ol({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:d,balanceData:c,isLoadingBalance:g,minimumWithdrawAmountUsd:C,estimatedProcessingTime:f,maxSlippagePercent:y,priceImpactPercent:b,canWithdraw:m,onDepositWalletCreation:T,onWithdraw:h,onWithdrawError:p,onWithdrawSubmitted:w,onViewTracker:x}){let _="https://unifold.io/terms",F="https://unifold.io/support",{colors:k,fonts:S,components:I}=O(),[E,L]=nn.useState(a||""),[R,H]=nn.useState(""),[B,ge]=nn.useState("crypto"),[je,Je]=nn.useState(false),[re,ue]=nn.useState(null),[Ze,Ve]=nn.useState(false),[$e,ye]=nn.useState(""),Te=nn.useRef(null);nn.useEffect(()=>{L(a||""),H(""),ge("crypto"),ue(null);},[a]);let Me=E.trim();nn.useEffect(()=>{let te=setTimeout(()=>ye(Me),500);return ()=>clearTimeout(te)},[Me]);let {data:nt,isLoading:et,error:lt}=$c({chainType:d?.chain_type,chainId:d?.chain_id,tokenAddress:d?.token_address,recipientAddress:$e,publishableKey:e,enabled:$e.length>5&&!!d}),pt=Me!==$e,xe=nn.useMemo(()=>!Me||Me.length<=5||pt||et?null:lt?"Invalid address":nt&&!nt.valid?nt.failure_code==="account_not_found"?`Account not found on ${d?.chain_name}`:nt.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${d?.chain_name}`:"Invalid address":null,[Me,pt,et,lt,nt,d,l]),ct=!pt&&!!nt?.valid&&!xe,Z=nn.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),K=nn.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),be=nn.useMemo(()=>c?.balanceUsd?parseFloat(c.balanceUsd):0,[c]),yt=n||c?.symbol||"TOKEN",ze=c?.decimals??6,Le=nn.useMemo(()=>{let te=parseFloat(R);return !te||te<=0?0:B==="crypto"?te:Z>0?te/Z:0},[R,B,Z]),_e=nn.useMemo(()=>{let te=parseFloat(R);return !te||te<=0?0:B==="fiat"?te:te*Z},[R,B,Z]);nn.useMemo(()=>!R||parseFloat(R)<=0?null:B==="crypto"?`$${_e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`:`${Le.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})} ${yt}`,[R,B,_e,Le,yt]);nn.useMemo(()=>g||!c?null:B==="crypto"?`${K.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})} ${yt}`:`$${be.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,[g,c,B,K,be,yt]);let dt=nn.useCallback(async()=>{try{let de=await Gp("expo-clipboard").getStringAsync();de&&(L(de.trim()),ue(null));}catch{}},[]),ht=nn.useCallback(()=>{let te=parseFloat(R);if(!te||te<=0||Z<=0){ge(de=>de==="crypto"?"fiat":"crypto"),H("");return}B==="crypto"?(H((te*Z).toFixed(2)),ge("fiat")):(H((te/Z).toFixed(ze>6?6:ze)),ge("crypto"));},[R,B,Z,ze]),Be=nn.useCallback(()=>{if(B==="crypto"){if(K<=0)return;H(c?.balanceHuman??"0");}else {if(be<=0)return;H((Math.floor(be*100)/100).toFixed(2));}},[B,K,be,c]),Ie=C!==null&&_e>0&&_e<C,Nt=B==="crypto"?Le>0&&K>0&&Le>K:_e>0&&be>0&&_e>be,Wt=Me.length>0&&R.trim().length>0&&Le>0&&ct&&!Ie&&!Nt&&!!c,wr=nn.useCallback(async()=>{if(!(!l||!d||!Wt||!m)){Je(true),ue(null);try{let te=await T({destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,recipientAddress:Me}),de=cg(Le,ze),ae=dg(Le,ze),Ae={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:yt,sourceTokenIconUrl:s,destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,destinationTokenSymbol:l.symbol,destinationChainName:d.chain_name,destinationTokenIconUrl:l?Q(se(l,"png")):void 0,amount:ae,amountBaseUnit:de,submittedAt:new Date,withdrawIntentAddress:te.address,recipientAddress:Me};await h(Ae),w(Ae);}catch(te){let de=te instanceof Error?te.message:"Withdrawal failed. Please try again.",ae=de.length>120?"Withdrawal failed. Please try again.":de;ue(ae),p?.({message:de,error:te,code:"WITHDRAW_FAILED"});}finally{Je(false);}}},[l,d,Wt,m,Me,t,r,o,yt,s,R,B,K,be,c,Le,ze,_e,T,h,p,w]),ve=I.input,qe=I.card,Qe=I.button,pr=xe?k.error:ve.borderColor,N=nn.useMemo(()=>je?"Processing...":Nt?"Insufficient balance":Ie?`Minimum $${C?.toFixed(2)}`:re?"Withdrawal failed \u2014 try again":"Withdraw",[je,Nt,Ie,C,re]);return jsxRuntime.jsxs(reactNative.View,{style:Fe.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Fe.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fe.label,{color:qe.labelColor,fontFamily:S.medium}],children:"Recipient address"}),(pt||et)&&Me.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.foregroundMuted}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:dt,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(td,{size:16,color:k.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Fe.inputRow,{backgroundColor:ve.backgroundColor,borderRadius:ve.borderRadius,borderWidth:ve.borderWidth,borderColor:pr}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Fe.textInput,{color:ve.textColor,fontFamily:S.regular}],placeholder:"Enter wallet address",placeholderTextColor:ve.placeholderColor,value:E,onChangeText:te=>{L(te),ue(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Te.current?.focus()})}),xe?jsxRuntime.jsx(reactNative.Text,{style:[Fe.errorText,{color:k.error,fontFamily:S.regular}],children:xe}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Fe.label,{color:qe.labelColor,fontFamily:S.medium,paddingBottom:8}],children:["Amount",C!=null&&C>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:k.warning,fontFamily:S.regular},children:` ($${C.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Fe.amountRow,{backgroundColor:ve.backgroundColor,borderRadius:ve.borderRadius,borderWidth:ve.borderWidth,borderColor:ve.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:[Fe.amountInput,{color:ve.textColor,fontFamily:S.regular}],placeholder:"0.00",placeholderTextColor:ve.placeholderColor,value:R,onChangeText:te=>{(te===""||/^\d*\.?\d*$/.test(te))&&(H(te),ue(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Z>0?ht:void 0,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.unitLabel,{color:k.foregroundMuted,fontFamily:S.medium}],children:B==="crypto"?yt:"USD"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Fe.maxButton,{backgroundColor:`${k.primary}20`}],onPress:Be,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.maxText,{color:k.primary,fontFamily:S.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Fe.detailsCard,{marginTop:24,backgroundColor:qe.backgroundColor,borderRadius:qe.borderRadius,borderWidth:qe.borderWidth||1,borderColor:qe.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Fe.detailsToggle,onPress:()=>Ve(!Ze),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Fe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Fe.detailIcon,{backgroundColor:qe.iconBackgroundColor,borderRadius:qe.iconContainerBorderRadius}],children:jsxRuntime.jsx(qr,{size:12,color:qe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Fe.detailsLabel,{color:qe.titleColor,fontFamily:S.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:S.medium},children:lg(f)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:Ze?"180deg":"0deg"}]},children:jsxRuntime.jsx(Ct,{size:16,color:qe.actionColor,strokeWidth:2})})]})}),Ze&&jsxRuntime.jsxs(reactNative.View,{style:Fe.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Fe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Fe.detailIcon,{backgroundColor:qe.iconBackgroundColor,borderRadius:qe.iconContainerBorderRadius}],children:jsxRuntime.jsx(jo,{size:12,color:qe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Fe.detailsLabel,{color:qe.titleColor,fontFamily:S.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:S.medium},children:["Auto \u2022 ",(y??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Fe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Fe.detailIcon,{backgroundColor:qe.iconBackgroundColor,borderRadius:qe.iconContainerBorderRadius}],children:jsxRuntime.jsx(No,{size:12,color:qe.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Fe.detailsLabel,{color:qe.titleColor,fontFamily:S.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:S.medium},children:[(b??0).toFixed(2),"%"]})]})]})]})]}),re&&jsxRuntime.jsx(reactNative.Text,{style:[Fe.errorText,{color:k.error,fontFamily:S.regular,textAlign:"center"}],children:re}),jsxRuntime.jsxs(reactNative.View,{style:Fe.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Fe.withdrawButton,{backgroundColor:Qe.primaryBackground,borderRadius:Qe.borderRadius,borderWidth:Qe.borderWidth,borderColor:Qe.borderColor,opacity:!Wt||!m||je?.5:1}],onPress:wr,disabled:!Wt||!m||je,activeOpacity:.8,children:[je&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Qe.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.withdrawButtonText,{color:Qe.primaryText,fontFamily:S.medium}],children:N})]}),jsxRuntime.jsxs(reactNative.View,{style:Fe.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Fe.historyLink,onPress:x,activeOpacity:.7,children:[jsxRuntime.jsx(qr,{size:14,color:k.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.historyText,{color:k.foregroundMuted,fontFamily:S.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Fe.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.legalText,{color:k.foregroundMuted,fontFamily:S.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.legalSeparator,{color:k.foregroundMuted,fontFamily:S.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.legalText,{color:k.foregroundMuted,fontFamily:S.regular}],children:"Help"})})]})]})]})]})}var Fe=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:4,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:4,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"},balanceRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:6,paddingHorizontal:4},convertedText:{fontSize:12},balanceText:{fontSize:12},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 mg(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 fg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function sl({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,d=Q(se(e.destination_token_metadata,"png")||zt("/icons/tokens/png/usdc.png")),c=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",g=mg(e.created_at||new Date().toISOString()),C=fg(e.source_amount_usd);return jsxRuntime.jsxs(Mt,{cardTokens:i,onPress:t,contentStyle:Eo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Eo.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:Eo.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Eo.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(Gi,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(Hs,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Eo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Eo.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[Eo.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:Eo.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Eo.amount,{color:i.textRightColor,fontFamily:o.medium}],children:C}),jsxRuntime.jsx(Ar,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var Eo=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 Qc(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),i=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),l=s>=12?"PM":"AM";s=s%12||12;let d=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${d} ${l}`}catch{return e}}function Up(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 yg(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 Hp(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Np(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function As({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:we.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[we.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[we.divider,{backgroundColor:i.borderColor}]})]})}function Gc({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=O(),[d,c]=nn.useState([]),[g,C]=nn.useState(!!n),f=l.card,y=l.button,b=l.header,m=l.container;nn.useEffect(()=>{El().then(ge=>c(ge.data)).catch(()=>{});},[]),nn.useEffect(()=>{C(!!n);},[e?.id]);let T=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,h=e?e.status==="failed"||e.status==="refunded":false,p=h?s.error:T?s.warning:s.success,w=h?"Failed":T?"Processing":"Completed",x=e?.destination_token_metadata?Q(se(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?Q(t.destinationTokenIconUrl):Q(zt("/icons/tokens/png/usdc.png")),_=e?.created_at?Qc(e.created_at):t.submittedAt?Qc(t.submittedAt.toISOString()):Qc(new Date().toISOString()),F=e?`${Up(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Hp(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,k=e?`${Up(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Hp(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,S=e?yg(e.source_amount_usd,e.source_amount_base_unit):"$0.00",I=e?oa(d,e.source_chain_type,e.source_chain_id):t.sourceChainId,E=e?oa(d,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,L=e?.transaction_hash,R=e?.explorer_url,H=e?.destination_transaction_hashes?.[0],B=e?.destination_explorer_url;return jsxRuntime.jsxs(reactNative.ScrollView,{style:we.scroll,contentContainerStyle:we.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:we.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ed,{size:22,color:b.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:we.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[we.headerTitle,{color:b.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:we.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:b.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:we.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:x},style:we.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[we.statusBadge,{backgroundColor:p}],children:h?jsxRuntime.jsx(Gi,{size:10,color:"#FFFFFF",strokeWidth:3}):T?jsxRuntime.jsx(reactNative.View,{style:we.spinnerDot}):jsxRuntime.jsx(Ue,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:we.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[we.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[we.statusText,{color:p,fontFamily:a.medium}],children:w})]}),jsxRuntime.jsx(reactNative.Text,{style:[we.dateText,{color:m.subtitleColor,fontFamily:a.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[we.detailsCard,{backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth??1,borderColor:f.borderColor}],children:[jsxRuntime.jsx(As,{label:"Amount Sent",value:F}),jsxRuntime.jsx(As,{label:"Amount Received",value:k}),jsxRuntime.jsx(As,{label:"USD Value",value:S}),jsxRuntime.jsx(As,{label:"Source Network",value:I}),jsxRuntime.jsx(As,{label:"Destination Network",value:E,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:we.moreDetailsRow,onPress:()=>C(ge=>!ge),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.moreDetailsText,{color:m.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(Kr,{size:16,color:m.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ct,{size:16,color:m.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[we.detailsCard,{backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth??1,borderColor:f.borderColor}],children:L&&R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:we.txRow,onPress:()=>reactNative.Linking.openURL(R),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.txLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[we.txHash,{color:f.titleColor,fontFamily:a.regular}],children:Np(L)}),jsxRuntime.jsx(Qr,{size:14,color:f.actionColor,strokeWidth:2})]}),!T&&H&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[we.divider,{backgroundColor:f.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:we.txRow,onPress:()=>reactNative.Linking.openURL(B),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.txLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[we.txHash,{color:f.titleColor,fontFamily:a.regular}],children:Np(H)}),jsxRuntime.jsx(Qr,{size:14,color:f.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:we.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[we.detailLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:we.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[we.button,we.halfButton,{backgroundColor:y.secondaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[we.buttonText,{color:y.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[we.button,we.halfButton,{backgroundColor:y.primaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[we.buttonText,{color:y.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var we=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 jp(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function al({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=O(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",d=a?.status==="failed",c={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:ut.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ut.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[ut.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(Ue,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ut.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ut.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",jp(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:ut.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ut.button,ut.halfButton,c,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ut.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ut.button,ut.halfButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ut.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):d?jsxRuntime.jsxs(reactNative.View,{style:ut.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ut.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[ut.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(tt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[ut.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[ut.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ut.button,ut.fullButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[ut.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:ut.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ut.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(st,{size:80,strokeWidth:4,iconSize:68,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:Q(e.sourceTokenIconUrl)},style:ut.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[ut.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[ut.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[ut.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",jp(e.recipientAddress)]})]})}var ut=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 _g(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:Q(se(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:Q(se(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 $p=(e,t)=>`${t}:${e}`;function Rg(){let{colors:e}=O(),t=nn.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return nn.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 dl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,modalTitle:s="Withdraw Crypto",onWithdraw:a,onWithdrawSuccess:l,onWithdrawError:d,heightPercent:c=.92,sheetBorderRadius:g,sourceChainType:C,sourceChainId:f,sourceTokenAddress:y,sourceTokenSymbol:b,sourceChainName:m,sourceTokenIconUrl:T}){let{colors:h,fonts:p}=O(),[w,x]=nn.useState("form"),[_,F]=nn.useState(C),[k,S]=nn.useState(f),[I,E]=nn.useState(y),[L,R]=nn.useState(b),[H,B]=nn.useState(m),[ge,je]=nn.useState(T),[Je,re]=nn.useState(null),[ue,Ze]=nn.useState(null),[Ve,$e]=nn.useState(null),[ye,Te]=nn.useState(),[Me,nt]=nn.useState([]),[et,lt]=nn.useState(null),[pt,xe]=nn.useState("form"),ct=nn.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Z=nn.useRef(null),K=!!_&&!!k&&!!I,{data:be,isLoading:yt}=el(r,e&&w==="form"),ze=be?.data??[],{data:Le,isLoading:_e}=Uc({sourceChainType:_,sourceChainId:k,sourceTokenAddress:I,sourceTokenSymbol:L,publishableKey:r,enabled:e&&K&&w==="form"}),{data:St,isLoading:Re}=Hc({address:n,chainType:_,chainId:k,tokenAddress:I,publishableKey:r,enabled:e&&K}),{executions:dt}=Nc({userId:o,publishableKey:r,depositWalletId:ye,enabled:!!ye&&e,onWithdrawSuccess:l,onWithdrawError:d});nn.useEffect(()=>{if(!e||w!=="tracker")return;let X=false;return So(o,r,"withdraw").then(le=>{X||nt(le.data);}).catch(console.error),()=>{X=true;}},[e,w,o,r]),nn.useEffect(()=>{e&&(Z.current&&(clearTimeout(Z.current),Z.current=null),x("form"),F(C),S(f),E(y),R(b),B(m),je(T),re(null),Ze(null),$e(null),Te(void 0),nt([]),lt(null),xe("form"),ct.setValue(reactNative.Dimensions.get("window").width));},[e]),nn.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current);},[]),nn.useEffect(()=>{ge||Le?.iconUrl&&je(Le.iconUrl);},[Le?.iconUrl,ge]),nn.useEffect(()=>{H||Le?.chainName&&B(Le.chainName);},[Le?.chainName,H]),nn.useEffect(()=>{w==="confirming"&&dt.length>0&&x("details");},[w,dt]);let ht=nn.useCallback(()=>{t(),Z.current=setTimeout(()=>{x("form"),F(C),S(f),E(y),R(b),B(m),je(T),re(null),Ze(null),$e(null),Te(void 0),nt([]),lt(null),xe("form"),Z.current=null;},300);},[t,C,f,y,b,m,T]),Be=nn.useCallback(X=>{let le=ze.find(it=>it.symbol===X);le&&(re(le),le.chains.length>0&&Ze(le.chains[0]));},[ze]),Ie=nn.useCallback(X=>{if(!Je)return;let le=Je.chains.find(it=>$p(it.chain_id,it.chain_type)===X);le&&Ze(le);},[Je]),Nt=nn.useCallback(async X=>{let le=await wo({external_user_id:o,destination_chain_type:X.destinationChainType,destination_chain_id:X.destinationChainId,destination_token_address:X.destinationTokenAddress,recipient_address:X.recipientAddress,action_type:"withdraw"},r),it=To(le.data,_??"");if(!it)throw new Error(`No deposit wallet found for chain type: ${_}`);return Te(it.id),{id:it.id,address:it.address}},[o,r,_]),Wt=nn.useCallback(X=>{$e(X),x("confirming");},[]),wr=nn.useCallback(X=>{lt(X),ct.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(ct,{toValue:0,duration:280,useNativeDriver:true}).start();},[ct]),ve=nn.useCallback(()=>{reactNative.Animated.timing(ct,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>lt(null));},[ct]),qe=yt||_e,Qe=Le?.isSupported??null,pr=w==="confirming"?"Withdrawal Status":s,N=g?.globalBorderTopLeftRadius,te=g?.globalBorderTopRightRadius,de=g?.main?.borderTopLeftRadius??N,ae=g?.main?.borderTopRightRadius??te,Ae=g?.tokenSelector?.borderTopLeftRadius??N,U=g?.tokenSelector?.borderTopRightRadius??te,J=g?.chainSelector?.borderTopLeftRadius??N,pe=g?.chainSelector?.borderTopRightRadius??te,oe=(()=>{if(w!=="form"||!K||Re||!St)return;let X=L||St.symbol,le=St.balanceUsd;if(le!=null){let bn=`$${parseFloat(le).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return X?`Balance: ${bn} ${X}`:`Balance: ${bn}`}let it=St.balanceHuman;if(!(!it||it==="0"))return X?`Balance: ${it} ${X}`:`Balance: ${it}`})();return jsxRuntime.jsx(Ge,{visible:e,onClose:ht,closeOnBackdropPress:false,showHandle:false,heightPercent:w==="confirming"?.3:w==="details"?.7:c,borderTopLeftRadius:de,borderTopRightRadius:ae,children:w==="confirming"&&Ve?jsxRuntime.jsx(al,{txInfo:Ve,executions:dt,onClose:ht,onViewTracker:()=>{xe("confirming"),x("tracker");}}):w==="details"&&Ve?jsxRuntime.jsx(Gc,{execution:dt.length>0?dt[dt.length-1]:null,txInfo:Ve,onClose:ht,onViewHistory:()=>{xe("details"),x("tracker");},onHeaderClose:()=>x("form")}):w==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:fo.trackerContainer,children:[jsxRuntime.jsx(dr,{title:"Withdrawal History",onClose:()=>x(pt)}),Me.length===0?jsxRuntime.jsx(reactNative.View,{style:fo.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[fo.emptyText,{color:h.foregroundMuted,fontFamily:p.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(reactNative.FlatList,{data:Me,keyExtractor:X=>X.id,contentContainerStyle:fo.listContent,renderItem:({item:X})=>jsxRuntime.jsx(sl,{execution:X,onPress:()=>wr(X)})}),et&&jsxRuntime.jsx(reactNative.Animated.View,{style:[fo.historyDetailOverlay,{backgroundColor:h.background,transform:[{translateX:ct}]}],children:jsxRuntime.jsx(Gc,{execution:et,txInfo:_g(et),onClose:ht,onBack:ve,onViewHistory:ve})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(dr,{title:pr,subtitle:oe,onClose:ht}),qe?jsxRuntime.jsx(Rg,{}):Qe===false?jsxRuntime.jsxs(reactNative.View,{style:fo.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[fo.unsupportedTitle,{color:h.foreground,fontFamily:p.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[fo.unsupportedMessage,{color:h.foregroundMuted,fontFamily:p.regular}],children:Le?.errorMessage})]}):jsxRuntime.jsx(vg,{publishableKey:r,sourceChainType:_??"",sourceChainId:k??"",sourceTokenAddress:I??"",sourceTokenSymbol:L,sourceChainName:H,sourceTokenIconUrl:ge,recipientAddressProp:i,destinationTokens:ze,selectedToken:Je,selectedChain:ue,selectedChainKey:ue?$p(ue.chain_id,ue.chain_type):null,onTokenChange:Be,onChainChange:Ie,tokensLoading:yt,balanceData:St??null,isLoadingBalance:Re,sourceValidation:Le??null,onDepositWalletCreation:Nt,onWithdraw:a,onWithdrawError:d,onWithdrawSubmitted:Wt,onViewTracker:()=>{xe("form"),x("tracker");},tokenSelectorLeft:Ae,tokenSelectorRight:U,chainSelectorLeft:J,chainSelectorRight:pe})]})})}function vg({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:d,selectedChain:c,selectedChainKey:g,onTokenChange:C,onChainChange:f,tokensLoading:y,balanceData:b,isLoadingBalance:m,sourceValidation:T,onDepositWalletCreation:h,onWithdraw:p,onWithdrawError:w,onWithdrawSubmitted:x,onViewTracker:_,tokenSelectorLeft:F,tokenSelectorRight:k,chainSelectorLeft:S,chainSelectorRight:I}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(reactNative.ScrollView,{style:{flex:1,paddingTop:16},contentContainerStyle:fo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:fo.doubleInputWrapper,children:jsxRuntime.jsx(Ws,{tokens:l,selectedTokenSymbol:d?.symbol??null,selectedChainKey:g,onTokenChange:C,onChainChange:f,isLoading:y,tokenPickerBorderTopLeftRadius:F,tokenPickerBorderTopRightRadius:k,chainPickerBorderTopLeftRadius:S,chainPickerBorderTopRightRadius:I})}),jsxRuntime.jsx(ol,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:d,selectedChain:c,balanceData:b,isLoadingBalance:m,minimumWithdrawAmountUsd:T?.minimumAmountUsd??null,estimatedProcessingTime:T?.estimatedProcessingTime??null,maxSlippagePercent:T?.maxSlippagePercent??null,priceImpactPercent:T?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:h,onWithdraw:p,onWithdrawError:w,onWithdrawSubmitted:x,onViewTracker:_})]})})}var fo=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 Kp=nn.createContext(null);function Ag({children:e,publishableKey:t,config:r}){let[o]=nn.useState(()=>new oc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=nn.useState(false),[s,a]=nn.useState(null),[l,d]=nn.useState(false),[c,g]=nn.useState(null),C=reactNative.useColorScheme(),f=nn.useRef(false);f.current||(Xs({publishableKey:t}),f.current=true);let y=nn.useMemo(()=>{let R=r?.appearance||"dark";return R==="auto"?C==="dark"?"dark":"light":R},[r?.appearance,C]);nn.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.'),Xs({publishableKey:t});},[t]),nn.useEffect(()=>()=>{m.current&&clearTimeout(m.current),_.current&&clearTimeout(_.current);},[]);let b=nn.useRef(null),m=nn.useRef(null),T=nn.useCallback(R=>{m.current&&(clearTimeout(m.current),m.current=null),b.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),b.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),b.current=null);let H=new Promise((B,ge)=>{b.current={resolve:B,reject:ge};});return a(R),i(true),H},[]),h=nn.useCallback(()=>{b.current&&(b.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),b.current=null),i(false),m.current=setTimeout(()=>{a(null),m.current=null;},200);},[]),p=nn.useCallback(R=>{s?.onSuccess&&s.onSuccess(R),b.current&&(b.current.resolve(R),b.current=null);},[s]),w=nn.useCallback(R=>{console.error("[UnifoldProvider] Deposit error:",R),s?.onError&&s.onError(R),b.current&&(b.current.reject(R),b.current=null);},[s]),x=nn.useRef(null),_=nn.useRef(null),F=nn.useRef(void 0),k=nn.useCallback(R=>{_.current&&(clearTimeout(_.current),_.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let H=new Promise((B,ge)=>{x.current={resolve:B,reject:ge};});return F.current=R.onClose,g(R),d(true),H},[]),S=nn.useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),F.current?.(),F.current=void 0,d(false),_.current=setTimeout(()=>{g(null),_.current=null;},200);},[]),I=nn.useCallback(R=>{c?.onSuccess&&c.onSuccess(R),x.current&&(x.current.resolve(R),x.current=null);},[c]),E=nn.useCallback(R=>{console.error("[UnifoldProvider] Withdraw error:",R),c?.onError&&c.onError(R),x.current&&(x.current.reject(R),x.current=null);},[c]),L=nn.useMemo(()=>({publishableKey:t,beginDeposit:T,closeDeposit:h,beginWithdraw:k,closeWithdraw:S}),[t,T,h,k,S]);return jsxRuntime.jsx(sc,{client:o,children:jsxRuntime.jsx(Kp.Provider,{value:L,children:jsxRuntime.jsxs(Oi,{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(Xa,{visible:n,onClose:h,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:s.externalUserId,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeOnrampEmail:s.stripeOnrampEmail,stripeOnrampPhone:s.stripeOnrampPhone,stripeTheme:{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",initialScreen:s.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,StripeOnrampComponent:r?.enableStripeLinkPay?Zd():void 0,onDepositSuccess:p,onDepositError:w,theme:y,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(dl,{visible:l,onClose:S,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,onWithdraw:c.withdraw,onWithdrawSuccess:I,onWithdrawError:E,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Eg(){let e=nn.useContext(Kp);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
3
+ exports.AmountScreen=Gs;exports.BottomSheet=Ge;exports.KYCWizardScreen=Js;exports.OnrampScreen=pa;exports.StripeOnramp=ma;exports.StripeOnrampPreconfigure=Yd;exports.UnifoldProvider=Ag;exports.getPreferredIcon=se;exports.getStripePublishableKey=la;exports.getSupportedDestinationTokens=na;exports.normalizeIconUrl=Q;exports.registerStripeOnramp=fa;exports.setDevApiUrl=wd;exports.setStripeOnrampApiUrl=aa;exports.setStripeOnrampPublishableKey=sa;exports.useAllowedCountry=Vs;exports.useStripeOnramp=ca;exports.useTheme=O;exports.useUnifold=Eg;