@unifold/connect-react-native 0.1.13 → 0.1.14

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,2 +1,2 @@
1
- 'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),Ie=require('react-native-svg'),Ci=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview'),Hr=require('@react-native-async-storage/async-storage');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ie__default=/*#__PURE__*/_interopDefault(Ie);var Ci__default=/*#__PURE__*/_interopDefault(Ci);var Hr__default=/*#__PURE__*/_interopDefault(Hr);var hr={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)"}},yr=hr;function zo(e,t,o){let n=o?t?.[o]:void 0,r=(a,p,g)=>{let l=n?.[a]?.[p];if(l!==void 0)return l;let c=t?.[a]?.[p];return c!==void 0?c:g};return {header:{titleColor:r("header","titleColor",e.foreground),buttonColor:r("header","buttonColor",e.foreground)},card:{backgroundColor:r("card","backgroundColor",e.card),titleColor:r("card","titleColor",e.foreground),subtitleColor:r("card","subtitleColor",e.foregroundMuted),labelColor:r("card","labelColor",e.foregroundMuted),headerColor:r("card","headerColor",e.foregroundMuted),labelRightColor:r("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:r("card","labelHighlightRightColor",e.warning),textRightColor:r("card","textRightColor",e.foreground),subtextRightColor:r("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:r("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:r("card","rowRightLabel",e.foreground),iconColor:r("card","iconColor",e.primary),iconBackgroundColor:r("card","iconBackgroundColor",e.primary+"26"),actionColor:r("card","actionColor",e.foregroundMuted),actionIcon:r("card","actionIcon",e.foregroundMuted),descriptionColor:r("card","descriptionColor",e.foregroundMuted)},input:{backgroundColor:r("input","backgroundColor",e.card),textColor:r("input","textColor",e.foreground),placeholderColor:r("input","placeholderColor",e.foregroundMuted),borderColor:r("input","borderColor",e.border)},button:{primaryBackground:r("button","primaryBackground",e.primary),primaryText:r("button","primaryText",e.primaryForeground),secondaryBackground:r("button","secondaryBackground",e.card),secondaryText:r("button","secondaryText",e.foreground)},container:{titleColor:r("container","titleColor",e.foreground),subtitleColor:r("container","subtitleColor",e.foregroundMuted),actionColor:r("container","actionColor",e.foregroundMuted),actionTitle:r("container","actionTitle",e.foregroundMuted),buttonColor:r("container","buttonColor",e.primary),buttonTitleColor:r("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:r("container","iconBackgroundColor",e.success),iconColor:r("container","iconColor",e.foreground)},search:{backgroundColor:r("search","backgroundColor",e.card),inputColor:r("search","inputColor",e.foreground),placeholderColor:r("search","placeholderColor",e.foregroundMuted)},list:{titleSectionColor:r("list","titleSectionColor",e.foregroundMuted)}}}function Cr(e,t,o){let r={...hr[e]};return o&&(r.primary=o),t&&(r={...r,...t}),r}var Jr=react.createContext(null);function Ao({children:e,mode:t="auto",accentColor:o,theme:n,fontFamily:r,fonts:a,components:p}){let g=reactNative.useColorScheme(),l=react.useMemo(()=>t==="auto"?g==="dark"?"dark":"light":t,[t,g]),c=react.useMemo(()=>{let W=n?.[l];return Cr(l,W,o)},[l,n,o]),k=react.useMemo(()=>zo(c,p,l),[c,p,l]),T=react.useMemo(()=>a?{regular:a.regular||r,medium:a.medium||r,semibold:a.semibold||r,bold:a.bold||r}:r?{regular:r,medium:r,semibold:r,bold:r}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[r,a]),_=react.useMemo(()=>({mode:l,colors:c,fonts:T,components:k,isDark:l==="dark"}),[l,c,T,k]);return jsxRuntime.jsx(Jr.Provider,{value:_,children:e})}function O(){let e=react.useContext(Jr);if(!e){let t=yr.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:zo(t,void 0,"dark"),isDark:true}}return e}var ei="https://api.unifold.io",Mo,lt="pk_test_123",Oo={};function Me(){return typeof __DEV__<"u"&&__DEV__&&Mo?Mo:ei}function Ho(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.'),lt=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Mo=e.baseUrl),e.defaultConfig&&(Oo=e.defaultConfig);}function Kr(e){typeof __DEV__<"u"&&__DEV__?Mo=e:console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function mt(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 Pe(e){let t=e.startsWith("/")?e:`/${e}`;return `${Me()}/api/public${t}`}function $(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Me()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Me()}${e}`:`${Me()}/api/public${e}`:""}async function zt(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Oo.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Oo.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||Oo.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||lt;mt(n);let r=await fetch(`${Me()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.statusText}`);return r.json()}function At(e,t){return e.find(o=>o.chain_type===t)}async function Ot(e,t){let o=t||lt;mt(o);let n=await fetch(`${Me()}/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})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.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 o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function wo(e,t){let o=e||lt;mt(o);let n=`${Me()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});n=`${n}?${a.toString()}`;}let r=await fetch(n,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch supported deposit tokens: ${r.statusText}`);return r.json()}async function br(e,t){let o=t||lt;mt(o);let n=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),r=await fetch(`${Me()}/v1/public/tokens/token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch token metadata: ${r.statusText}`);return r.json()}function Uo(e,t,o){return !e||e.length===0?o||"":e.find(r=>r.format===t)?.url||o||e[0]?.url||""}async function kr(e,t){let o=t||lt;mt(o);let n=await fetch(`${Me()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch onramp quotes: ${n.statusText}`);return n.json()}async function wr(e,t){let o=t||lt;mt(o);let n=await fetch(`${Me()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create onramp session: ${n.statusText}`);return n.json()}async function Tr(e,t){let o=t||lt;mt(o);let n=new URLSearchParams;e.country_code&&n.append("country_code",e.country_code),e.subdivision_code&&n.append("subdivision_code",e.subdivision_code),n.append("token_address",e.token_address),n.append("chain_id",e.chain_id),n.append("chain_type",e.chain_type);let r=await fetch(`${Me()}/v1/public/onramps/default_token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.statusText}`);return r.json()}async function xr(e){let t=e||lt;mt(t);let o=await fetch(`${Me()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function to(e,t="png"){if(!e||e.length===0)return;let o=e.find(n=>n.format===t);return o?o.url:e[0]?.url}async function To(e){let t=e||lt;mt(t);let o=await fetch(`${Me()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function xo(){let e=await fetch(`${Me()}/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()}var{height:ro}=reactNative.Dimensions.get("window");function ge({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:r=true,heightPercent:a,noPadding:p=false,borderTopLeftRadius:g=24,borderTopRightRadius:l=24}){let{colors:c}=O(),k=react.useRef(new reactNative.Animated.Value(ro)).current,T=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(k.setValue(ro),T.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(k,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(T,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(k,{toValue:ro,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(T,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,k,T]);let _=()=>{n&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Mt.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:_,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[Mt.backdrop,{backgroundColor:"#000000",opacity:T}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Mt.sheet,{backgroundColor:c.background,borderTopLeftRadius:g,borderTopRightRadius:l,transform:[{translateY:k}],...a&&{height:ro*a,maxHeight:ro*a},...p&&{paddingBottom:0}}],children:[r&&jsxRuntime.jsx(reactNative.View,{style:Mt.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Mt.handle,{backgroundColor:c.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[Mt.content,a&&Mt.contentFlex],children:o})]})]})})}var Mt=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:ro*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function Sr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ie.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function _r({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ht({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ir({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function He({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ht({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ie.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ue({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ie.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function So({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Re({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ie.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ut({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function no({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function No({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ie.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function rn({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function io({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function so({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ie.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qe({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:r,badge:a}){let{colors:p,fonts:g,components:l}=O();return jsxRuntime.jsxs(reactNative.View,{style:ot.header,children:[jsxRuntime.jsx(reactNative.View,{style:ot.leftContainer,children:t&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[ot.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ir,{size:20,color:l.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ot.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:ot.titleContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ot.title,{color:l.header.titleColor,fontFamily:g.medium}],children:e}),a&&a.count>0&&jsxRuntime.jsx(reactNative.View,{style:[ot.titleBadge,{backgroundColor:p.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[ot.titleBadgeText,{color:p.foregroundMuted,fontFamily:g.regular}],children:a.count})})]}),jsxRuntime.jsx(reactNative.View,{style:ot.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:r,style:[ot.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(He,{size:20,color:l.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ot.spacer})})]})}var ot=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,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"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function It({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:r=0,borderColor:a="transparent",backgroundColor:p="transparent",style:g}){let{colors:l}=O(),[c,k]=react.useState(false),T=e?.toLowerCase().endsWith(".svg");react.useEffect(()=>{k(false);},[e]);let _=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:_},g]});let W={width:t,height:o,borderRadius:n,borderWidth:r,borderColor:a,backgroundColor:p,overflow:"hidden",alignItems:"center",justifyContent:"center",...g},P=t-r*2,x=o-r*2;return c?jsxRuntime.jsx(reactNative.View,{style:[W,{backgroundColor:p||_}]}):T?jsxRuntime.jsx(reactNative.View,{style:W,children:jsxRuntime.jsx(Ie.SvgUri,{uri:e,width:P,height:x,onError:u=>{k(true);}})}):jsxRuntime.jsx(reactNative.View,{style:W,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:P,height:x},resizeMode:"contain",onError:u=>{k(true);}})})}function _o({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:r,fonts:a,components:p}=O(),g=n?[...n].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[yt.container,{backgroundColor:p.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:yt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:yt.iconContainer,children:jsxRuntime.jsx(Sr,{size:20,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:yt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.title,{color:p.card.titleColor,fontFamily:a.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[yt.subtitle,{color:p.card.subtitleColor,fontFamily:a.regular}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:yt.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:yt.networkIcons,children:g.map((l,c)=>{let k=l.icon_urls.find(T=>T.format==="png")?.url||l.icon_urls.find(T=>T.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[yt.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:g.length-c}],children:jsxRuntime.jsx(It,{uri:$(k),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:p.card.backgroundColor})},l.name)})})})]})}var yt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 Ro({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{fonts:r,components:a}=O();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[vt.container,{backgroundColor:a.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:vt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:vt.iconContainer,children:jsxRuntime.jsx(_r,{size:20,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:vt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.title,{color:a.card.titleColor,fontFamily:r.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[vt.subtitle,{color:a.card.subtitleColor,fontFamily:r.regular}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:vt.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:vt.paymentIcons,children:n?.map(p=>{let g=p.icon_urls.find(l=>l.format==="png")?.url||p.icon_urls.find(l=>l.format==="svg")?.url;return jsxRuntime.jsx(It,{uri:$(g),width:32,height:20,borderRadius:4},p.name)})})})]})}var vt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 vo({onPress:e,title:t,subtitle:o,badge:n}){let{fonts:r,components:a}=O();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Lt.container,{backgroundColor:a.card.backgroundColor}],children:jsxRuntime.jsxs(reactNative.View,{style:Lt.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Lt.iconContainer,children:[jsxRuntime.jsx(Ht,{size:20,color:a.card.iconColor,strokeWidth:2}),n!==void 0&&n>0&&jsxRuntime.jsx(reactNative.View,{style:[Lt.badge,{backgroundColor:a.card.iconColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Lt.badgeText,{fontFamily:r.semibold}],children:n>99?"99+":n})})]}),jsxRuntime.jsxs(reactNative.View,{style:Lt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Lt.title,{color:a.card.titleColor,fontFamily:r.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Lt.subtitle,{color:a.card.subtitleColor,fontFamily:r.regular}],children:o})]})]})})}var Lt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 uo({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:r}){let{colors:a,isDark:p}=O(),g=p?"#1a1a1a":"#ffffff",l=p?"#ffffff":"#000000",c=r||g;return jsxRuntime.jsxs(reactNative.View,{style:[un.container,{width:t,height:t}],children:[jsxRuntime.jsx(Ci__default.default,{value:e||"placeholder",size:t,backgroundColor:g,color:l,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[un.logoContainer,{width:n+12,height:n+12,backgroundColor:c,borderRadius:(n+12)/2}],children:jsxRuntime.jsx(It,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var un=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Li({size:e,strokeWidth:t,iconSize:o,children:n}){let r=react.useRef(new reactNative.Animated.Value(0)).current,a=(e-t)/2,p=2*Math.PI*a,g=e/2,l=(e-o)/2;react.useEffect(()=>{let k=reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return k.start(),()=>k.stop()},[r]);let c=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:{width:e,height:e},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:c}]},children:jsxRuntime.jsxs(Ie__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ie.Defs,{children:jsxRuntime.jsxs(Ie.LinearGradient,{id:"progressGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ie.Stop,{offset:"0%",stopColor:"#F59E0B"}),jsxRuntime.jsx(Ie.Stop,{offset:"100%",stopColor:"#FBBF24"})]})}),jsxRuntime.jsx(Ie.Circle,{cx:g,cy:g,r:a,stroke:"url(#progressGradient)",strokeWidth:t,fill:"none",strokeDasharray:`${p*.75} ${p*.25}`,strokeLinecap:"round",rotation:-90,origin:`${g}, ${g}`})]})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:l+1.5,left:l,width:o,height:o},children:n})]})}function mn(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function Di(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),r=e.getFullYear(),a=e.getHours(),p=e.getMinutes(),g=a>=12?"pm":"am";a=a%12,a=a||12;let l=p<10?`0${p}`:p;return `${o} ${n}, ${r} at ${a}:${l}${g}`}function po({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:r,date:a,amountUsd:p,onClose:g,borderTopLeftRadius:l,borderTopRightRadius:c}){let{colors:k,fonts:T,components:_}=O(),[W,P]=react.useState(false),x=t==="pending"||t==="waiting"||t==="delayed",u=t==="succeeded",s=()=>{n&&reactNative.Linking.openURL(n);},i=()=>{r&&reactNative.Linking.openURL(r);};return jsxRuntime.jsx(ge,{visible:e,onClose:g,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:c,children:jsxRuntime.jsxs(reactNative.View,{style:fe.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:fe.closeButton,onPress:g,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(He,{size:20,color:_.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:fe.iconContainer,children:x?jsxRuntime.jsx(Li,{size:80,strokeWidth:4,iconSize:68,children:o?jsxRuntime.jsx(reactNative.Image,{source:{uri:$(o)},style:fe.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[fe.tokenIconFill,{backgroundColor:k.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:$(o)},style:fe.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[fe.tokenIconLarge,{backgroundColor:k.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[fe.statusBadge,{backgroundColor:_.container.iconBackgroundColor}],children:jsxRuntime.jsx(Re,{size:16,color:_.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[fe.title,{color:_.container.titleColor,fontFamily:T.semibold}],children:x?"Deposit Processing":"Deposit Complete"}),p!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[fe.amount,{color:_.container.titleColor,fontFamily:T.bold}],children:["$",p.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[fe.date,{color:_.container.subtitleColor,fontFamily:T.regular}],children:Di(a)}),jsxRuntime.jsx(reactNative.Text,{style:[fe.subtitle,{color:_.container.subtitleColor,fontFamily:T.regular}],children:x?"This usually takes less than a minute.":"Your account has been credited successfully!"}),u&&(n||r)&&jsxRuntime.jsxs(reactNative.View,{style:fe.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[fe.divider,{backgroundColor:k.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:fe.detailsToggle,onPress:()=>P(!W),children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.detailsToggleText,{color:_.container.actionTitle,fontFamily:T.medium}],children:W?"See less":"See more details"}),W?jsxRuntime.jsx(_t,{size:18,color:_.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ue,{size:18,color:_.container.actionColor,strokeWidth:2})]}),W&&jsxRuntime.jsxs(reactNative.View,{style:fe.txButtonsContainer,children:[n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[fe.txButton,{backgroundColor:_.card.backgroundColor,borderColor:k.border}],onPress:s,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.txLabel,{color:_.card.titleColor,fontFamily:T.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.txHash,{color:_.card.subtitleColor,fontFamily:T.regular}],children:mn(n)}),jsxRuntime.jsx(Ut,{size:16,color:_.card.actionColor,strokeWidth:2})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[fe.txButton,{backgroundColor:_.card.backgroundColor,borderColor:k.border}],onPress:i,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.txLabel,{color:_.card.titleColor,fontFamily:T.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.txHash,{color:_.card.subtitleColor,fontFamily:T.regular}],children:mn(r)}),jsxRuntime.jsx(Ut,{size:16,color:_.card.actionColor,strokeWidth:2})]})]})]})]})})}var fe=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"}});var Do=(e,t)=>`${t}:${e}`,Ei=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Xo({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:a,destinationTokenSymbol:p,defaultChainType:g,defaultChainId:l,defaultTokenAddress:c,onExecutionsChange:k,onDepositSuccess:T,onDepositError:_,borderTopLeftRadius:W,borderTopRightRadius:P,sheetBorderRadius:x}){let{colors:u,fonts:s,components:i}=O(),f=g&&l?`${g}:${l}`:"solana:mainnet",[q,L]=react.useState("USDC"),[D,H]=react.useState(f),[m,K]=react.useState([]),[le,ne]=react.useState(true),[ie,be]=react.useState([]),[X,Le]=react.useState(true),[We,Ee]=react.useState(false),[Je,oe]=react.useState(false),[xe,je]=react.useState(false),[ze,De]=react.useState(false),[ke,Jt]=react.useState([]),[xt,Kt]=react.useState(new Map),[st]=react.useState(()=>new Date),[Vt,Ke]=react.useState(null),[Ft,Bt]=react.useState(false),[ue,Xt]=react.useState(null),[Be,Xe]=react.useState(false),gt=new Map;ie.forEach(h=>{h.chains.forEach(b=>{let V=`${b.chain_type}:${b.chain_id}`;gt.has(V)||gt.set(V,b);});});let ho=Array.from(gt.values()),Ze=Ei(D),Ae=ho.find(h=>h.chain_type===Ze.chainType&&h.chain_id===Ze.chainId)?.chain_type||"ethereum",Ve=At(m,Ae)?.address||"",Wt=react.useRef(false);react.useEffect(()=>{async function h(){try{Le(!0),Ke(null);let V=await wo(t,a&&r&&n?{destination_token_address:a,destination_chain_id:r,destination_chain_type:n}:void 0);if(be(V.data),V.data.length>0&&!Wt.current){Wt.current=!0;let S,U;if(g&&l)if(c)for(let G of V.data){let _e=G.chains.find(Oe=>Oe.chain_type===g&&Oe.chain_id===l&&Oe.token_address.toLowerCase()===c.toLowerCase());if(_e){S=G,U=_e;break}}else for(let G of V.data){let _e=G.chains.find(Oe=>Oe.chain_type===g&&Oe.chain_id===l);if(_e){S=G,U=_e;break}}if(!S&&a)for(let G of V.data){let _e=G.chains.find(Oe=>Oe.token_address.toLowerCase()===a.toLowerCase());if(_e){S=G,U=_e;break}}S||(S=V.data.find(G=>G.symbol==="USDC"),S&&S.chains.length>0&&(U=S.chains[0])),S||(S=V.data.find(G=>G.symbol==="USDT"),S&&S.chains.length>0&&(U=S.chains[0])),S||(S=V.data[0],S.chains.length>0&&(U=S.chains[0])),S&&L(S.symbol),U&&H(Do(U.chain_id,U.chain_type));}}catch(b){console.error("Error fetching supported tokens:",b),Ke("Failed to load supported tokens"),_?.({message:"Failed to load supported tokens",error:b});}finally{Le(false);}}h();},[t,_,g,l,c,a,r,n]),react.useEffect(()=>{async function h(){try{ne(!0),Ke(null);let b=await zt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:a},t);K(b.data);}catch(b){console.error("Error fetching wallets:",b),Ke("Failed to load wallets"),_?.({message:"Failed to load wallets",error:b});}finally{ne(false);}}h();},[e,o,n,r,a,t,_]),react.useEffect(()=>{if(!e||!st)return;let h=setInterval(async()=>{try{let b=await Ot(e,t),V=null;for(let S of b.data){let U=S.created_at?new Date(S.created_at):null;if(!U||U<=st)continue;let G=xt.get(S.id);if(!G){V=S;break}if(["pending","waiting","delayed"].includes(G)&&S.status==="succeeded"){V=S;break}}if(V){let S=V;Jt(U=>{let G=U.findIndex(_e=>_e.id===S.id);if(G>=0){let _e=[...U];return _e[G]=S,_e}else return [...U,S]}),Kt(U=>{let G=new Map(U);return G.set(S.id,S.status),G}),Xt(S),Bt(!0),S.status==="succeeded"&&T?.({message:"Deposit completed successfully",executionId:S.id}),k?.([...ke,S]);}}catch(b){console.error("Error polling executions:",b),_?.({message:"Failed to check deposit status",error:b});}},5e3);return ()=>clearInterval(h)},[e,t,st,xt,ke,k,T,_]),react.useEffect(()=>{if(!ie.length)return;let h=ie.find(V=>V.symbol===q);if(!h||h.chains.length===0)return;if(!h.chains.some(V=>Do(V.chain_id,V.chain_type)===D)){let V=h.chains[0];H(Do(V.chain_id,V.chain_type));}},[q,ie,D]);let me=ie.find(h=>h.symbol===q),yo=me?.chains||[],Se=yo.find(h=>Do(h.chain_id,h.chain_type)===D),Zt=async()=>{if(Ve)try{reactNative.Clipboard.setString(Ve),Ee(!0),setTimeout(()=>Ee(!1),2e3);}catch(h){console.error("Failed to copy:",h);}},Ne=Se?.estimated_price_impact_percent??0,Et=Se?.max_slippage_percent??.25,Co=Se?.minimum_deposit_amount_usd??3;if(X)return jsxRuntime.jsxs(reactNative.View,{style:d.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[d.loadingText,{color:u.foregroundMuted,fontFamily:s.regular}],children:"Loading currencies..."})]});if(Vt&&ie.length===0)return jsxRuntime.jsxs(reactNative.View,{style:d.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.errorText,{color:u.error,fontFamily:s.regular}],children:Vt}),jsxRuntime.jsx(reactNative.Text,{style:[d.errorHint,{color:u.foregroundMuted,fontFamily:s.regular}],children:"Please check your network connection and try again."})]});let Q=()=>jsxRuntime.jsxs(ge,{visible:xe,onClose:()=>je(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:x?.tokenSelector?.borderTopLeftRadius??W,borderTopRightRadius:x?.tokenSelector?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[d.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:d.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[d.sheetTitle,{color:i.header.titleColor,fontFamily:s.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>je(false),style:d.sheetCloseButton,children:jsxRuntime.jsx(He,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.sheetList,showsVerticalScrollIndicator:false,children:ie.map(h=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{L(h.symbol),je(false);},style:[d.sheetItem,{backgroundColor:q===h.symbol?i.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(h,"png"))},style:d.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:d.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.sheetItemTitle,{color:i.card.titleColor,fontFamily:s.medium}],children:h.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[d.sheetItemSubtitle,{color:i.card.subtitleColor,fontFamily:s.regular}],children:[h.chains.length," network",h.chains.length!==1?"s":""," available"]})]}),q===h.symbol&&jsxRuntime.jsx(Re,{size:20,color:u.primary,strokeWidth:2})]},h.symbol))})]}),ce=()=>jsxRuntime.jsxs(ge,{visible:ze,onClose:()=>De(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:x?.chainSelector?.borderTopLeftRadius??W,borderTopRightRadius:x?.chainSelector?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[d.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:d.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[d.sheetTitle,{color:i.header.titleColor,fontFamily:s.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>De(false),style:d.sheetCloseButton,children:jsxRuntime.jsx(He,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.sheetList,showsVerticalScrollIndicator:false,children:yo.map(h=>{let b=Do(h.chain_id,h.chain_type),V=D===b;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{H(b),De(false);},style:[d.sheetItem,{backgroundColor:V?i.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(h,"png"))},style:d.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:d.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.sheetItemTitle,{color:i.card.titleColor,fontFamily:s.medium}],children:h.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[d.sheetItemSubtitle,{color:i.card.subtitleColor,fontFamily:s.regular}],children:["Min deposit: $",h.minimum_deposit_amount_usd]})]}),V&&jsxRuntime.jsx(Re,{size:20,color:u.primary,strokeWidth:2})]},b)})})]});return jsxRuntime.jsxs(reactNative.View,{style:d.container,children:[jsxRuntime.jsxs(reactNative.View,{style:d.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.selectorLabel,{color:i.card.labelColor,fontFamily:s.regular}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>je(true),style:[d.selector,{backgroundColor:i.card.backgroundColor}],children:[me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(me,"png"))},style:d.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[d.selectorText,{color:i.card.titleColor,fontFamily:s.medium}],children:q}),jsxRuntime.jsx(Ue,{size:16,color:i.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:d.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[d.selectorLabel,{color:i.card.labelColor,fontFamily:s.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[d.minDeposit,{fontFamily:s.regular}],children:["($",Co," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>De(true),style:[d.selector,{backgroundColor:i.card.backgroundColor}],children:[Se&&jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(Se,"png"))},style:d.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[d.selectorText,{color:i.card.titleColor,fontFamily:s.medium}],numberOfLines:1,children:Se?.chain_name||"Select network"}),jsxRuntime.jsx(Ue,{size:16,color:i.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:d.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[d.qrWrapper,{backgroundColor:u.background,borderColor:u.border}],children:le?jsxRuntime.jsxs(reactNative.View,{style:d.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[d.loadingText,{color:u.foregroundMuted,fontFamily:s.regular}],children:"Loading..."})]}):Ve?jsxRuntime.jsx(uo,{value:Ve,size:160,logoUri:$(ae(Se,"png")||Pe("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:d.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[d.errorText,{color:u.error,fontFamily:s.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:d.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:d.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.addressLabel,{color:i.card.labelColor,fontFamily:s.medium}],children:"Deposit Address"}),We&&jsxRuntime.jsxs(reactNative.View,{style:d.copiedIndicator,children:[jsxRuntime.jsx(Re,{size:14,color:u.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[d.copiedText,{color:u.success,fontFamily:s.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Zt,disabled:!Ve||le,activeOpacity:.7,style:[d.addressBox,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[d.addressText,{color:i.card.titleColor,fontFamily:s.regular}],numberOfLines:2,children:le?"Loading...":Ve||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:d.addressCopyIcon,children:jsxRuntime.jsx(So,{size:16,color:i.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[d.detailsCard,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>oe(!Je),style:d.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:d.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[d.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ht,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[d.detailsLabel,{color:i.card.titleColor,fontFamily:s.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:d.chevronContainer,children:Je?jsxRuntime.jsx(_t,{size:16,color:i.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ue,{size:16,color:i.card.actionColor,strokeWidth:2})})]}),Je&&jsxRuntime.jsxs(reactNative.View,{style:d.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:d.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[d.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(no,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[d.detailsLabel,{color:i.card.titleColor,fontFamily:s.regular}],children:["Price impact: ",Ne.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Xe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(io,{size:14,color:i.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:d.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[d.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(so,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[d.detailsLabel,{color:i.card.titleColor,fontFamily:s.regular}],children:["Slippage: Auto \u2022 ",Et.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Xe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(io,{size:14,color:i.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:d.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[d.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(No,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[d.detailsLabel,{color:i.card.titleColor,fontFamily:s.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:d.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[d.termsText,{color:u.primary,fontFamily:s.regular}],children:"Terms apply"})}),Q(),ce(),jsxRuntime.jsxs(ge,{visible:Be,onClose:()=>Xe(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:x?.infoSheet?.borderTopLeftRadius??W,borderTopRightRadius:x?.infoSheet?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[d.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:d.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[d.sheetTitle,{color:i.header.titleColor,fontFamily:s.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Xe(false),style:d.sheetCloseButton,children:jsxRuntime.jsx(He,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:d.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[d.infoCard,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:d.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[d.infoCardIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(no,{size:16,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[d.infoCardTitle,{color:i.card.titleColor,fontFamily:s.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[d.infoCardValue,{color:i.card.titleColor,fontFamily:s.medium}],children:[Ne.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[d.infoCardDescription,{color:i.card.descriptionColor,fontFamily:s.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:[d.infoCard,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:d.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[d.infoCardIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(so,{size:16,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[d.infoCardTitle,{color:i.card.titleColor,fontFamily:s.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[d.infoCardValue,{color:i.card.titleColor,fontFamily:s.medium}],children:[Et.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[d.infoCardDescription,{color:i.card.descriptionColor,fontFamily:s.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."})]})]})]}),ue&&jsxRuntime.jsx(po,{visible:Ft,status:ue.status,tokenIconUrl:ue.destination_token_metadata?.icon_urls?.find(h=>h.format==="png")?.url||ue.destination_token_metadata?.icon_url||ae(me,"png"),explorerUrl:ue.explorer_url,completionExplorerUrl:ue.destination_explorer_url,date:ue.created_at?new Date(ue.created_at):void 0,amountUsd:ue.source_amount_usd?parseFloat(ue.source_amount_usd):void 0,onClose:()=>Bt(false),borderTopLeftRadius:x?.depositStatus?.borderTopLeftRadius??W,borderTopRightRadius:x?.depositStatus?.borderTopRightRadius??P})]})}var d=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,borderRadius:16,borderWidth:1},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,borderRadius:8},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 Zo({currency:e,isSelected:t,onSelect:o}){let{colors:n,fonts:r,components:a}=O();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[qt.container,{backgroundColor:a.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:qt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[qt.iconContainer,{backgroundColor:n.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(e,"png"))},style:qt.icon})}),jsxRuntime.jsxs(reactNative.View,{style:qt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[qt.name,{color:a.card.titleColor,fontFamily:r.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[qt.code,{color:a.card.subtitleColor,fontFamily:r.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Re,{size:16,color:n.primary,strokeWidth:2})]})}var qt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 Fo({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{fonts:r,components:a}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:kn.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[kn.title,{color:a.list.titleSectionColor,fontFamily:r.medium}],children:e})}),t.map(p=>jsxRuntime.jsx(Zo,{currency:p,isSelected:o.toLowerCase()===p.currency_code.toLowerCase(),onSelect:n},p.currency_code))]})}var kn=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function tr({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:r,onSelectCurrency:a,borderTopLeftRadius:p,borderTopRightRadius:g}){let{colors:l,fonts:c,components:k}=O(),[T,_]=react.useState(""),W=n.map(q=>o.find(L=>L.currency_code.toLowerCase()===q.toLowerCase())).filter(q=>q!==void 0),P=o.filter(q=>!n.includes(q.currency_code.toLowerCase())),x=q=>{if(!T)return q;let L=T.toLowerCase();return q.filter(D=>D.name.toLowerCase().includes(L)||D.currency_code.toLowerCase().includes(L))},u=x(W),s=x(P),i=q=>{a(q),t(false),_("");},f=()=>{t(false),_("");};return jsxRuntime.jsxs(ge,{visible:e,onClose:f,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsx(Qe,{title:"Currency",showBack:false,onClose:f}),jsxRuntime.jsx(reactNative.View,{style:$t.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[$t.searchInput,{backgroundColor:k.search.backgroundColor,color:k.search.inputColor,fontFamily:c.regular}],value:T,onChangeText:_,placeholder:"Search",placeholderTextColor:k.search.placeholderColor})}),jsxRuntime.jsx(reactNative.ScrollView,{style:$t.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:$t.listContent,children:[jsxRuntime.jsx(Fo,{title:"Popular currencies",currencies:u,selectedCurrency:r,onSelect:i}),u.length>0&&s.length>0&&jsxRuntime.jsx(reactNative.View,{style:$t.sectionSpacer}),jsxRuntime.jsx(Fo,{title:"All currencies",currencies:s,selectedCurrency:r,onSelect:i}),u.length===0&&s.length===0&&jsxRuntime.jsx(reactNative.View,{style:$t.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.noResultsText,{color:k.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var $t=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Er(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 or({externalUserId:e,publishableKey:t,view:o,onViewChange:n,destinationTokenSymbol:r,recipientAddress:a,destinationChainType:p,destinationChainId:g,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:k,borderTopLeftRadius:T,borderTopRightRadius:_,sheetBorderRadius:W}){let{colors:P,fonts:x,components:u}=O(),[s,i]=react.useState(""),[f,q]=react.useState("usd"),[L,D]=react.useState(false),[H,m]=react.useState(false),[K,le]=react.useState([]),[ne,ie]=react.useState(false),[be,X]=react.useState(null),[Le,We]=react.useState(null),[Ee,Je]=react.useState("amount"),[oe,xe]=react.useState(null),[je,ze]=react.useState(true),[De,ke]=react.useState(null),[Jt,xt]=react.useState(false),Kt=react.useRef(null),st=react.useRef(false);react.useEffect(()=>{Kt.current=oe;},[oe]),react.useEffect(()=>{st.current=Jt;},[Jt]);let[Vt,Ke]=react.useState([]),[Ft,Bt]=react.useState(true),[ue,Xt]=react.useState(60),[Be,Xe]=react.useState([]),[gt,ho]=react.useState([]),[Ze,Pt]=react.useState(null),[Ae,fr]=react.useState(null),[Ve,Wt]=react.useState(true),[me,yo]=react.useState(null),[Se,Zt]=react.useState(false),[Ne,Et]=react.useState(null),[Co,Q]=react.useState(false),[ce,h]=react.useState(false),[b,V]=react.useState(false),[S,U]=react.useState(null),G=o??Ee,_e=react.useRef(null),Oe=Be.find(I=>I.currency_code.toLowerCase()===f.toLowerCase()),Hn=react.useCallback(I=>{Je(I),I==="quotes"?n?.(I,K.length):n?.(I);},[K.length,n]);react.useEffect(()=>{async function I(){try{let B=await xo();fr(B);}catch(B){console.error("Error fetching user IP:",B);}finally{Wt(false);}}I();},[]),react.useEffect(()=>{async function I(){try{let B=await zt({external_user_id:e,recipient_address:a,destination_chain_type:p,destination_chain_id:g,destination_token_address:l},t);Ke(B.data);}catch(B){console.error("Error fetching wallets:",B),X("Failed to load wallet addresses");}finally{Bt(false);}}I();},[e,a,p,g,l,t]);let Un=r||Ze?.symbol.toUpperCase()||"USDC",jn=to(Ze?.icon_urls,"png")||Ze?.icon_url,Nn=to(Ze?.chain_icon_urls,"png")||Ze?.chain_icon_url;react.useEffect(()=>{async function I(){try{let B=await xr(t);Xe(B.data),ho(B.preferred||[]);}catch(B){console.error("Error fetching fiat currencies:",B);}}I();},[t]),react.useEffect(()=>{if(L||Be.length===0||!Ae?.alpha2)return;let I=Ae.alpha2.toUpperCase(),B=Be.find(pe=>pe.country_codes.includes(I));if(B)q(B.currency_code.toLowerCase()),!s&&!H&&i(B.default_amount.toString());else if(!s&&!H){let pe=Be.find(at=>at.currency_code.toLowerCase()==="usd");pe&&i(pe.default_amount.toString());}},[Be,Ae,L,s,H]),react.useEffect(()=>{if(Be.length!==0){if(_e.current!==null&&_e.current!==f){let I=Be.find(B=>B.currency_code.toLowerCase()===f.toLowerCase());I&&i(I.default_amount.toString());}_e.current=f;}},[f,Be]),react.useEffect(()=>{async function I(){try{let B=await br({chain_type:p||"",chain_id:g||"",token_address:l||""},t);Pt(B);}catch(B){console.error("Error fetching supported tokens:",B);}}I();},[p,g,l,t]),react.useEffect(()=>{async function I(){if(!(!l||!g||!p)&&!Ve){Zt(true);try{let B=await Tr({country_code:Ae?.alpha2?.toUpperCase()||"US",subdivision_code:Ae?.state||void 0,token_address:l,chain_id:g,chain_type:p},t);yo(B);}catch(B){console.error("Error fetching default onramp token:",B);}finally{Zt(false);}}}I();},[l,g,p,Ae,Ve,t]),react.useEffect(()=>{let I=parseFloat(s);if(isNaN(I)||I<=0){le([]),We(null);return}if(!me||Se){le([]),xe(null);return}let B=Be.find(at=>at.currency_code.toLowerCase()===f.toLowerCase());if(B){if(I<B.minimum_amount){le([]),xe(null),We(`Minimum amount is ${Er(f)}${B.minimum_amount.toLocaleString()}`);return}if(I>B.maximum_amount){le([]),xe(null),We(`Maximum amount is ${Er(f)}${B.maximum_amount.toLocaleString()}`);return}}We(null);let pe=setTimeout(()=>{Gr(I);},500);return ()=>clearTimeout(pe)},[s,f,t,me,Se,Be]);let Gr=async I=>{if(!me){X("Loading token information...");return}ie(true),X(null);try{let B={country_code:Ae?.alpha2?.toUpperCase()||"US",source_amount:I.toString(),source_currency:f.toLowerCase(),destination_currency:me.destination_currency,destination_network:me.destination_network,subdivision_code:Ae?.state||void 0},pe=await kr(B,t);le(pe.data);let at=st.current,Yr=Kt.current;if(at&&Yr){let eo=pe.data.find(ft=>ft.service_provider===Yr.service_provider);if(eo){if(xe(eo),pe.data.length>0){let ft=pe.data.reduce((St,bo)=>bo.destination_amount>St.destination_amount?bo:St);De||ke(ft.service_provider),ze(eo.service_provider===De);}}else if(pe.data.length>0){let ft=pe.data.reduce((St,bo)=>bo.destination_amount>St.destination_amount?bo:St);xe(ft),ke(ft.service_provider),ze(!0),xt(!1);}}else if(pe.data.length>0){let eo=pe.data.reduce((ft,St)=>St.destination_amount>ft.destination_amount?St:ft);xe(eo),ke(eo.service_provider),ze(!0);}Xt(60);}catch(B){console.error("Failed to fetch quotes:",B),X("Failed to fetch quotes. Please try again."),le([]);}finally{ie(false);}};react.useEffect(()=>{if(K.length===0)return;let I=setInterval(()=>{Xt(B=>{if(B<=1){let pe=parseFloat(s);return !isNaN(pe)&&pe>0&&Gr(pe),60}return B-1});},1e3);return ()=>clearInterval(I)},[K.length,s]);let qn=I=>{(/^\d*\.?\d{0,2}$/.test(I)||I==="")&&(i(I),m(true));},$n=I=>{i(I.toString()),m(true);},Qn=async()=>{if(oe&&me)try{let I=me.destination_token_metadata.chain_type,B=At(Vt,I);if(!B?.address){X("Wallet address not available");return}let pe={service_provider:oe.service_provider,country_code:oe.country_code?.toUpperCase()||Ae?.alpha2?.toUpperCase()||"US",source_currency:oe.source_currency,source_amount:s,destination_currency:oe.destination_currency,destination_network:oe.destination_network,wallet_address:B.address,subdivision_code:Ae?.state||void 0},at=await wr(pe,t);Et({provider:oe,sourceCurrency:f,sourceAmount:s,sessionUrl:at.url}),U(at.url),V(!0);}catch(I){console.error("Failed to create session:",I),X("Failed to start payment flow"),k?.({message:"Failed to start payment flow",error:I});}},mr=Er(f),Gn=()=>{V(false),Hn("onramp"),c?.({message:"Payment flow completed"});},Yn=()=>jsxRuntime.jsx(Ki,{visible:b,onClose:Gn,url:S,providerName:oe?.service_provider_display_name||"Complete Payment",colors:P,fonts:x,borderTopLeftRadius:W?.webView?.borderTopLeftRadius??T,borderTopRightRadius:W?.webView?.borderTopRightRadius??_});return G==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:w.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:w.scrollContainer,contentContainerStyle:w.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:w.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Q(true),style:[w.currencyButton,{backgroundColor:u.card.backgroundColor}],children:[Oe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(Oe,"png"))},style:w.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[w.currencyText,{color:u.card.titleColor,fontFamily:x.medium}],children:f.toUpperCase()}),jsxRuntime.jsx(Ue,{size:16,color:u.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(tr,{open:Co,onOpenChange:Q,currencies:Be,preferredCurrencyCodes:gt,selectedCurrency:f,onSelectCurrency:I=>{q(I.toLowerCase()),D(true);},borderTopLeftRadius:W?.currencyModal?.borderTopLeftRadius??T,borderTopRightRadius:W?.currencyModal?.borderTopRightRadius??_}),jsxRuntime.jsx(reactNative.View,{style:w.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:w.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.currencySymbol,{color:u.container.titleColor,fontFamily:x.medium}],children:mr}),jsxRuntime.jsx(reactNative.TextInput,{style:[w.amountInput,{color:u.container.titleColor,fontFamily:x.medium}],value:s,onChangeText:qn,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:P.foregroundMuted})]})}),Oe?.suggested_amounts&&Oe.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:w.quickAmounts,children:Oe.suggested_amounts.map(I=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>$n(I),style:[w.quickAmountButton,{backgroundColor:u.card.backgroundColor},parseFloat(s)===I&&{borderColor:P.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[w.quickAmountText,{color:u.card.titleColor,fontFamily:x.medium}],children:[mr,I.toLocaleString()]})},I))}),Le&&jsxRuntime.jsx(reactNative.Text,{style:[w.validationError,{color:P.error,fontFamily:x.regular}],children:Le}),jsxRuntime.jsxs(reactNative.View,{style:w.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:w.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.providerLabel,{color:u.card.labelColor,fontFamily:x.medium}],children:"Provider"}),K.length>0&&!ne&&jsxRuntime.jsxs(reactNative.Text,{style:[w.refreshText,{color:u.card.labelRightColor,fontFamily:x.regular}],children:["Refreshing in ",ue,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>h(true),disabled:ne||K.length===0,style:[w.providerButton,{backgroundColor:u.card.backgroundColor},(ne||K.length===0)&&w.disabled],children:ne?jsxRuntime.jsxs(reactNative.View,{style:w.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[w.loadingText,{color:u.container.subtitleColor,fontFamily:x.regular}],children:"Finding best rates..."})]}):oe?jsxRuntime.jsxs(reactNative.View,{style:w.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:w.providerInfo,children:[je&&jsxRuntime.jsx(reactNative.Text,{style:[w.autoPickedText,{color:u.container.subtitleColor,fontFamily:x.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:w.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(Uo(oe.icon_urls,"png",oe.icon_url))},style:w.providerIconImage},`provider-${oe.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[w.providerName,{color:u.card.titleColor,fontFamily:x.medium}],children:oe.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[w.bestPriceText,{color:P.success,fontFamily:x.regular}],children:["Best price \u2022 ",oe.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(ht,{size:20,color:u.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[w.noProviderText,{color:u.container.subtitleColor,fontFamily:x.regular}],children:parseFloat(s)>0?"No providers available":"Enter an amount to see providers"})}),be&&jsxRuntime.jsx(reactNative.Text,{style:[w.errorText,{color:P.error,fontFamily:x.regular}],children:be})]}),jsxRuntime.jsxs(ge,{visible:ce,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:W?.providerModal?.borderTopLeftRadius??T,borderTopRightRadius:W?.providerModal?.borderTopRightRadius??_,children:[jsxRuntime.jsx(Qe,{title:"Select Provider",showBack:false,onClose:()=>h(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:w.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:w.quotesList,children:[...K].sort((I,B)=>B.destination_amount-I.destination_amount).map((I,B)=>{let pe=oe?.service_provider===I.service_provider,at=B===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{xe(I),xt(true),ze(I.service_provider===De),h(false);},style:[w.quoteItem,{backgroundColor:u.card.backgroundColor},pe&&{borderColor:P.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:w.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(Uo(I.icon_urls,"png",I.icon_url))},style:w.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[w.quoteName,{color:u.card.titleColor,fontFamily:x.medium}],children:I.service_provider_display_name}),at&&jsxRuntime.jsx(reactNative.Text,{style:[w.bestPriceLabel,{color:P.success,fontFamily:x.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:w.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[w.quoteAmount,{color:u.card.textRightColor,fontFamily:x.medium}],children:[I.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[w.quoteSource,{color:u.card.subtextRightColor,fontFamily:x.regular}],children:["Fee: ",mr,I.total_fee.toFixed(2)]})]})]},I.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[w.continueButtonContainer,{backgroundColor:P.background}],children:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Qn,disabled:ne||Ft||!oe||parseFloat(s)<=0,style:[w.continueButton,{backgroundColor:u.container.buttonColor},(ne||Ft||!oe)&&w.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:[w.continueButtonText,{color:u.container.buttonTitleColor,fontFamily:x.medium}],children:Ft?"Loading...":"Continue"})})})]}),Yn()]}):G==="onramp"&&Ne?jsxRuntime.jsxs(reactNative.View,{style:w.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(Uo(Ne.provider.icon_urls,"png",Ne.provider.icon_url))},style:w.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[w.onrampTitle,{color:u.container.titleColor,fontFamily:x.medium}],children:["Complete transaction with ",Ne.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[w.onrampSubtitle,{color:u.container.subtitleColor,fontFamily:x.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[w.flowDiagram,{backgroundColor:u.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:w.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Pe(`/icons/currencies/png/${Ne.sourceCurrency.toLowerCase()}.png`)},style:w.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[w.flowLabel,{color:u.card.subtitleColor,fontFamily:x.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[w.flowValue,{color:u.card.titleColor,fontFamily:x.medium}],children:Ne.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(ht,{size:16,color:u.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:w.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:w.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:to(me?.destination_token_metadata?.icon_urls,"png")||me?.destination_token_metadata?.icon_url||Pe("/icons/tokens/png/usdc.png")},style:w.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:to(me?.destination_token_metadata?.chain?.icon_urls,"png")||me?.destination_token_metadata?.chain?.icon_url||Pe("/icons/networks/png/polygon.png")},style:[w.flowNetworkBadge,{borderColor:P.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[w.flowLabel,{color:u.card.subtitleColor,fontFamily:x.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[w.flowValue,{color:u.card.titleColor,fontFamily:x.medium}],children:"USDC"})]}),jsxRuntime.jsx(ht,{size:16,color:u.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:w.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:w.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:jn||Pe("/icons/tokens/png/usdc.png")},style:w.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Nn||Pe("/icons/networks/png/polygon.png")},style:[w.flowNetworkBadge,{borderColor:P.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[w.flowLabel,{color:u.card.subtitleColor,fontFamily:x.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[w.flowValue,{color:u.card.titleColor,fontFamily:x.medium}],children:Un})]})]}),jsxRuntime.jsx(reactNative.View,{style:[w.onrampInfoBox,{backgroundColor:u.card.backgroundColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[w.onrampInfoText,{color:u.card.descriptionColor,fontFamily:x.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 Ki({visible:e,onClose:t,url:o,providerName:n,colors:r,fonts:a,borderTopLeftRadius:p,borderTopRightRadius:g}){return jsxRuntime.jsxs(ge,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:Qt.header,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:Qt.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Re,{size:20,color:r.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Qt.headerTitle,{color:r.foreground,fontFamily:a.medium}],children:n}),jsxRuntime.jsx(reactNative.View,{style:Qt.headerSpacer})]}),o&&jsxRuntime.jsx(reactNative.View,{style:Qt.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:o},style:Qt.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Qt.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:r.primary})})})})]})}var Qt=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"}}),w=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,borderRadius: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,borderRadius:8},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,borderRadius:12},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,borderRadius:12,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,borderRadius: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,borderRadius:7,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,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 os(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 rs(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ir({execution:e,onPress:t}){let {colors:o,fonts:n,components:r}=O(),a=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let g=$(ae(e.destination_token_metadata,"png")||Pe("/icons/tokens/png/usdc.png")),l=a?"Deposit Processing":"Deposit Completed",c=os(e.created_at||new Date().toISOString()),k=rs(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[wt.container,{backgroundColor:r.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:wt.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:g},style:wt.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[wt.statusBadge,{backgroundColor:a?o.warning:o.success,borderColor:r.card.backgroundColor}],children:a?jsxRuntime.jsx(rn,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Re,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:wt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wt.title,{color:r.card.titleColor,fontFamily:n.medium}],children:l}),jsxRuntime.jsx(reactNative.Text,{style:[wt.dateTime,{color:r.card.subtitleColor,fontFamily:n.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:wt.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wt.amount,{color:r.card.textRightColor,fontFamily:n.medium}],children:k}),jsxRuntime.jsx(ht,{size:20,color:r.card.actionColor,strokeWidth:2})]})]})}var wt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,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"}});var{height:ls}=reactNative.Dimensions.get("window");function Rn(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function vn(e,t=6){if(!e)return "\u2014";try{let o=Number(e)/Math.pow(10,t);return o===0?"0.00":o>=1?o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function cs(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Ln=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Dn(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function ds(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 ar({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:r,borderTopLeftRadius:a,borderTopRightRadius:p}){let{colors:g,fonts:l,components:c}=O(),[k,T]=react.useState(o),[_,W]=react.useState(false),[P,x]=react.useState(null),[u,s]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{if(!e||!n)return;let m=async()=>{W(true);try{let ne=[...(await Ot(n,r)).data].sort((ie,be)=>{let X=ie.created_at?new Date(ie.created_at).getTime():0;return (be.created_at?new Date(be.created_at).getTime():0)-X});T(ne);}catch(le){console.error("Failed to fetch executions:",le),T(o);}finally{W(false);}};m();let K=setInterval(m,1e4);return ()=>clearInterval(K)},[e,n,r,o]),react.useEffect(()=>{o.length>0&&T(m=>{let K=new Set(m.map(ne=>ne.id)),le=o.filter(ne=>!K.has(ne.id));return le.length>0?[...le,...m]:m});},[o]),react.useEffect(()=>{e||x(null);},[e]);let f=m=>{x(m);},q=()=>{x(null),s(false);},L=()=>{x(null),t();};return jsxRuntime.jsxs(ge,{visible:e,onClose:L,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:a,borderTopRightRadius:p,children:[jsxRuntime.jsx(Qe,{title:P?"Deposit Details":"Deposit Tracker",onClose:L,showClose:!P,showBack:!!P,onBack:q}),P?(()=>{if(!P)return null;let m=P,K=m.status==="pending"||m.status==="waiting"||m.status==="delayed",le=m.status==="succeeded",ne=$(ae(m.destination_token_metadata,"png")||Pe("/icons/tokens/png/usdc.png")),ie=m.provider_metadata?.details,be=ie?.currencyIn,X=ie?.currencyOut;be?.currency?.symbol||"USDC";X?.currency?.symbol||"USDC";let Ee=vn(m.source_amount_base_unit,m.source_token_metadata?.decimals),Je=vn(m.destination_amount_base_unit,m.destination_token_metadata?.decimals),oe=cs(m.source_amount_usd),xe=Rn(m.source_chain_type,m.source_chain_id),je=Rn(m.destination_chain_type,m.destination_chain_id),ze=()=>{m.explorer_url&&reactNative.Linking.openURL(m.explorer_url);},De=()=>{m.destination_explorer_url&&reactNative.Linking.openURL(m.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:i,style:F.scrollContainer,contentContainerStyle:F.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:F.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:F.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne},style:F.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[F.statusBadge,{backgroundColor:K?g.warning:g.success,borderColor:g.background}],children:K?jsxRuntime.jsx(Ue,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Re,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:F.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[F.statusDot,{backgroundColor:K?g.warning:g.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[F.statusText,{color:c.container.titleColor,fontFamily:l.semibold}],children:K?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[F.dateText,{color:c.container.subtitleColor,fontFamily:l.regular}],children:ds(m.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[F.card,{backgroundColor:c.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:[Ee," ",Dn(m.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:g.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:[Je," ",Dn(m.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:g.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:oe})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:g.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:xe})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:g.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:je})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let ke=!u;s(ke),ke?setTimeout(()=>{i.current?.scrollToEnd({animated:true});},100):i.current?.scrollTo({y:0,animated:true});},style:F.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.toggleText,{color:c.container.actionTitle,fontFamily:l.regular}],children:u?"See less":"See more details"}),u?jsxRuntime.jsx(_t,{size:14,color:c.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ue,{size:14,color:c.container.actionColor,strokeWidth:2})]}),u&&jsxRuntime.jsxs(reactNative.View,{style:[F.card,{backgroundColor:c.card.backgroundColor}],children:[m.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ze,style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:Ln(m.transaction_hash)}),jsxRuntime.jsx(Ut,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:g.border}]})]}),m.destination_explorer_url&&le&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:De,style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:l.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:l.medium}],children:Ln(m.destination_transaction_hashes[0])}),jsxRuntime.jsx(Ut,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:F.scrollContainer,contentContainerStyle:F.scrollContent,showsVerticalScrollIndicator:false,children:k.length===0?jsxRuntime.jsxs(reactNative.View,{style:F.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.emptyText,{color:c.container.titleColor,fontFamily:l.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[F.emptySubtext,{color:c.container.subtitleColor,fontFamily:l.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:F.executionsList,children:k.map(m=>jsxRuntime.jsx(ir,{execution:m,onPress:()=>f(m)},m.id))})})]})}var F=reactNative.StyleSheet.create({scrollContainer:{maxHeight:ls*.7,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 Bo(e,t=true){let[o,n]=react.useState(null),[r,a]=react.useState(null),[p,g]=react.useState(false),[l,c]=react.useState(false),[k,T]=react.useState(null),[_,W]=react.useState(null);react.useEffect(()=>{!t||o||(g(true),xo().then(s=>{n(s),T(null);}).catch(s=>{T(s instanceof Error?s:new Error(String(s)));}).finally(()=>{g(false);}));},[t,o]),react.useEffect(()=>{!t||!e||r||(c(true),To(e).then(s=>{a(s),W(null);}).catch(s=>{W(s instanceof Error?s:new Error(String(s)));}).finally(()=>{c(false);}));},[t,e,r]);let P=p||l,x=k||_||null,u=null;if(o&&r){let s=r.blocked_country_codes||[],i=o.alpha2.toUpperCase();u=!s.some(f=>f.toUpperCase()===i);}return {isAllowed:u,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:P,error:x}}var Ur="unifold_recent_tokens",gs=5,Wn=[{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 dr(){try{let e=await Hr__default.default.getItem(Ur);return e?JSON.parse(e):[]}catch{return []}}async function fs(e){try{let o=(await dr()).filter(r=>!(r.symbol===e.symbol&&r.chainType===e.chainType&&r.chainId===e.chainId));o.unshift(e);let n=o.slice(0,gs);await Hr__default.default.setItem(Ur,JSON.stringify(n));}catch{}}async function ms(e){try{let o=(await dr()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));return await Hr__default.default.setItem(Ur,JSON.stringify(o)),o}catch{return []}}function jr({visible:e,onClose:t,tokens:o,selectedToken:n,selectedChainKey:r,onSelect:a,borderTopLeftRadius:p,borderTopRightRadius:g}){let{colors:l,fonts:c,components:k}=O(),[T,_]=react.useState(""),[W,P]=react.useState([]);react.useEffect(()=>{e&&dr().then(P);},[e]),react.useEffect(()=>{e||_("");},[e]);let x=react.useMemo(()=>{let L=[];return o.forEach(D=>{D.chains.forEach(H=>{L.push({token:D,chain:H});});}),L},[o]),u=react.useMemo(()=>{let L=[],D=new Set,H=(m,K,le,ne)=>{let ie=`${m}-${K}:${le}`;if(D.has(ie))return;let be=o.find(Le=>Le.symbol===m);if(!be)return;let X=be.chains.find(Le=>Le.chain_type===K&&Le.chain_id===le);X&&(D.add(ie),L.push({token:be,chain:X,isRecent:ne}));};return W.forEach(m=>{H(m.symbol,m.chainType,m.chainId,true);}),Wn.forEach(m=>{H(m.symbol,m.chainType,m.chainId,false);}),L},[o,W]),s=react.useMemo(()=>{if(!T.trim())return x;let L=T.toLowerCase();return x.filter(({token:D,chain:H})=>D.symbol.toLowerCase().includes(L)||D.name.toLowerCase().includes(L)||H.chain_name.toLowerCase().includes(L))},[x,T]),i=(L,D,H)=>Wn.some(m=>m.symbol===L&&m.chainType===D&&m.chainId===H),f=async(L,D)=>{let H=`${D.chain_type}:${D.chain_id}`;if(!i(L.symbol,D.chain_type,D.chain_id)){await fs({symbol:L.symbol,chainType:D.chain_type,chainId:D.chain_id});let m=await dr();P(m);}_(""),a(L.symbol,H),t();},q=async(L,D)=>{let H=await ms({symbol:L.symbol,chainType:D.chain_type,chainId:D.chain_id});P(H);};return jsxRuntime.jsxs(ge,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:ee.header,children:[jsxRuntime.jsx(reactNative.View,{style:ee.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ee.headerTitle,{color:k.header.titleColor,fontFamily:c.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:ee.closeButton,children:jsxRuntime.jsx(He,{size:20,color:k.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ee.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ee.searchInput,{backgroundColor:k.search.backgroundColor,color:k.search.inputColor,fontFamily:c.regular}],placeholder:"Search",placeholderTextColor:k.search.placeholderColor,value:T,onChangeText:_,autoCapitalize:"none",autoCorrect:false})}),u.length>0&&!T&&jsxRuntime.jsxs(reactNative.View,{style:ee.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.sectionLabel,{color:k.list.titleSectionColor,fontFamily:c.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:ee.quickSelectScroll,children:u.map(({token:L,chain:D,isRecent:H})=>{let m=`${D.chain_type}:${D.chain_id}`;L.symbol===n&&m===r;return jsxRuntime.jsxs(reactNative.View,{children:[H&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>q(L,D),style:ee.removeButton,children:jsxRuntime.jsx(He,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>f(L,D),style:[ee.quickSelectItem],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(L,"png"))},style:ee.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(D,"png"))},style:[ee.quickSelectChainBadge,{borderColor:k.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.quickSelectSymbol,{color:k.card.titleColor,fontFamily:c.medium}],children:L.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ee.quickSelectChain,{color:k.card.subtitleColor,fontFamily:c.regular}],children:D.chain_name})]})]})]},`quick-${L.symbol}-${m}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[ee.sectionLabel,{color:k.list.titleSectionColor,fontFamily:c.regular}],children:"All supported tokens"}),jsxRuntime.jsx(reactNative.ScrollView,{style:ee.tokenList,showsVerticalScrollIndicator:false,contentContainerStyle:ee.tokenListContent,children:s.length===0?jsxRuntime.jsx(reactNative.View,{style:ee.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ee.emptyText,{color:l.foregroundMuted,fontFamily:c.regular}],children:"No tokens found"})}):s.map(({token:L,chain:D})=>{let H=`${D.chain_type}:${D.chain_id}`,m=L.symbol===n&&H===r;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>f(L,D),style:[ee.tokenItem,{backgroundColor:m?k.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:ee.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(L,"png"))},style:ee.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(D,"png"))},style:[ee.tokenChainBadge,{borderColor:k.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ee.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenSymbol,{color:k.card.titleColor,fontFamily:c.medium}],children:L.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ee.tokenChainName,{color:k.card.subtitleColor,fontFamily:c.regular}],children:D.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[ee.minDeposit,{color:k.card.labelColor,fontFamily:c.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:k.card.labelHighlightRightColor,fontFamily:c.regular},children:["$",D.minimum_deposit_amount_usd]})]})]},`${L.symbol}-${H}`)})})]})}var ee=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,borderRadius:8,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,borderRadius: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 ur=(e,t)=>`${t}:${e}`,ks=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Nr({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:a,destinationTokenSymbol:p,defaultChainType:g,defaultChainId:l,defaultTokenAddress:c,onExecutionsChange:k,onDepositSuccess:T,onDepositError:_,wallets:W,borderTopLeftRadius:P,borderTopRightRadius:x,sheetBorderRadius:u}){let{colors:s,fonts:i,components:f}=O(),q=g&&l?`${g}:${l}`:"solana:mainnet",[L,D]=react.useState("USDC"),[H,m]=react.useState(q),[K,le]=react.useState([]),[ne,ie]=react.useState(!W?.length),be=W?.length?W:K,[X,Le]=react.useState([]),[We,Ee]=react.useState(true),[Je,oe]=react.useState(false),[xe,je]=react.useState(false),[ze,De]=react.useState(false),[ke,Jt]=react.useState([]),[xt,Kt]=react.useState(new Map),[st]=react.useState(()=>new Date),[Vt,Ke]=react.useState(null),[Ft,Bt]=react.useState(false),[ue,Xt]=react.useState(null),[Be,Xe]=react.useState(false),gt=new Map;X.forEach(Q=>{Q.chains.forEach(ce=>{let h=`${ce.chain_type}:${ce.chain_id}`;gt.has(h)||gt.set(h,ce);});});let ho=Array.from(gt.values()),Ze=ks(H),Pt=ho.find(Q=>Q.chain_type===Ze.chainType&&Q.chain_id===Ze.chainId),Ae=Pt?.chain_type||"ethereum",Ve=At(be,Ae)?.address||"",Wt=react.useRef(false);react.useEffect(()=>{async function Q(){try{Ee(!0),Ke(null);let h=await wo(t,a&&r&&n?{destination_token_address:a,destination_chain_id:r,destination_chain_type:n}:void 0);if(Le(h.data),h.data.length>0&&!Wt.current){Wt.current=!0;let b,V;if(g&&l)if(c)for(let S of h.data){let U=S.chains.find(G=>G.chain_type===g&&G.chain_id===l&&G.token_address.toLowerCase()===c.toLowerCase());if(U){b=S,V=U;break}}else for(let S of h.data){let U=S.chains.find(G=>G.chain_type===g&&G.chain_id===l);if(U){b=S,V=U;break}}if(!b&&a)for(let S of h.data){let U=S.chains.find(G=>G.token_address.toLowerCase()===a.toLowerCase());if(U){b=S,V=U;break}}b||(b=h.data.find(S=>S.symbol==="USDC"),b&&b.chains.length>0&&(V=b.chains[0])),b||(b=h.data.find(S=>S.symbol==="USDT"),b&&b.chains.length>0&&(V=b.chains[0])),b||(b=h.data[0],b.chains.length>0&&(V=b.chains[0])),b&&D(b.symbol),V&&m(ur(V.chain_id,V.chain_type));}}catch(ce){console.error("Error fetching supported tokens:",ce),Ke("Failed to load supported tokens"),_?.({message:"Failed to load supported tokens",error:ce});}finally{Ee(false);}}Q();},[t,a,r,n,g,l,c,_]),react.useEffect(()=>{k&&k(ke);},[ke,k]),react.useEffect(()=>{if(W?.length){ie(false);return}if(K.length>0){ie(false);return}let Q=null,ce=false,h=async()=>{if(!ce){ie(true);try{let b=await zt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:a},t);ce||(le(b.data),Ke(null),ie(!1));}catch(b){console.error("Error fetching wallets, retrying in 5s:",b),ce||(Ke(b instanceof Error?b.message:"Failed to load wallets"),ie(false),Q=setTimeout(h,5e3));}}};return h(),()=>{ce=true,Q&&clearTimeout(Q);}},[e,o,n,r,a,t,W,K.length]),react.useEffect(()=>{if(!e||!st)return;let Q=setInterval(async()=>{try{let ce=await Ot(e,t),h=null;for(let b of ce.data){let V=b.created_at?new Date(b.created_at):null;if(!V||V<=st)continue;let S=xt.get(b.id);if(!S){h=b;break}if(["pending","waiting","delayed"].includes(S)&&b.status==="succeeded"){h=b;break}}if(h){let b=h;Jt(V=>{let S=V.findIndex(U=>U.id===b.id);if(S>=0){let U=[...V];return U[S]=b,U}else return [...V,b]}),Kt(V=>{let S=new Map(V);return S.set(b.id,b.status),S}),Xt(b),Bt(!0),b.status==="succeeded"&&T?.({message:"Deposit completed successfully",executionId:b.id}),k?.([...ke,b]);}}catch(ce){console.error("Error polling executions:",ce),_?.({message:"Failed to check deposit status",error:ce});}},3e3);return ()=>clearInterval(Q)},[e,t,st,xt,ke,k,T,_]),react.useEffect(()=>{if(!X.length)return;let Q=X.find(h=>h.symbol===L);if(!Q||Q.chains.length===0)return;if(!Q.chains.some(h=>ur(h.chain_id,h.chain_type)===H)){let h=Q.chains[0];m(ur(h.chain_id,h.chain_type));}},[L,X,H]);let me=X.find(Q=>Q.symbol===L),Se=(me?.chains||[]).find(Q=>ur(Q.chain_id,Q.chain_type)===H),Zt=async()=>{if(Ve)try{reactNative.Clipboard.setString(Ve),oe(!0),setTimeout(()=>oe(!1),2e3);}catch(Q){console.error("Failed to copy:",Q);}},Ne=Se?.estimated_price_impact_percent??0,Et=Se?.max_slippage_percent??.25,Co=Se?.minimum_deposit_amount_usd??3;return We?jsxRuntime.jsxs(reactNative.View,{style:C.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:s.primary}),jsxRuntime.jsx(reactNative.Text,{style:[C.loadingText,{color:s.foregroundMuted,fontFamily:i.regular}],children:"Loading currencies..."})]}):Vt&&X.length===0?jsxRuntime.jsxs(reactNative.View,{style:C.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.errorText,{color:s.error,fontFamily:i.regular}],children:Vt}),jsxRuntime.jsx(reactNative.Text,{style:[C.errorHint,{color:s.foregroundMuted,fontFamily:i.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:C.container,children:[jsxRuntime.jsxs(reactNative.View,{style:C.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.selectorLabel,{color:f.card.labelColor,fontFamily:i.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>De(true),disabled:We||X.length===0,style:[C.tokenSelectorButton,{backgroundColor:f.card.backgroundColor}],activeOpacity:.7,children:We?jsxRuntime.jsxs(reactNative.View,{style:C.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[C.loadingIcon,{backgroundColor:s.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:C.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[C.loadingLine,{backgroundColor:s.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[C.loadingLine,{backgroundColor:s.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:C.tokenIconWrapper,children:[me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(me,"png"))},style:C.tokenMainIcon}),(Se||Pt)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:$(ae(Se||Pt,"png"))},style:[C.tokenChainBadge,{borderColor:f.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:C.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:i.semibold}],children:me?.symbol||L}),jsxRuntime.jsx(reactNative.Text,{style:[C.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:i.regular}],numberOfLines:1,children:Se?.chain_name||Pt?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:C.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[C.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:i.medium}],children:["$",Co," min"]}),jsxRuntime.jsx(ht,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(jr,{visible:ze,onClose:()=>De(false),tokens:X,selectedToken:L,selectedChainKey:H,onSelect:(Q,ce)=>{D(Q),m(ce);},borderTopLeftRadius:u?.tokenSelector?.borderTopLeftRadius??P,borderTopRightRadius:u?.tokenSelector?.borderTopRightRadius??x}),jsxRuntime.jsx(reactNative.View,{style:C.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[C.qrWrapper,{backgroundColor:s.background,borderColor:s.border}],children:ne?jsxRuntime.jsxs(reactNative.View,{style:C.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.primary}),jsxRuntime.jsx(reactNative.Text,{style:[C.loadingText,{color:s.foregroundMuted,fontFamily:i.regular}],children:"Loading..."})]}):Ve?jsxRuntime.jsx(uo,{value:Ve,size:180,logoUri:$(ae(Se,"png")||Pe("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:C.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[C.errorText,{color:s.error,fontFamily:i.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:C.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:C.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.addressLabel,{color:f.card.labelColor,fontFamily:i.medium}],children:"Deposit Address"}),Je&&jsxRuntime.jsxs(reactNative.View,{style:C.copiedIndicator,children:[jsxRuntime.jsx(Re,{size:14,color:s.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[C.copiedText,{color:s.success,fontFamily:i.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Zt,disabled:!Ve||ne,activeOpacity:.7,style:[C.addressBox,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[C.addressText,{color:f.card.titleColor,fontFamily:i.regular}],numberOfLines:2,children:ne?"Loading...":Ve||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:C.addressCopyIcon,children:jsxRuntime.jsx(So,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[C.detailsCard,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>je(!xe),style:C.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ht,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[C.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:C.chevronContainer,children:xe?jsxRuntime.jsx(_t,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ue,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),xe&&jsxRuntime.jsxs(reactNative.View,{style:C.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(no,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[C.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:["Price impact: ",Ne.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Xe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(io,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(so,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[C.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:["Slippage: Auto \u2022 ",Et.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Xe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(io,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(No,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[C.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:C.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[C.termsText,{color:s.primary,fontFamily:i.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ge,{visible:Be,onClose:()=>Xe(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:u?.infoSheet?.borderTopLeftRadius??P,borderTopRightRadius:u?.infoSheet?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[C.sheetHeader,{borderBottomColor:s.border}],children:[jsxRuntime.jsx(reactNative.View,{style:C.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[C.sheetTitle,{color:f.header.titleColor,fontFamily:i.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Xe(false),style:C.sheetCloseButton,children:jsxRuntime.jsx(He,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:C.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[C.infoCard,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:C.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[C.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(no,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardTitle,{color:f.card.titleColor,fontFamily:i.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[C.infoCardValue,{color:f.card.titleColor,fontFamily:i.medium}],children:[Ne.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardDescription,{color:f.card.descriptionColor,fontFamily:i.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[C.infoCard,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:C.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[C.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(so,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardTitle,{color:f.card.titleColor,fontFamily:i.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[C.infoCardValue,{color:f.card.titleColor,fontFamily:i.medium}],children:[Et.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardDescription,{color:f.card.descriptionColor,fontFamily:i.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),ue&&jsxRuntime.jsx(po,{visible:Ft,status:ue.status,tokenIconUrl:ue.destination_token_metadata?.icon_urls?.find(Q=>Q.format==="png")?.url||ue.destination_token_metadata?.icon_url||ae(me,"png"),explorerUrl:ue.explorer_url,completionExplorerUrl:ue.destination_explorer_url,date:ue.created_at?new Date(ue.created_at):void 0,amountUsd:ue.source_amount_usd?parseFloat(ue.source_amount_usd):void 0,onClose:()=>Bt(false),borderTopLeftRadius:u?.depositStatus?.borderTopLeftRadius??P,borderTopRightRadius:u?.depositStatus?.borderTopRightRadius??x})]})}var C=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,borderRadius: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,borderRadius:16,borderWidth:1},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,borderRadius:8},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 Yt={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Is({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:r="Deposit",destinationTokenSymbol:a,recipientAddress:p,destinationChainType:g,destinationChainId:l,destinationTokenAddress:c,defaultChainType:k,defaultChainId:T,defaultTokenAddress:_,hideDepositTracker:W=false,transferInputVariant:P="double_input",onDepositSuccess:x,onDepositError:u,sheetBorderRadius:s}){let i=s?.globalBorderTopLeftRadius,f=s?.globalBorderTopRightRadius,{colors:q,fonts:L}=O(),[D,H]=react.useState([]),[m,K]=react.useState(false),[le,ne]=react.useState(false),[ie,be]=react.useState(false),[X,Le]=react.useState(null),[We,Ee]=react.useState("amount"),{isAllowed:Je,isLoading:oe}=Bo(n,e);react.useEffect(()=>{e&&!X&&To(n).then(Le).catch(console.error);},[e,X,n]);let xe=()=>{t();},je=D.filter(ke=>ke.status==="pending"||ke.status==="waiting").length,ze=oe||e&&!X,De=Je===false;return jsxRuntime.jsxs(ge,{visible:e,onClose:xe,closeOnBackdropPress:false,showHandle:false,borderTopLeftRadius:s?.main?.borderTopLeftRadius??i,borderTopRightRadius:s?.main?.borderTopRightRadius??f,children:[jsxRuntime.jsx(Qe,{title:r,showBack:false,onClose:xe}),ze&&jsxRuntime.jsx(reactNative.View,{style:Tt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:q.primary})}),!ze&&De&&jsxRuntime.jsxs(reactNative.View,{style:Tt.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Tt.iconContainer,{backgroundColor:q.cardHover}],children:jsxRuntime.jsx(qo,{size:32,color:q.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Tt.blockedTitle,{color:q.foreground,fontFamily:L.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Tt.blockedDescription,{color:q.foreground,opacity:.7,fontFamily:L.regular}],children:"There are no supported tokens available from your current location."})]}),!ze&&!De&&jsxRuntime.jsxs(reactNative.View,{style:Tt.optionsContainer,children:[jsxRuntime.jsx(_o,{onPress:()=>ne(true),title:Yt.transferCrypto.title,subtitle:Yt.transferCrypto.subtitle,featuredTokens:X?.transfer_crypto?.networks}),jsxRuntime.jsx(Ro,{onPress:()=>be(true),title:Yt.depositWithCard.title,subtitle:Yt.depositWithCard.subtitle,paymentNetworks:X?.payment_networks?.networks}),!W&&jsxRuntime.jsx(vo,{onPress:()=>K(true),title:Yt.depositTracker.title,subtitle:Yt.depositTracker.subtitle,badge:je>0?je:void 0})]}),jsxRuntime.jsx(ar,{visible:m,onClose:()=>K(false),executions:D,externalUserId:o,publishableKey:n,borderTopLeftRadius:s?.depositsTracker?.borderTopLeftRadius??i,borderTopRightRadius:s?.depositsTracker?.borderTopRightRadius??f}),jsxRuntime.jsxs(ge,{visible:le,onClose:()=>ne(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:s?.transferCrypto?.borderTopLeftRadius??i,borderTopRightRadius:s?.transferCrypto?.borderTopRightRadius??f,children:[jsxRuntime.jsx(Qe,{title:Yt.transferCrypto.title,showBack:false,onClose:()=>ne(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:Tt.transferScrollContainer,contentContainerStyle:Tt.scrollContent,showsVerticalScrollIndicator:false,children:P==="single_input"?jsxRuntime.jsx(Nr,{externalUserId:o,publishableKey:n,recipientAddress:p,destinationChainType:g,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:a,defaultChainType:k,defaultChainId:T,defaultTokenAddress:_,onExecutionsChange:H,onDepositSuccess:x,onDepositError:u,borderTopLeftRadius:i,borderTopRightRadius:f,sheetBorderRadius:{tokenSelector:s?.tokenSelector,infoSheet:s?.infoSheet,depositStatus:s?.depositStatus}}):jsxRuntime.jsx(Xo,{externalUserId:o,publishableKey:n,recipientAddress:p,destinationChainType:g,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:a,defaultChainType:k,defaultChainId:T,defaultTokenAddress:_,onExecutionsChange:H,onDepositSuccess:x,onDepositError:u,borderTopLeftRadius:i,borderTopRightRadius:f,sheetBorderRadius:{tokenSelector:s?.tokenSelector,chainSelector:s?.chainSelector,infoSheet:s?.infoSheet,depositStatus:s?.depositStatus}})})]}),jsxRuntime.jsxs(ge,{visible:ie,onClose:()=>{be(false),Ee("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:s?.buyWithCard?.borderTopLeftRadius??i,borderTopRightRadius:s?.buyWithCard?.borderTopRightRadius??f,children:[jsxRuntime.jsx(Qe,{title:`Deposit ${a||"USDC"}`,showBack:We==="onramp",onBack:()=>Ee("amount"),onClose:()=>{be(false),Ee("amount");}}),jsxRuntime.jsx(reactNative.View,{style:Tt.buyWithCardContainer,children:jsxRuntime.jsx(or,{externalUserId:o,publishableKey:n,destinationTokenSymbol:a,recipientAddress:p,destinationChainType:g,destinationChainId:l,destinationTokenAddress:c,onDepositSuccess:x,onDepositError:u,view:We,onViewChange:ke=>Ee(ke),borderTopLeftRadius:i,borderTopRightRadius:f,sheetBorderRadius:{providerModal:s?.providerModal,webView:s?.webView,currencyModal:s?.currencyModal}})})]})]})}function pr({theme:e="auto",...t}){return jsxRuntime.jsx(Is,{...t})}var Tt=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{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}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Es=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),Mn=react.createContext(null);function zs({children:e,publishableKey:t,config:o}){let[n]=react.useState(()=>Es()),[r,a]=react.useState(false),[p,g]=react.useState(null),l=reactNative.useColorScheme(),c=react.useRef(false);c.current||(Ho({publishableKey:t}),c.current=true);let k=react.useMemo(()=>{let i=o?.appearance||"dark";return i==="auto"?l==="dark"?"dark":"light":i},[o?.appearance,l]);react.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.'),Ho({publishableKey:t});},[t]);let T=react.useRef(null),_=react.useRef(null),W=react.useCallback(i=>{_.current&&(clearTimeout(_.current),_.current=null),T.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),T.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),T.current=null);let f=new Promise((q,L)=>{T.current={resolve:q,reject:L};});return g(i),a(true),f},[]),P=react.useCallback(()=>{T.current&&(T.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),T.current=null),a(false),_.current=setTimeout(()=>{g(null),_.current=null;},200);},[]),x=react.useCallback(i=>{p?.onSuccess&&p.onSuccess(i),T.current&&(T.current.resolve(i),T.current=null);},[p]),u=react.useCallback(i=>{console.error("[UnifoldProvider] Deposit error:",i),p?.onError&&p.onError(i),T.current&&(T.current.reject(i),T.current=null);},[p]),s=react.useMemo(()=>({publishableKey:t,beginDeposit:W,closeDeposit:P}),[t,W,P]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:n,children:jsxRuntime.jsx(Mn.Provider,{value:s,children:jsxRuntime.jsxs(Ao,{mode:k,accentColor:o?.accentColor,theme:o?.theme,fontFamily:o?.fontFamily,fonts:o?.fonts,components:o?.components,children:[e,p&&jsxRuntime.jsx(pr,{visible:r,onClose:P,publishableKey:t,modalTitle:o?.modalTitle,externalUserId:p.externalUserId,destinationChainType:p.destinationChainType,destinationChainId:p.destinationChainId,destinationTokenSymbol:p.destinationTokenSymbol,recipientAddress:p.recipientAddress,destinationTokenAddress:p.destinationTokenAddress,defaultChainType:p.defaultChainType,defaultChainId:p.defaultChainId,defaultTokenAddress:p.defaultTokenAddress,hideDepositTracker:o?.hideDepositTracker,transferInputVariant:o?.transferInputVariant,onDepositSuccess:x,onDepositError:u,theme:k,sheetBorderRadius:o?.sheetBorderRadius})]})})})}function As(){let e=react.useContext(Mn);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
2
- exports.UnifoldProvider=zs;exports.setDevApiUrl=Kr;exports.useAllowedCountry=Bo;exports.useUnifold=As;
1
+ 'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),_e=require('react-native-svg'),Ai=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview'),sn=require('@react-native-async-storage/async-storage');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var _e__default=/*#__PURE__*/_interopDefault(_e);var Ai__default=/*#__PURE__*/_interopDefault(Ai);var sn__default=/*#__PURE__*/_interopDefault(sn);var _r={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)"}},Ir=_r;function No(e,t,o){let n=o?t?.[o]:void 0,r=(s,l,d)=>{let a=n?.[s]?.[l];if(a!==void 0)return a;let c=t?.[s]?.[l];return c!==void 0?c:d};return {header:{titleColor:r("header","titleColor",e.foreground),buttonColor:r("header","buttonColor",e.foreground)},card:{backgroundColor:r("card","backgroundColor",e.card),titleColor:r("card","titleColor",e.foreground),subtitleColor:r("card","subtitleColor",e.foregroundMuted),labelColor:r("card","labelColor",e.foregroundMuted),headerColor:r("card","headerColor",e.foregroundMuted),labelRightColor:r("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:r("card","labelHighlightRightColor",e.warning),textRightColor:r("card","textRightColor",e.foreground),subtextRightColor:r("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:r("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:r("card","rowRightLabel",e.foreground),iconColor:r("card","iconColor",e.primary),iconBackgroundColor:r("card","iconBackgroundColor",e.primary+"26"),actionColor:r("card","actionColor",e.foregroundMuted),actionIcon:r("card","actionIcon",e.foregroundMuted),descriptionColor:r("card","descriptionColor",e.foregroundMuted)},input:{backgroundColor:r("input","backgroundColor",e.card),textColor:r("input","textColor",e.foreground),placeholderColor:r("input","placeholderColor",e.foregroundMuted),borderColor:r("input","borderColor",e.border)},button:{primaryBackground:r("button","primaryBackground",e.primary),primaryText:r("button","primaryText",e.primaryForeground),secondaryBackground:r("button","secondaryBackground",e.card),secondaryText:r("button","secondaryText",e.foreground)},container:{titleColor:r("container","titleColor",e.foreground),subtitleColor:r("container","subtitleColor",e.foregroundMuted),actionColor:r("container","actionColor",e.foregroundMuted),actionTitle:r("container","actionTitle",e.foregroundMuted),buttonColor:r("container","buttonColor",e.primary),buttonTitleColor:r("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:r("container","iconBackgroundColor",e.success),iconColor:r("container","iconColor",e.foreground)},search:{backgroundColor:r("search","backgroundColor",e.card),inputColor:r("search","inputColor",e.foreground),placeholderColor:r("search","placeholderColor",e.foregroundMuted)},list:{titleSectionColor:r("list","titleSectionColor",e.foregroundMuted)}}}function Rr(e,t,o){let r={..._r[e]};return o&&(r.primary=o),t&&(r={...r,...t}),r}var mn=react.createContext(null);function $o({children:e,mode:t="auto",accentColor:o,theme:n,fontFamily:r,fonts:s,components:l}){let d=reactNative.useColorScheme(),a=react.useMemo(()=>t==="auto"?d==="dark"?"dark":"light":t,[t,d]),c=react.useMemo(()=>{let V=n?.[a];return Rr(a,V,o)},[a,n,o]),b=react.useMemo(()=>No(c,l,a),[c,l,a]),y=react.useMemo(()=>s?{regular:s.regular||r,medium:s.medium||r,semibold:s.semibold||r,bold:s.bold||r}:r?{regular:r,medium:r,semibold:r,bold:r}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[r,s]),v=react.useMemo(()=>({mode:a,colors:c,fonts:y,components:b,isDark:a==="dark"}),[a,c,y,b]);return jsxRuntime.jsx(mn.Provider,{value:v,children:e})}function O(){let e=react.useContext(mn);if(!e){let t=Ir.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:No(t,void 0,"dark"),isDark:true}}return e}var bi="https://api.unifold.io",Qo,Qe="pk_test_123",qo={};function Fe(){return typeof __DEV__<"u"&&__DEV__&&Qo?Qo:bi}function Go(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.'),Qe=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Qo=e.baseUrl),e.defaultConfig&&(qo=e.defaultConfig);}function hn(e){typeof __DEV__<"u"&&__DEV__?Qo=e:console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function rt(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 ze(e){let t=e.startsWith("/")?e:`/${e}`;return `${Fe()}/api/public${t}`}function G(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Fe()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Fe()}${e}`:`${Fe()}/api/public${e}`:""}async function Mt(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||qo.destinationChainId||"8453",destination_token_address:e?.destination_token_address||qo.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||qo.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||Qe;rt(n);let r=await fetch(`${Fe()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.statusText}`);return r.json()}function Ut(e,t){return e.find(o=>o.chain_type===t)}async function vo(e,t){let o=t||Qe;rt(o);let n=await fetch(`${Fe()}/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})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function vr(e,t){let o=t||Qe;rt(o);let n=await fetch(`${Fe()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!n.ok)throw new Error(`Failed to poll executions: ${n.statusText}`);return n.json()}function ce(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function Do(e,t){let o=e||Qe;rt(o);let n=`${Fe()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});n=`${n}?${s.toString()}`;}let r=await fetch(n,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch supported deposit tokens: ${r.statusText}`);return r.json()}async function Dr(e,t){let o=t||Qe;rt(o);let n=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),r=await fetch(`${Fe()}/v1/public/tokens/token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch token metadata: ${r.statusText}`);return r.json()}function Yo(e,t,o){return !e||e.length===0?o||"":e.find(r=>r.format===t)?.url||o||e[0]?.url||""}async function Lr(e,t){let o=t||Qe;rt(o);let n=await fetch(`${Fe()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch onramp quotes: ${n.statusText}`);return n.json()}async function Pr(e,t){let o=t||Qe;rt(o);let n=await fetch(`${Fe()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create onramp session: ${n.statusText}`);return n.json()}async function Vr(e,t){let o=t||Qe;rt(o);let n=new URLSearchParams;e.country_code&&n.append("country_code",e.country_code),e.subdivision_code&&n.append("subdivision_code",e.subdivision_code),n.append("token_address",e.token_address),n.append("chain_id",e.chain_id),n.append("chain_type",e.chain_type);let r=await fetch(`${Fe()}/v1/public/onramps/default_token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.statusText}`);return r.json()}async function Br(e){let t=e||Qe;rt(t);let o=await fetch(`${Fe()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function oo(e,t="png"){if(!e||e.length===0)return;let o=e.find(n=>n.format===t);return o?o.url:e[0]?.url}async function Lo(e){let t=e||Qe;rt(t);let o=await fetch(`${Fe()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function Po(){let e=await fetch(`${Fe()}/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 yn(e,t,o,n,r){let s=r||Qe;rt(s);let l=await fetch(`${Fe()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:o,token_address:n})});if(!l.ok)throw new Error(`Failed to fetch address balance: ${l.statusText}`);return l.json()}var{height:no}=reactNative.Dimensions.get("window");function ge({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:r=true,heightPercent:s,noPadding:l=false,borderTopLeftRadius:d=24,borderTopRightRadius:a=24}){let{colors:c}=O(),b=react.useRef(new reactNative.Animated.Value(no)).current,y=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(b.setValue(no),y.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(b,{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(b,{toValue:no,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,b,y]);let v=()=>{n&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Ht.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:v,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[Ht.backdrop,{backgroundColor:"#000000",opacity:y}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Ht.sheet,{backgroundColor:c.background,borderTopLeftRadius:d,borderTopRightRadius:a,transform:[{translateY:b}],...s&&{height:no*s,maxHeight:no*s},...l&&{paddingBottom:0}}],children:[r&&jsxRuntime.jsx(reactNative.View,{style:Ht.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Ht.handle,{backgroundColor:c.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[Ht.content,s&&Ht.contentFlex],children:o})]})]})})}var Ht=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:no*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function Fr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(_e.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Er({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oe({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(_e.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Me({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(_e.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function De({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(_e.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ar({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function io({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Dt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(_e.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function xn({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function so({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ao({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(_e__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(_e.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Je({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:r,badge:s,showBalance:l=false,balanceAddress:d,balanceChainType:a,balanceChainId:c,balanceTokenAddress:b,publishableKey:y,projectName:v}){let{colors:V,fonts:L,components:w}=O(),[h,m]=react.useState(null),[u,i]=react.useState(false),f=react.useState(()=>new reactNative.Animated.Value(0))[0];react.useEffect(()=>{if(!u)return;let T=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 T.start(),()=>T.stop()},[u,f]),react.useEffect(()=>{if(!l||!d||!a||!c||!b||!y){m(null),i(false);return}let T=false;return i(true),yn(d,a,c,b,y).then(A=>{if(T)return;let p=A.balance,$=null;p&&(p.amount_usd!=null&&p.amount_usd!==""?$=`$${p.amount_usd}`:$="$0.00"),m($);}).catch(()=>{T||m(null);}).finally(()=>{T||i(false);}),()=>{T=true;}},[l,d,a,c,b,y]);let S=f.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Ue.header,children:[jsxRuntime.jsx(reactNative.View,{style:Ue.leftContainer,children:t&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Ue.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Wr,{size:20,color:w.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ue.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Ue.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Ue.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ue.title,{color:w.header.titleColor,fontFamily:L.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Ue.titleBadge,{backgroundColor:V.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ue.titleBadgeText,{color:V.foregroundMuted,fontFamily:L.regular}],children:s.count})})]}),l&&(u?jsxRuntime.jsx(reactNative.Animated.View,{style:[Ue.balanceSkeleton,{backgroundColor:V.cardHover,opacity:S}]}):h!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Ue.balanceText,{color:V.foregroundMuted,fontFamily:L.regular}],children:[v?`${v} `:"","Balance: ",h]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Ue.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:r,style:[Ue.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Oe,{size:20,color:w.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ue.spacer})})]})}var Ue=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 Pt({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:r=0,borderColor:s="transparent",backgroundColor:l="transparent",style:d}){let{colors:a}=O(),[c,b]=react.useState(false),y=e?.toLowerCase().endsWith(".svg");react.useEffect(()=>{b(false);},[e]);let v=a.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:v},d]});let V={width:t,height:o,borderRadius:n,borderWidth:r,borderColor:s,backgroundColor:l,overflow:"hidden",alignItems:"center",justifyContent:"center",...d},L=t-r*2,w=o-r*2;return c?jsxRuntime.jsx(reactNative.View,{style:[V,{backgroundColor:l||v}]}):y?jsxRuntime.jsx(reactNative.View,{style:V,children:jsxRuntime.jsx(_e.SvgUri,{uri:e,width:L,height:w,onError:h=>{b(true);}})}):jsxRuntime.jsx(reactNative.View,{style:V,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:L,height:w},resizeMode:"contain",onError:h=>{b(true);}})})}function Bo({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:r,fonts:s,components:l}=O(),d=n?[...n].sort((a,c)=>a.position-c.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[wt.container,{backgroundColor:l.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:wt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:wt.iconContainer,children:jsxRuntime.jsx(Fr,{size:20,color:l.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:wt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wt.title,{color:l.card.titleColor,fontFamily:s.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[wt.subtitle,{color:l.card.subtitleColor,fontFamily:s.regular}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:wt.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:wt.networkIcons,children:d.map((a,c)=>{let b=a.icon_urls.find(y=>y.format==="png")?.url||a.icon_urls.find(y=>y.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[wt.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:d.length-c}],children:jsxRuntime.jsx(Pt,{uri:G(b),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:l.card.backgroundColor})},a.name)})})})]})}var wt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 Eo({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{fonts:r,components:s}=O();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Bt.container,{backgroundColor:s.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Bt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:Bt.iconContainer,children:jsxRuntime.jsx(Er,{size:20,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Bt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Bt.title,{color:s.card.titleColor,fontFamily:r.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Bt.subtitle,{color:s.card.subtitleColor,fontFamily:r.regular}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:Bt.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Bt.paymentIcons,children:n?.map(l=>{let d=l.icon_urls.find(a=>a.format==="png")?.url||l.icon_urls.find(a=>a.format==="svg")?.url;return jsxRuntime.jsx(Pt,{uri:G(d),width:32,height:20,borderRadius:4},l.name)})})})]})}var Bt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 Wo({onPress:e,title:t,subtitle:o,badge:n}){let{fonts:r,components:s}=O();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Ft.container,{backgroundColor:s.card.backgroundColor}],children:jsxRuntime.jsxs(reactNative.View,{style:Ft.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Ft.iconContainer,children:[jsxRuntime.jsx(jt,{size:20,color:s.card.iconColor,strokeWidth:2}),n!==void 0&&n>0&&jsxRuntime.jsx(reactNative.View,{style:[Ft.badge,{backgroundColor:s.card.iconColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ft.badgeText,{fontFamily:r.semibold}],children:n>99?"99+":n})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ft.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ft.title,{color:s.card.titleColor,fontFamily:r.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.subtitle,{color:s.card.subtitleColor,fontFamily:r.regular}],children:o})]})]})})}var Ft=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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"}});var Dn=1e4,Ln=2500,Pn=3e3,Vn=6e4;function Ao(e){let{depositConfirmationMode:t,depositAddress:o,chain:n,externalUserId:r,publishableKey:s,modalOpenedAt:l,depositWalletId:d,depositExecutions:a,trackedExecutions:c,setDepositExecutions:b,setTrackedExecutions:y,setLatestExecution:v,setShowStatusSheet:V,onDepositSuccess:L,onExecutionsChange:w,onDepositError:h}=e,[m,u]=react.useState(false),[i,f]=react.useState(false);return react.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!o)return;u(false),t==="auto_ui"&&f(false);let T=setTimeout(()=>{u(true),t==="auto_ui"&&f(true);},Dn);return ()=>clearTimeout(T)},[t,o,n]),react.useEffect(()=>{if(!r||!l)return;let T=new Date(l.getTime()-Vn),A=setInterval(async()=>{try{let se=[...(await vo(r,s)).data??[]].sort((M,z)=>{let te=M.created_at?new Date(M.created_at).getTime():0;return (z.created_at?new Date(z.created_at).getTime():0)-te}),ee=null;for(let M of se){let z=M.created_at?new Date(M.created_at):null;if(!z||z<=T)continue;let te=c.get(M.id);if(!te){ee=M;break}if(["pending","waiting","delayed"].includes(te)&&M.status==="succeeded"){ee=M;break}}if(ee){let M=ee;b(z=>{let te=z.findIndex(X=>X.id===M.id);if(te>=0){let X=[...z];return X[te]=M,X}return [...z,M]}),y(z=>{let te=new Map(z);return te.set(M.id,M.status),te}),v(M),V(!0),M.status==="succeeded"&&L?.({message:"Deposit completed successfully",executionId:M.id}),w?.([...a,M]);}}catch(p){h?.({message:"Failed to check deposit status",error:p});}},Ln);return ()=>clearInterval(A)},[r,s,l,c,a,w,L,h]),react.useEffect(()=>{if(!m||!d)return;let T=async()=>{try{await vr(d,s);}catch{}};T();let A=setInterval(T,Pn);return ()=>clearInterval(A)},[m,d,s]),{pollingEnabled:m,showWaitingUi:i,handleIveDeposited:()=>{u(true),f(true);}}}function go({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:r}){let{colors:s,isDark:l}=O(),d=l?"#1a1a1a":"#ffffff",a=l?"#ffffff":"#000000",c=r||d;return jsxRuntime.jsxs(reactNative.View,{style:[Fn.container,{width:t,height:t}],children:[jsxRuntime.jsx(Ai__default.default,{value:e||"placeholder",size:t,backgroundColor:d,color:a,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[Fn.logoContainer,{width:n+12,height:n+12,backgroundColor:c,borderRadius:(n+12)/2}],children:jsxRuntime.jsx(Pt,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var Fn=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Gi({size:e,strokeWidth:t,iconSize:o,children:n}){let r=react.useRef(new reactNative.Animated.Value(0)).current,s=(e-t)/2,l=2*Math.PI*s,d=e/2,a=(e-o)/2;react.useEffect(()=>{let b=reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return b.start(),()=>b.stop()},[r]);let c=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:{width:e,height:e},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:c}]},children:jsxRuntime.jsxs(_e__default.default,{width:e,height:e,children:[jsxRuntime.jsx(_e.Defs,{children:jsxRuntime.jsxs(_e.LinearGradient,{id:"progressGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(_e.Stop,{offset:"0%",stopColor:"#F59E0B"}),jsxRuntime.jsx(_e.Stop,{offset:"100%",stopColor:"#FBBF24"})]})}),jsxRuntime.jsx(_e.Circle,{cx:d,cy:d,r:s,stroke:"url(#progressGradient)",strokeWidth:t,fill:"none",strokeDasharray:`${l*.75} ${l*.25}`,strokeLinecap:"round",rotation:-90,origin:`${d}, ${d}`})]})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:a+1.5,left:a,width:o,height:o},children:n})]})}function zn(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function Yi(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),r=e.getFullYear(),s=e.getHours(),l=e.getMinutes(),d=s>=12?"pm":"am";s=s%12,s=s||12;let a=l<10?`0${l}`:l;return `${o} ${n}, ${r} at ${s}:${a}${d}`}function fo({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:r,date:s,amountUsd:l,onClose:d,borderTopLeftRadius:a,borderTopRightRadius:c}){let{colors:b,fonts:y,components:v}=O(),[V,L]=react.useState(false),w=t==="pending"||t==="waiting"||t==="delayed",h=t==="succeeded",m=()=>{n&&reactNative.Linking.openURL(n);},u=()=>{r&&reactNative.Linking.openURL(r);};return jsxRuntime.jsx(ge,{visible:e,onClose:d,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:a,borderTopRightRadius:c,children:jsxRuntime.jsxs(reactNative.View,{style:fe.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:fe.closeButton,onPress:d,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Oe,{size:20,color:v.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:fe.iconContainer,children:w?jsxRuntime.jsx(Gi,{size:80,strokeWidth:4,iconSize:68,children:o?jsxRuntime.jsx(reactNative.Image,{source:{uri:G(o)},style:fe.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[fe.tokenIconFill,{backgroundColor:b.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:G(o)},style:fe.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[fe.tokenIconLarge,{backgroundColor:b.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[fe.statusBadge,{backgroundColor:v.container.iconBackgroundColor}],children:jsxRuntime.jsx(De,{size:16,color:v.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[fe.title,{color:v.container.titleColor,fontFamily:y.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),l!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[fe.amount,{color:v.container.titleColor,fontFamily:y.bold}],children:["$",l.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[fe.date,{color:v.container.subtitleColor,fontFamily:y.regular}],children:Yi(s)}),jsxRuntime.jsx(reactNative.Text,{style:[fe.subtitle,{color:v.container.subtitleColor,fontFamily:y.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),h&&(n||r)&&jsxRuntime.jsxs(reactNative.View,{style:fe.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[fe.divider,{backgroundColor:b.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:fe.detailsToggle,onPress:()=>L(!V),children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.detailsToggleText,{color:v.container.actionTitle,fontFamily:y.medium}],children:V?"See less":"See more details"}),V?jsxRuntime.jsx(Dt,{size:18,color:v.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Me,{size:18,color:v.container.actionColor,strokeWidth:2})]}),V&&jsxRuntime.jsxs(reactNative.View,{style:fe.txButtonsContainer,children:[n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[fe.txButton,{backgroundColor:v.card.backgroundColor,borderColor:b.border}],onPress:m,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.txLabel,{color:v.card.titleColor,fontFamily:y.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.txHash,{color:v.card.subtitleColor,fontFamily:y.regular}],children:zn(n)}),jsxRuntime.jsx(Nt,{size:16,color:v.card.actionColor,strokeWidth:2})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[fe.txButton,{backgroundColor:v.card.backgroundColor,borderColor:b.border}],onPress:u,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.txLabel,{color:v.card.titleColor,fontFamily:y.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.txHash,{color:v.card.subtitleColor,fontFamily:y.regular}],children:zn(r)}),jsxRuntime.jsx(Nt,{size:16,color:v.card.actionColor,strokeWidth:2})]})]})]})]})})}var fe=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 ir({depositConfirmationMode:e,depositAddress:t,showWaitingUi:o,latestExecution:n,onIveDeposited:r}){let{colors:s,fonts:l,components:d}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!o&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:r,activeOpacity:.8,style:[qt.iveDepositedButton,{backgroundColor:s.primary}],children:jsxRuntime.jsx(reactNative.Text,{style:[qt.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:l.semibold}],children:"I've made the deposit"})}),o&&!n&&jsxRuntime.jsxs(reactNative.View,{style:[qt.processingCard,{backgroundColor:d.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.View,{style:[qt.detailIcon,{backgroundColor:d.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ar,{size:14,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qt.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[qt.processingCardTitle,{color:d.card.titleColor,fontFamily:l.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[qt.processingCardSubtitle,{color:d.card.subtitleColor,fontFamily:l.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var qt=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,borderRadius:12,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,borderRadius:8,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"}});var zo=(e,t)=>`${t}:${e}`,ns=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function ar({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:s,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:a,defaultTokenAddress:c,depositConfirmationMode:b="auto_ui",onExecutionsChange:y,onDepositSuccess:v,onDepositError:V,borderTopLeftRadius:L,borderTopRightRadius:w,sheetBorderRadius:h}){let{colors:m,fonts:u,components:i}=O(),f=d&&a?`${d}:${a}`:"solana:mainnet",[S,T]=react.useState("USDC"),[A,p]=react.useState(f),[$,se]=react.useState([]),[ee,M]=react.useState(true),[z,te]=react.useState([]),[X,Ce]=react.useState(true),[Ze,Ne]=react.useState(false),[Y,Pe]=react.useState(false),[et,Ve]=react.useState(false),[$e,We]=react.useState(false),[qe,at]=react.useState([]),[ht,tt]=react.useState(new Map),[bo]=react.useState(()=>new Date),[Wt,He]=react.useState(null),[ko,At]=react.useState(false),[le,Ae]=react.useState(null),[wo,ot]=react.useState(false),yt=new Map;z.forEach(_=>{_.chains.forEach(B=>{let N=`${B.chain_type}:${B.chain_id}`;yt.has(N)||yt.set(N,B);});});let Ct=Array.from(yt.values()),zt=ns(A),To=Ct.find(_=>_.chain_type===zt.chainType&&_.chain_id===zt.chainId)?.chain_type||"ethereum",Rt=Ut($,To),we=Rt?.address||"",Ie=react.useRef(false);react.useEffect(()=>{async function _(){try{Ce(!0),He(null);let N=await Do(t,s&&r&&n?{destination_token_address:s,destination_chain_id:r,destination_chain_type:n}:void 0);if(te(N.data),N.data.length>0&&!Ie.current){Ie.current=!0;let U,ke;if(d&&a)if(c)for(let ue of N.data){let ct=ue.chains.find(dt=>dt.chain_type===d&&dt.chain_id===a&&dt.token_address.toLowerCase()===c.toLowerCase());if(ct){U=ue,ke=ct;break}}else for(let ue of N.data){let ct=ue.chains.find(dt=>dt.chain_type===d&&dt.chain_id===a);if(ct){U=ue,ke=ct;break}}if(!U&&s)for(let ue of N.data){let ct=ue.chains.find(dt=>dt.token_address.toLowerCase()===s.toLowerCase());if(ct){U=ue,ke=ct;break}}U||(U=N.data.find(ue=>ue.symbol==="USDC"),U&&U.chains.length>0&&(ke=U.chains[0])),U||(U=N.data.find(ue=>ue.symbol==="USDT"),U&&U.chains.length>0&&(ke=U.chains[0])),U||(U=N.data[0],U.chains.length>0&&(ke=U.chains[0])),U&&T(U.symbol),ke&&p(zo(ke.chain_id,ke.chain_type));}}catch(B){console.error("Error fetching supported tokens:",B),He("Failed to load supported tokens"),V?.({message:"Failed to load supported tokens",error:B});}finally{Ce(false);}}_();},[t,V,d,a,c,s,r,n]),react.useEffect(()=>{async function _(){try{M(!0),He(null);let B=await Mt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:s},t);se(B.data);}catch(B){console.error("Error fetching wallets:",B),He("Failed to load wallets"),V?.({message:"Failed to load wallets",error:B});}finally{M(false);}}_();},[e,o,n,r,s,t,V]);let xo=Rt?.id??"",{showWaitingUi:Xt,handleIveDeposited:Zt}=Ao({depositConfirmationMode:b,depositAddress:we,chain:A,externalUserId:e,publishableKey:t,modalOpenedAt:bo,depositWalletId:xo,depositExecutions:qe,trackedExecutions:ht,setDepositExecutions:at,setTrackedExecutions:tt,setLatestExecution:Ae,setShowStatusSheet:At,onDepositSuccess:v,onExecutionsChange:y,onDepositError:V});react.useEffect(()=>{if(!z.length)return;let _=z.find(N=>N.symbol===S);if(!_||_.chains.length===0)return;if(!_.chains.some(N=>zo(N.chain_id,N.chain_type)===A)){let N=_.chains[0];p(zo(N.chain_id,N.chain_type));}},[S,z,A]);let Re=z.find(_=>_.symbol===S),So=Re?.chains||[],ve=So.find(_=>zo(_.chain_id,_.chain_type)===A),eo=async()=>{if(we)try{reactNative.Clipboard.setString(we),Ne(!0),setTimeout(()=>Ne(!1),2e3);}catch(_){console.error("Failed to copy:",_);}},Ot=ve?.estimated_price_impact_percent??0,lt=ve?.max_slippage_percent??.25,_o=ve?.minimum_deposit_amount_usd??3;if(X)return jsxRuntime.jsxs(reactNative.View,{style:g.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[g.loadingText,{color:m.foregroundMuted,fontFamily:u.regular}],children:"Loading currencies..."})]});if(Wt&&z.length===0)return jsxRuntime.jsxs(reactNative.View,{style:g.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.errorText,{color:m.error,fontFamily:u.regular}],children:Wt}),jsxRuntime.jsx(reactNative.Text,{style:[g.errorHint,{color:m.foregroundMuted,fontFamily:u.regular}],children:"Please check your network connection and try again."})]});let Z=()=>jsxRuntime.jsxs(ge,{visible:et,onClose:()=>Ve(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:h?.tokenSelector?.borderTopLeftRadius??L,borderTopRightRadius:h?.tokenSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[g.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:g.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[g.sheetTitle,{color:i.header.titleColor,fontFamily:u.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ve(false),style:g.sheetCloseButton,children:jsxRuntime.jsx(Oe,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:g.sheetList,showsVerticalScrollIndicator:false,children:z.map(_=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{T(_.symbol),Ve(false);},style:[g.sheetItem,{backgroundColor:S===_.symbol?i.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(_,"png"))},style:g.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:g.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.sheetItemTitle,{color:i.card.titleColor,fontFamily:u.medium}],children:_.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[g.sheetItemSubtitle,{color:i.card.subtitleColor,fontFamily:u.regular}],children:[_.chains.length," network",_.chains.length!==1?"s":""," available"]})]}),S===_.symbol&&jsxRuntime.jsx(De,{size:20,color:m.primary,strokeWidth:2})]},_.symbol))})]}),be=()=>jsxRuntime.jsxs(ge,{visible:$e,onClose:()=>We(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:h?.chainSelector?.borderTopLeftRadius??L,borderTopRightRadius:h?.chainSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[g.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:g.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[g.sheetTitle,{color:i.header.titleColor,fontFamily:u.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>We(false),style:g.sheetCloseButton,children:jsxRuntime.jsx(Oe,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:g.sheetList,showsVerticalScrollIndicator:false,children:So.map(_=>{let B=zo(_.chain_id,_.chain_type),N=A===B;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{p(B),We(false);},style:[g.sheetItem,{backgroundColor:N?i.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(_,"png"))},style:g.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:g.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.sheetItemTitle,{color:i.card.titleColor,fontFamily:u.medium}],children:_.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[g.sheetItemSubtitle,{color:i.card.subtitleColor,fontFamily:u.regular}],children:["Min deposit: $",_.minimum_deposit_amount_usd]})]}),N&&jsxRuntime.jsx(De,{size:20,color:m.primary,strokeWidth:2})]},B)})})]});return jsxRuntime.jsxs(reactNative.View,{style:g.container,children:[jsxRuntime.jsxs(reactNative.View,{style:g.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.selectorLabel,{color:i.card.labelColor,fontFamily:u.regular}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Ve(true),style:[g.selector,{backgroundColor:i.card.backgroundColor}],children:[Re&&jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(Re,"png"))},style:g.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[g.selectorText,{color:i.card.titleColor,fontFamily:u.medium}],children:S}),jsxRuntime.jsx(Me,{size:16,color:i.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:g.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[g.selectorLabel,{color:i.card.labelColor,fontFamily:u.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[g.minDeposit,{fontFamily:u.regular}],children:["($",_o," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>We(true),style:[g.selector,{backgroundColor:i.card.backgroundColor}],children:[ve&&jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(ve,"png"))},style:g.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[g.selectorText,{color:i.card.titleColor,fontFamily:u.medium}],numberOfLines:1,children:ve?.chain_name||"Select network"}),jsxRuntime.jsx(Me,{size:16,color:i.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:g.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[g.qrWrapper,{backgroundColor:m.background,borderColor:m.border}],children:ee?jsxRuntime.jsxs(reactNative.View,{style:g.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[g.loadingText,{color:m.foregroundMuted,fontFamily:u.regular}],children:"Loading..."})]}):we?jsxRuntime.jsx(go,{value:we,size:160,logoUri:G(ce(ve,"png")||ze("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:g.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[g.errorText,{color:m.error,fontFamily:u.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:g.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:g.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.addressLabel,{color:i.card.labelColor,fontFamily:u.medium}],children:"Deposit Address"}),Ze&&jsxRuntime.jsxs(reactNative.View,{style:g.copiedIndicator,children:[jsxRuntime.jsx(De,{size:14,color:m.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[g.copiedText,{color:m.success,fontFamily:u.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:eo,disabled:!we||ee,activeOpacity:.7,style:[g.addressBox,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[g.addressText,{color:i.card.titleColor,fontFamily:u.regular}],numberOfLines:2,children:ee?"Loading...":we||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:g.addressCopyIcon,children:jsxRuntime.jsx(Vo,{size:16,color:i.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsx(ir,{depositConfirmationMode:b,depositAddress:we,showWaitingUi:Xt,latestExecution:le,onIveDeposited:Zt}),jsxRuntime.jsxs(reactNative.View,{style:[g.detailsCard,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Pe(!Y),style:g.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:g.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[g.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(jt,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[g.detailsLabel,{color:i.card.titleColor,fontFamily:u.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:g.chevronContainer,children:Y?jsxRuntime.jsx(Dt,{size:16,color:i.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Me,{size:16,color:i.card.actionColor,strokeWidth:2})})]}),Y&&jsxRuntime.jsxs(reactNative.View,{style:g.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:g.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[g.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(io,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[g.detailsLabel,{color:i.card.titleColor,fontFamily:u.regular}],children:["Price impact: ",Ot.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ot(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(so,{size:14,color:i.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:g.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[g.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(ao,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[g.detailsLabel,{color:i.card.titleColor,fontFamily:u.regular}],children:["Slippage: Auto \u2022 ",lt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ot(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(so,{size:14,color:i.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:g.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[g.detailIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ko,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[g.detailsLabel,{color:i.card.titleColor,fontFamily:u.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:g.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[g.termsText,{color:m.primary,fontFamily:u.regular}],children:"Terms apply"})}),Z(),be(),jsxRuntime.jsxs(ge,{visible:wo,onClose:()=>ot(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:h?.infoSheet?.borderTopLeftRadius??L,borderTopRightRadius:h?.infoSheet?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[g.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:g.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[g.sheetTitle,{color:i.header.titleColor,fontFamily:u.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ot(false),style:g.sheetCloseButton,children:jsxRuntime.jsx(Oe,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:g.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[g.infoCard,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:g.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[g.infoCardIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(io,{size:16,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[g.infoCardTitle,{color:i.card.titleColor,fontFamily:u.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[g.infoCardValue,{color:i.card.titleColor,fontFamily:u.medium}],children:[Ot.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[g.infoCardDescription,{color:i.card.descriptionColor,fontFamily:u.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[g.infoCard,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:g.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[g.infoCardIcon,{backgroundColor:i.card.iconBackgroundColor}],children:jsxRuntime.jsx(ao,{size:16,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[g.infoCardTitle,{color:i.card.titleColor,fontFamily:u.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[g.infoCardValue,{color:i.card.titleColor,fontFamily:u.medium}],children:[lt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[g.infoCardDescription,{color:i.card.descriptionColor,fontFamily:u.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),le&&jsxRuntime.jsx(fo,{visible:ko,status:le.status,tokenIconUrl:le.destination_token_metadata?.icon_urls?.find(_=>_.format==="png")?.url||le.destination_token_metadata?.icon_url||ce(Re,"png"),explorerUrl:le.explorer_url,completionExplorerUrl:le.destination_explorer_url,date:le.created_at?new Date(le.created_at):void 0,amountUsd:le.source_amount_usd?parseFloat(le.source_amount_usd):void 0,onClose:()=>At(false),borderTopLeftRadius:h?.depositStatus?.borderTopLeftRadius??L,borderTopRightRadius:h?.depositStatus?.borderTopRightRadius??w})]})}var g=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,borderRadius:16,borderWidth:1},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,borderRadius:8},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 lr({currency:e,isSelected:t,onSelect:o}){let{colors:n,fonts:r,components:s}=O();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Qt.container,{backgroundColor:s.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Qt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qt.iconContainer,{backgroundColor:n.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(e,"png"))},style:Qt.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Qt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qt.name,{color:s.card.titleColor,fontFamily:r.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Qt.code,{color:s.card.subtitleColor,fontFamily:r.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(De,{size:16,color:n.primary,strokeWidth:2})]})}var Qt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 Mo({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{fonts:r,components:s}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:jn.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[jn.title,{color:s.list.titleSectionColor,fontFamily:r.medium}],children:e})}),t.map(l=>jsxRuntime.jsx(lr,{currency:l,isSelected:o.toLowerCase()===l.currency_code.toLowerCase(),onSelect:n},l.currency_code))]})}var jn=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function dr({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:r,onSelectCurrency:s,borderTopLeftRadius:l,borderTopRightRadius:d}){let{colors:a,fonts:c,components:b}=O(),[y,v]=react.useState(""),V=n.map(f=>o.find(S=>S.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),L=o.filter(f=>!n.includes(f.currency_code.toLowerCase())),w=f=>{if(!y)return f;let S=y.toLowerCase();return f.filter(T=>T.name.toLowerCase().includes(S)||T.currency_code.toLowerCase().includes(S))},h=w(V),m=w(L),u=f=>{s(f),t(false),v("");},i=()=>{t(false),v("");};return jsxRuntime.jsxs(ge,{visible:e,onClose:i,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsx(Je,{title:"Currency",showBack:false,onClose:i}),jsxRuntime.jsx(reactNative.View,{style:Gt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Gt.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:c.regular}],value:y,onChangeText:v,placeholder:"Search",placeholderTextColor:b.search.placeholderColor})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Gt.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:Gt.listContent,children:[jsxRuntime.jsx(Mo,{title:"Popular currencies",currencies:h,selectedCurrency:r,onSelect:u}),h.length>0&&m.length>0&&jsxRuntime.jsx(reactNative.View,{style:Gt.sectionSpacer}),jsxRuntime.jsx(Mo,{title:"All currencies",currencies:m,selectedCurrency:r,onSelect:u}),h.length===0&&m.length===0&&jsxRuntime.jsx(reactNative.View,{style:Gt.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Gt.noResultsText,{color:b.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Gt=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function en(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 ur({externalUserId:e,publishableKey:t,view:o,onViewChange:n,destinationTokenSymbol:r,recipientAddress:s,destinationChainType:l,destinationChainId:d,destinationTokenAddress:a,onDepositSuccess:c,onDepositError:b,borderTopLeftRadius:y,borderTopRightRadius:v,sheetBorderRadius:V}){let{colors:L,fonts:w,components:h}=O(),[m,u]=react.useState(""),[i,f]=react.useState("usd"),[S,T]=react.useState(false),[A,p]=react.useState(false),[$,se]=react.useState([]),[ee,M]=react.useState(false),[z,te]=react.useState(null),[X,Ce]=react.useState(null),[Ze,Ne]=react.useState("amount"),[Y,Pe]=react.useState(null),[et,Ve]=react.useState(true),[$e,We]=react.useState(null),[qe,at]=react.useState(false),ht=react.useRef(null),tt=react.useRef(false);react.useEffect(()=>{ht.current=Y;},[Y]),react.useEffect(()=>{tt.current=qe;},[qe]);let[bo,Wt]=react.useState([]),[He,ko]=react.useState(true),[At,le]=react.useState(60),[Ae,wo]=react.useState([]),[ot,yt]=react.useState([]),[Ct,zt]=react.useState(null),[Be,To]=react.useState(null),[Rt,we]=react.useState(true),[Ie,xo]=react.useState(null),[Xt,Zt]=react.useState(false),[Re,So]=react.useState(null),[ve,eo]=react.useState(false),[Ot,lt]=react.useState(false),[_o,Z]=react.useState(false),[be,_]=react.useState(null),B=o??Ze,N=react.useRef(null),U=Ae.find(I=>I.currency_code.toLowerCase()===i.toLowerCase()),ke=react.useCallback(I=>{Ne(I),I==="quotes"?n?.(I,$.length):n?.(I);},[$.length,n]);react.useEffect(()=>{async function I(){try{let E=await Po();To(E);}catch(E){console.error("Error fetching user IP:",E);}finally{we(false);}}I();},[]),react.useEffect(()=>{async function I(){try{let E=await Mt({external_user_id:e,recipient_address:s,destination_chain_type:l,destination_chain_id:d,destination_token_address:a},t);Wt(E.data);}catch(E){console.error("Error fetching wallets:",E),te("Failed to load wallet addresses");}finally{ko(false);}}I();},[e,s,l,d,a,t]);let ue=r||Ct?.symbol.toUpperCase()||"USDC",ct=oo(Ct?.icon_urls,"png")||Ct?.icon_url,dt=oo(Ct?.chain_icon_urls,"png")||Ct?.chain_icon_url;react.useEffect(()=>{async function I(){try{let E=await Br(t);wo(E.data),yt(E.preferred||[]);}catch(E){console.error("Error fetching fiat currencies:",E);}}I();},[t]),react.useEffect(()=>{if(S||Ae.length===0||!Be?.alpha2)return;let I=Be.alpha2.toUpperCase(),E=Ae.find(pe=>pe.country_codes.includes(I));if(E)f(E.currency_code.toLowerCase()),!m&&!A&&u(E.default_amount.toString());else if(!m&&!A){let pe=Ae.find(ut=>ut.currency_code.toLowerCase()==="usd");pe&&u(pe.default_amount.toString());}},[Ae,Be,S,m,A]),react.useEffect(()=>{if(Ae.length!==0){if(N.current!==null&&N.current!==i){let I=Ae.find(E=>E.currency_code.toLowerCase()===i.toLowerCase());I&&u(I.default_amount.toString());}N.current=i;}},[i,Ae]),react.useEffect(()=>{async function I(){try{let E=await Dr({chain_type:l||"",chain_id:d||"",token_address:a||""},t);zt(E);}catch(E){console.error("Error fetching supported tokens:",E);}}I();},[l,d,a,t]),react.useEffect(()=>{async function I(){if(!(!a||!d||!l)&&!Rt){Zt(true);try{let E=await Vr({country_code:Be?.alpha2?.toUpperCase()||"US",subdivision_code:Be?.state||void 0,token_address:a,chain_id:d,chain_type:l},t);xo(E);}catch(E){console.error("Error fetching default onramp token:",E);}finally{Zt(false);}}}I();},[a,d,l,Be,Rt,t]),react.useEffect(()=>{let I=parseFloat(m);if(isNaN(I)||I<=0){se([]),Ce(null);return}if(!Ie||Xt){se([]),Pe(null);return}let E=Ae.find(ut=>ut.currency_code.toLowerCase()===i.toLowerCase());if(E){if(I<E.minimum_amount){se([]),Pe(null),Ce(`Minimum amount is ${en(i)}${E.minimum_amount.toLocaleString()}`);return}if(I>E.maximum_amount){se([]),Pe(null),Ce(`Maximum amount is ${en(i)}${E.maximum_amount.toLocaleString()}`);return}}Ce(null);let pe=setTimeout(()=>{gn(I);},500);return ()=>clearTimeout(pe)},[m,i,t,Ie,Xt,Ae]);let gn=async I=>{if(!Ie){te("Loading token information...");return}M(true),te(null);try{let E={country_code:Be?.alpha2?.toUpperCase()||"US",source_amount:I.toString(),source_currency:i.toLowerCase(),destination_currency:Ie.destination_currency,destination_network:Ie.destination_network,subdivision_code:Be?.state||void 0},pe=await Lr(E,t);se(pe.data);let ut=tt.current,fn=ht.current;if(ut&&fn){let to=pe.data.find(bt=>bt.service_provider===fn.service_provider);if(to){if(Pe(to),pe.data.length>0){let bt=pe.data.reduce((vt,Io)=>Io.destination_amount>vt.destination_amount?Io:vt);$e||We(bt.service_provider),Ve(to.service_provider===$e);}}else if(pe.data.length>0){let bt=pe.data.reduce((vt,Io)=>Io.destination_amount>vt.destination_amount?Io:vt);Pe(bt),We(bt.service_provider),Ve(!0),at(!1);}}else if(pe.data.length>0){let to=pe.data.reduce((bt,vt)=>vt.destination_amount>bt.destination_amount?vt:bt);Pe(to),We(to.service_provider),Ve(!0);}le(60);}catch(E){console.error("Failed to fetch quotes:",E),te("Failed to fetch quotes. Please try again."),se([]);}finally{M(false);}};react.useEffect(()=>{if($.length===0)return;let I=setInterval(()=>{le(E=>{if(E<=1){let pe=parseFloat(m);return !isNaN(pe)&&pe>0&&gn(pe),60}return E-1});},1e3);return ()=>clearInterval(I)},[$.length,m]);let di=I=>{(/^\d*\.?\d{0,2}$/.test(I)||I==="")&&(u(I),p(true));},ui=I=>{u(I.toString()),p(true);},pi=async()=>{if(Y&&Ie)try{let I=Ie.destination_token_metadata.chain_type,E=Ut(bo,I);if(!E?.address){te("Wallet address not available");return}let pe={service_provider:Y.service_provider,country_code:Y.country_code?.toUpperCase()||Be?.alpha2?.toUpperCase()||"US",source_currency:Y.source_currency,source_amount:m,destination_currency:Y.destination_currency,destination_network:Y.destination_network,wallet_address:E.address,subdivision_code:Be?.state||void 0},ut=await Pr(pe,t);So({provider:Y,sourceCurrency:i,sourceAmount:m,sessionUrl:ut.url}),_(ut.url),Z(!0);}catch(I){console.error("Failed to create session:",I),te("Failed to start payment flow"),b?.({message:"Failed to start payment flow",error:I});}},Sr=en(i),gi=()=>{Z(false),ke("onramp"),c?.({message:"Payment flow completed"});},fi=()=>jsxRuntime.jsx(bs,{visible:_o,onClose:gi,url:be,providerName:Y?.service_provider_display_name||"Complete Payment",colors:L,fonts:w,borderTopLeftRadius:V?.webView?.borderTopLeftRadius??y,borderTopRightRadius:V?.webView?.borderTopRightRadius??v});return B==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:x.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:x.scrollContainer,contentContainerStyle:x.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:x.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>eo(true),style:[x.currencyButton,{backgroundColor:h.card.backgroundColor}],children:[U&&jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(U,"png"))},style:x.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[x.currencyText,{color:h.card.titleColor,fontFamily:w.medium}],children:i.toUpperCase()}),jsxRuntime.jsx(Me,{size:16,color:h.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(dr,{open:ve,onOpenChange:eo,currencies:Ae,preferredCurrencyCodes:ot,selectedCurrency:i,onSelectCurrency:I=>{f(I.toLowerCase()),T(true);},borderTopLeftRadius:V?.currencyModal?.borderTopLeftRadius??y,borderTopRightRadius:V?.currencyModal?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:x.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:x.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[x.currencySymbol,{color:h.container.titleColor,fontFamily:w.medium}],children:Sr}),jsxRuntime.jsx(reactNative.TextInput,{style:[x.amountInput,{color:h.container.titleColor,fontFamily:w.medium}],value:m,onChangeText:di,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:L.foregroundMuted})]})}),U?.suggested_amounts&&U.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:x.quickAmounts,children:U.suggested_amounts.map(I=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ui(I),style:[x.quickAmountButton,{backgroundColor:h.card.backgroundColor},parseFloat(m)===I&&{borderColor:L.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[x.quickAmountText,{color:h.card.titleColor,fontFamily:w.medium}],children:[Sr,I.toLocaleString()]})},I))}),X&&jsxRuntime.jsx(reactNative.Text,{style:[x.validationError,{color:L.error,fontFamily:w.regular}],children:X}),jsxRuntime.jsxs(reactNative.View,{style:x.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:x.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[x.providerLabel,{color:h.card.labelColor,fontFamily:w.medium}],children:"Provider"}),$.length>0&&!ee&&jsxRuntime.jsxs(reactNative.Text,{style:[x.refreshText,{color:h.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",At,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>lt(true),disabled:ee||$.length===0,style:[x.providerButton,{backgroundColor:h.card.backgroundColor},(ee||$.length===0)&&x.disabled],children:ee?jsxRuntime.jsxs(reactNative.View,{style:x.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:h.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[x.loadingText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):Y?jsxRuntime.jsxs(reactNative.View,{style:x.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:x.providerInfo,children:[et&&jsxRuntime.jsx(reactNative.Text,{style:[x.autoPickedText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:x.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(Yo(Y.icon_urls,"png",Y.icon_url))},style:x.providerIconImage},`provider-${Y.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[x.providerName,{color:h.card.titleColor,fontFamily:w.medium}],children:Y.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[x.bestPriceText,{color:L.success,fontFamily:w.regular}],children:["Best price \u2022 ",Y.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(kt,{size:20,color:h.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[x.noProviderText,{color:h.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(m)>0?"No providers available":"Enter an amount to see providers"})}),z&&jsxRuntime.jsx(reactNative.Text,{style:[x.errorText,{color:L.error,fontFamily:w.regular}],children:z})]}),jsxRuntime.jsxs(ge,{visible:Ot,onClose:()=>lt(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:V?.providerModal?.borderTopLeftRadius??y,borderTopRightRadius:V?.providerModal?.borderTopRightRadius??v,children:[jsxRuntime.jsx(Je,{title:"Select Provider",showBack:false,onClose:()=>lt(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:x.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:x.quotesList,children:[...$].sort((I,E)=>E.destination_amount-I.destination_amount).map((I,E)=>{let pe=Y?.service_provider===I.service_provider,ut=E===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{Pe(I),at(true),Ve(I.service_provider===$e),lt(false);},style:[x.quoteItem,{backgroundColor:h.card.backgroundColor},pe&&{borderColor:L.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:x.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(Yo(I.icon_urls,"png",I.icon_url))},style:x.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[x.quoteName,{color:h.card.titleColor,fontFamily:w.medium}],children:I.service_provider_display_name}),ut&&jsxRuntime.jsx(reactNative.Text,{style:[x.bestPriceLabel,{color:L.success,fontFamily:w.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:x.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[x.quoteAmount,{color:h.card.textRightColor,fontFamily:w.medium}],children:[I.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[x.quoteSource,{color:h.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",Sr,I.total_fee.toFixed(2)]})]})]},I.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[x.continueButtonContainer,{backgroundColor:L.background}],children:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:pi,disabled:ee||He||!Y||parseFloat(m)<=0,style:[x.continueButton,{backgroundColor:h.container.buttonColor},(ee||He||!Y)&&x.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:[x.continueButtonText,{color:h.container.buttonTitleColor,fontFamily:w.medium}],children:He?"Loading...":"Continue"})})})]}),fi()]}):B==="onramp"&&Re?jsxRuntime.jsxs(reactNative.View,{style:x.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(Yo(Re.provider.icon_urls,"png",Re.provider.icon_url))},style:x.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[x.onrampTitle,{color:h.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",Re.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[x.onrampSubtitle,{color:h.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[x.flowDiagram,{backgroundColor:h.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:x.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ze(`/icons/currencies/png/${Re.sourceCurrency.toLowerCase()}.png`)},style:x.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[x.flowLabel,{color:h.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[x.flowValue,{color:h.card.titleColor,fontFamily:w.medium}],children:Re.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(kt,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:x.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:x.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oo(Ie?.destination_token_metadata?.icon_urls,"png")||Ie?.destination_token_metadata?.icon_url||ze("/icons/tokens/png/usdc.png")},style:x.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oo(Ie?.destination_token_metadata?.chain?.icon_urls,"png")||Ie?.destination_token_metadata?.chain?.icon_url||ze("/icons/networks/png/polygon.png")},style:[x.flowNetworkBadge,{borderColor:L.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[x.flowLabel,{color:h.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[x.flowValue,{color:h.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsxRuntime.jsx(kt,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:x.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:x.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ct||ze("/icons/tokens/png/usdc.png")},style:x.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:dt||ze("/icons/networks/png/polygon.png")},style:[x.flowNetworkBadge,{borderColor:L.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[x.flowLabel,{color:h.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[x.flowValue,{color:h.card.titleColor,fontFamily:w.medium}],children:ue})]})]}),jsxRuntime.jsx(reactNative.View,{style:[x.onrampInfoBox,{backgroundColor:h.card.backgroundColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[x.onrampInfoText,{color:h.card.descriptionColor,fontFamily:w.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function bs({visible:e,onClose:t,url:o,providerName:n,colors:r,fonts:s,borderTopLeftRadius:l,borderTopRightRadius:d}){return jsxRuntime.jsxs(ge,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:Yt.header,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:Yt.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(De,{size:20,color:r.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.headerTitle,{color:r.foreground,fontFamily:s.medium}],children:n}),jsxRuntime.jsx(reactNative.View,{style:Yt.headerSpacer})]}),o&&jsxRuntime.jsx(reactNative.View,{style:Yt.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:o},style:Yt.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Yt.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:r.primary})})})})]})}var Yt=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"}}),x=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,borderRadius: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,borderRadius:8},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,borderRadius:12},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,borderRadius:12,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,borderRadius: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,borderRadius:7,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,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 Ss(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function _s(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function fr({execution:e,onPress:t}){let {colors:o,fonts:n,components:r}=O(),s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let d=G(ce(e.destination_token_metadata,"png")||ze("/icons/tokens/png/usdc.png")),a=s?"Deposit Processing":"Deposit Completed",c=Ss(e.created_at||new Date().toISOString()),b=_s(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[_t.container,{backgroundColor:r.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:_t.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:_t.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[_t.statusBadge,{backgroundColor:s?o.warning:o.success,borderColor:r.card.backgroundColor}],children:s?jsxRuntime.jsx(xn,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(De,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:_t.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[_t.title,{color:r.card.titleColor,fontFamily:n.medium}],children:a}),jsxRuntime.jsx(reactNative.Text,{style:[_t.dateTime,{color:r.card.subtitleColor,fontFamily:n.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:_t.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[_t.amount,{color:r.card.textRightColor,fontFamily:n.medium}],children:b}),jsxRuntime.jsx(kt,{size:20,color:r.card.actionColor,strokeWidth:2})]})]})}var _t=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,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"}});var{height:Ls}=reactNative.Dimensions.get("window");function Jn(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function Kn(e,t=6){if(!e)return "\u2014";try{let o=Number(e)/Math.pow(10,t);return o===0?"0.00":o>=1?o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function Ps(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Xn=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Zn(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Vs(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 hr({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:r,borderTopLeftRadius:s,borderTopRightRadius:l}){let{colors:d,fonts:a,components:c}=O(),[b,y]=react.useState(o),[v,V]=react.useState(false),[L,w]=react.useState(null),[h,m]=react.useState(false),u=react.useRef(null);react.useEffect(()=>{if(!e||!n)return;let p=async()=>{V(true);try{let ee=[...(await vo(n,r)).data].sort((M,z)=>{let te=M.created_at?new Date(M.created_at).getTime():0;return (z.created_at?new Date(z.created_at).getTime():0)-te});y(ee);}catch(se){console.error("Failed to fetch executions:",se),y(o);}finally{V(false);}};p();let $=setInterval(p,1e4);return ()=>clearInterval($)},[e,n,r,o]),react.useEffect(()=>{o.length>0&&y(p=>{let $=new Set(p.map(ee=>ee.id)),se=o.filter(ee=>!$.has(ee.id));return se.length>0?[...se,...p]:p});},[o]),react.useEffect(()=>{e||w(null);},[e]);let i=p=>{w(p);},f=()=>{w(null),m(false);},S=()=>{w(null),t();};return jsxRuntime.jsxs(ge,{visible:e,onClose:S,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:s,borderTopRightRadius:l,children:[jsxRuntime.jsx(Je,{title:L?"Deposit Details":"Deposit Tracker",onClose:S,showClose:!L,showBack:!!L,onBack:f}),L?(()=>{if(!L)return null;let p=L,$=p.status==="pending"||p.status==="waiting"||p.status==="delayed",se=p.status==="succeeded",ee=G(ce(p.destination_token_metadata,"png")||ze("/icons/tokens/png/usdc.png")),M=p.provider_metadata?.details,z=M?.currencyIn,te=M?.currencyOut;z?.currency?.symbol||"USDC";te?.currency?.symbol||"USDC";let Ze=Kn(p.source_amount_base_unit,p.source_token_metadata?.decimals),Ne=Kn(p.destination_amount_base_unit,p.destination_token_metadata?.decimals),Y=Ps(p.source_amount_usd),Pe=Jn(p.source_chain_type,p.source_chain_id),et=Jn(p.destination_chain_type,p.destination_chain_id),Ve=()=>{p.explorer_url&&reactNative.Linking.openURL(p.explorer_url);},$e=()=>{p.destination_explorer_url&&reactNative.Linking.openURL(p.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:u,style:F.scrollContainer,contentContainerStyle:F.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:F.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:F.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee},style:F.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[F.statusBadge,{backgroundColor:$?d.warning:d.success,borderColor:d.background}],children:$?jsxRuntime.jsx(Me,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(De,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:F.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[F.statusDot,{backgroundColor:$?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[F.statusText,{color:c.container.titleColor,fontFamily:a.semibold}],children:$?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[F.dateText,{color:c.container.subtitleColor,fontFamily:a.regular}],children:Vs(p.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[F.card,{backgroundColor:c.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:[Ze," ",Zn(p.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:d.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:[Ne," ",Zn(p.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:d.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:Y})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:d.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:Pe})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:d.border}]}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:et})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let We=!h;m(We),We?setTimeout(()=>{u.current?.scrollToEnd({animated:true});},100):u.current?.scrollTo({y:0,animated:true});},style:F.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.toggleText,{color:c.container.actionTitle,fontFamily:a.regular}],children:h?"See less":"See more details"}),h?jsxRuntime.jsx(Dt,{size:14,color:c.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Me,{size:14,color:c.container.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsxs(reactNative.View,{style:[F.card,{backgroundColor:c.card.backgroundColor}],children:[p.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ve,style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:Xn(p.transaction_hash)}),jsxRuntime.jsx(Nt,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[F.cardDivider,{backgroundColor:d.border}]})]}),p.destination_explorer_url&&se&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:$e,style:F.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardLabel,{color:c.card.rowLeftLabel,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:F.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.cardValue,{color:c.card.rowRightLabel,fontFamily:a.medium}],children:Xn(p.destination_transaction_hashes[0])}),jsxRuntime.jsx(Nt,{size:14,color:c.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:F.scrollContainer,contentContainerStyle:F.scrollContent,showsVerticalScrollIndicator:false,children:b.length===0?jsxRuntime.jsxs(reactNative.View,{style:F.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.emptyText,{color:c.container.titleColor,fontFamily:a.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[F.emptySubtext,{color:c.container.subtitleColor,fontFamily:a.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:F.executionsList,children:b.map(p=>jsxRuntime.jsx(fr,{execution:p,onPress:()=>i(p)},p.id))})})]})}var F=reactNative.StyleSheet.create({scrollContainer:{maxHeight:Ls*.7,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 Uo(e,t=true){let[o,n]=react.useState(null),[r,s]=react.useState(null),[l,d]=react.useState(false),[a,c]=react.useState(false),[b,y]=react.useState(null),[v,V]=react.useState(null);react.useEffect(()=>{!t||o||(d(true),Po().then(m=>{n(m),y(null);}).catch(m=>{y(m instanceof Error?m:new Error(String(m)));}).finally(()=>{d(false);}));},[t,o]),react.useEffect(()=>{!t||!e||r||(c(true),Lo(e).then(m=>{s(m),V(null);}).catch(m=>{V(m instanceof Error?m:new Error(String(m)));}).finally(()=>{c(false);}));},[t,e,r]);let L=l||a,w=b||v||null,h=null;if(o&&r){let m=r.blocked_country_codes||[],u=o.alpha2.toUpperCase();h=!m.some(i=>i.toUpperCase()===u);}return {isAllowed:h,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:L,error:w}}var an="unifold_recent_tokens",Es=5,ni=[{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 br(){try{let e=await sn__default.default.getItem(an);return e?JSON.parse(e):[]}catch{return []}}async function Ws(e){try{let o=(await br()).filter(r=>!(r.symbol===e.symbol&&r.chainType===e.chainType&&r.chainId===e.chainId));o.unshift(e);let n=o.slice(0,Es);await sn__default.default.setItem(an,JSON.stringify(n));}catch{}}async function As(e){try{let o=(await br()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));return await sn__default.default.setItem(an,JSON.stringify(o)),o}catch{return []}}function ln({visible:e,onClose:t,tokens:o,selectedToken:n,selectedChainKey:r,onSelect:s,borderTopLeftRadius:l,borderTopRightRadius:d}){let{colors:a,fonts:c,components:b}=O(),[y,v]=react.useState(""),[V,L]=react.useState([]);react.useEffect(()=>{e&&br().then(L);},[e]),react.useEffect(()=>{e||v("");},[e]);let w=react.useMemo(()=>{let S=[];return o.forEach(T=>{T.chains.forEach(A=>{S.push({token:T,chain:A});});}),S},[o]),h=react.useMemo(()=>{let S=[],T=new Set,A=(p,$,se,ee)=>{let M=`${p}-${$}:${se}`;if(T.has(M))return;let z=o.find(X=>X.symbol===p);if(!z)return;let te=z.chains.find(X=>X.chain_type===$&&X.chain_id===se);te&&(T.add(M),S.push({token:z,chain:te,isRecent:ee}));};return V.forEach(p=>{A(p.symbol,p.chainType,p.chainId,true);}),ni.forEach(p=>{A(p.symbol,p.chainType,p.chainId,false);}),S},[o,V]),m=react.useMemo(()=>{if(!y.trim())return w;let S=y.toLowerCase();return w.filter(({token:T,chain:A})=>T.symbol.toLowerCase().includes(S)||T.name.toLowerCase().includes(S)||A.chain_name.toLowerCase().includes(S))},[w,y]),u=(S,T,A)=>ni.some(p=>p.symbol===S&&p.chainType===T&&p.chainId===A),i=async(S,T)=>{let A=`${T.chain_type}:${T.chain_id}`;if(!u(S.symbol,T.chain_type,T.chain_id)){await Ws({symbol:S.symbol,chainType:T.chain_type,chainId:T.chain_id});let p=await br();L(p);}v(""),s(S.symbol,A),t();},f=async(S,T)=>{let A=await As({symbol:S.symbol,chainType:T.chain_type,chainId:T.chain_id});L(A);};return jsxRuntime.jsxs(ge,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:re.header,children:[jsxRuntime.jsx(reactNative.View,{style:re.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.headerTitle,{color:b.header.titleColor,fontFamily:c.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:re.closeButton,children:jsxRuntime.jsx(Oe,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:re.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[re.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:c.regular}],placeholder:"Search",placeholderTextColor:b.search.placeholderColor,value:y,onChangeText:v,autoCapitalize:"none",autoCorrect:false})}),h.length>0&&!y&&jsxRuntime.jsxs(reactNative.View,{style:re.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.sectionLabel,{color:b.list.titleSectionColor,fontFamily:c.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:re.quickSelectScroll,children:h.map(({token:S,chain:T,isRecent:A})=>{let p=`${T.chain_type}:${T.chain_id}`;S.symbol===n&&p===r;return jsxRuntime.jsxs(reactNative.View,{children:[A&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>f(S,T),style:re.removeButton,children:jsxRuntime.jsx(Oe,{size:12,color:a.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>i(S,T),style:[re.quickSelectItem],children:[jsxRuntime.jsxs(reactNative.View,{style:re.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(S,"png"))},style:re.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(T,"png"))},style:[re.quickSelectChainBadge,{borderColor:b.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:re.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.quickSelectSymbol,{color:b.card.titleColor,fontFamily:c.medium}],children:S.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[re.quickSelectChain,{color:b.card.subtitleColor,fontFamily:c.regular}],children:T.chain_name})]})]})]},`quick-${S.symbol}-${p}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.sectionLabel,{color:b.list.titleSectionColor,fontFamily:c.regular}],children:"All supported tokens"}),jsxRuntime.jsx(reactNative.ScrollView,{style:re.tokenList,showsVerticalScrollIndicator:false,contentContainerStyle:re.tokenListContent,children:m.length===0?jsxRuntime.jsx(reactNative.View,{style:re.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[re.emptyText,{color:a.foregroundMuted,fontFamily:c.regular}],children:"No tokens found"})}):m.map(({token:S,chain:T})=>{let A=`${T.chain_type}:${T.chain_id}`,p=S.symbol===n&&A===r;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>i(S,T),style:[re.tokenItem,{backgroundColor:p?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(S,"png"))},style:re.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(T,"png"))},style:[re.tokenChainBadge,{borderColor:b.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:re.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.tokenSymbol,{color:b.card.titleColor,fontFamily:c.medium}],children:S.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[re.tokenChainName,{color:b.card.subtitleColor,fontFamily:c.regular}],children:T.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[re.minDeposit,{color:b.card.labelColor,fontFamily:c.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:b.card.labelHighlightRightColor,fontFamily:c.regular},children:["$",T.minimum_deposit_amount_usd]})]})]},`${S.symbol}-${A}`)})})]})}var re=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,borderRadius:8,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,borderRadius: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 wr=(e,t)=>`${t}:${e}`,Hs=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function cn({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:s,destinationTokenSymbol:l,defaultChainType:d,defaultChainId:a,defaultTokenAddress:c,depositConfirmationMode:b="auto_ui",onExecutionsChange:y,onDepositSuccess:v,onDepositError:V,wallets:L,borderTopLeftRadius:w,borderTopRightRadius:h,sheetBorderRadius:m}){let{colors:u,fonts:i,components:f}=O(),S=d&&a?`${d}:${a}`:"solana:mainnet",[T,A]=react.useState("USDC"),[p,$]=react.useState(S),[se,ee]=react.useState([]),[M,z]=react.useState(!L?.length),te=L?.length?L:se,[X,Ce]=react.useState([]),[Ze,Ne]=react.useState(true),[Y,Pe]=react.useState(false),[et,Ve]=react.useState(false),[$e,We]=react.useState(false),[qe,at]=react.useState([]),[ht,tt]=react.useState(new Map),[bo]=react.useState(()=>new Date),[Wt,He]=react.useState(null),[ko,At]=react.useState(false),[le,Ae]=react.useState(null),[wo,ot]=react.useState(false),yt=new Map;X.forEach(Z=>{Z.chains.forEach(be=>{let _=`${be.chain_type}:${be.chain_id}`;yt.has(_)||yt.set(_,be);});});let Ct=Array.from(yt.values()),zt=Hs(p),Be=Ct.find(Z=>Z.chain_type===zt.chainType&&Z.chain_id===zt.chainId),To=Be?.chain_type||"ethereum",Rt=Ut(te,To),we=Rt?.address||"",Ie=react.useRef(false);react.useEffect(()=>{async function Z(){try{Ne(!0),He(null);let _=await Do(t,s&&r&&n?{destination_token_address:s,destination_chain_id:r,destination_chain_type:n}:void 0);if(Ce(_.data),_.data.length>0&&!Ie.current){Ie.current=!0;let B,N;if(d&&a)if(c)for(let U of _.data){let ke=U.chains.find(ue=>ue.chain_type===d&&ue.chain_id===a&&ue.token_address.toLowerCase()===c.toLowerCase());if(ke){B=U,N=ke;break}}else for(let U of _.data){let ke=U.chains.find(ue=>ue.chain_type===d&&ue.chain_id===a);if(ke){B=U,N=ke;break}}if(!B&&s)for(let U of _.data){let ke=U.chains.find(ue=>ue.token_address.toLowerCase()===s.toLowerCase());if(ke){B=U,N=ke;break}}B||(B=_.data.find(U=>U.symbol==="USDC"),B&&B.chains.length>0&&(N=B.chains[0])),B||(B=_.data.find(U=>U.symbol==="USDT"),B&&B.chains.length>0&&(N=B.chains[0])),B||(B=_.data[0],B.chains.length>0&&(N=B.chains[0])),B&&A(B.symbol),N&&$(wr(N.chain_id,N.chain_type));}}catch(be){console.error("Error fetching supported tokens:",be),He("Failed to load supported tokens"),V?.({message:"Failed to load supported tokens",error:be});}finally{Ne(false);}}Z();},[t,s,r,n,d,a,c,V]),react.useEffect(()=>{y&&y(qe);},[qe,y]),react.useEffect(()=>{if(L?.length){z(false);return}if(se.length>0){z(false);return}let Z=null,be=false,_=async()=>{if(!be){z(true);try{let B=await Mt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:s},t);be||(ee(B.data),He(null),z(!1));}catch(B){console.error("Error fetching wallets, retrying in 5s:",B),be||(He(B instanceof Error?B.message:"Failed to load wallets"),z(false),Z=setTimeout(_,5e3));}}};return _(),()=>{be=true,Z&&clearTimeout(Z);}},[e,o,n,r,s,t,L,se.length]);let xo=Rt?.id??"",{showWaitingUi:Xt,handleIveDeposited:Zt}=Ao({depositConfirmationMode:b,depositAddress:we,chain:p,externalUserId:e,publishableKey:t,modalOpenedAt:bo,depositWalletId:xo,depositExecutions:qe,trackedExecutions:ht,setDepositExecutions:at,setTrackedExecutions:tt,setLatestExecution:Ae,setShowStatusSheet:At,onDepositSuccess:v,onExecutionsChange:y,onDepositError:V});react.useEffect(()=>{if(!X.length)return;let Z=X.find(_=>_.symbol===T);if(!Z||Z.chains.length===0)return;if(!Z.chains.some(_=>wr(_.chain_id,_.chain_type)===p)){let _=Z.chains[0];$(wr(_.chain_id,_.chain_type));}},[T,X,p]);let Re=X.find(Z=>Z.symbol===T),ve=(Re?.chains||[]).find(Z=>wr(Z.chain_id,Z.chain_type)===p),eo=async()=>{if(we)try{reactNative.Clipboard.setString(we),Pe(!0),setTimeout(()=>Pe(!1),2e3);}catch(Z){console.error("Failed to copy:",Z);}},Ot=ve?.estimated_price_impact_percent??0,lt=ve?.max_slippage_percent??.25,_o=ve?.minimum_deposit_amount_usd??3;return Ze?jsxRuntime.jsxs(reactNative.View,{style:k.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[k.loadingText,{color:u.foregroundMuted,fontFamily:i.regular}],children:"Loading currencies..."})]}):Wt&&X.length===0?jsxRuntime.jsxs(reactNative.View,{style:k.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[k.errorText,{color:u.error,fontFamily:i.regular}],children:Wt}),jsxRuntime.jsx(reactNative.Text,{style:[k.errorHint,{color:u.foregroundMuted,fontFamily:i.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:k.container,children:[jsxRuntime.jsxs(reactNative.View,{style:k.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[k.selectorLabel,{color:f.card.labelColor,fontFamily:i.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>We(true),disabled:Ze||X.length===0,style:[k.tokenSelectorButton,{backgroundColor:f.card.backgroundColor}],activeOpacity:.7,children:Ze?jsxRuntime.jsxs(reactNative.View,{style:k.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[k.loadingIcon,{backgroundColor:u.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:k.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[k.loadingLine,{backgroundColor:u.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[k.loadingLine,{backgroundColor:u.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:k.tokenIconWrapper,children:[Re&&jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(Re,"png"))},style:k.tokenMainIcon}),(ve||Be)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:G(ce(ve||Be,"png"))},style:[k.tokenChainBadge,{borderColor:f.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:k.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[k.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:i.semibold}],children:Re?.symbol||T}),jsxRuntime.jsx(reactNative.Text,{style:[k.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:i.regular}],numberOfLines:1,children:ve?.chain_name||Be?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:k.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[k.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:i.medium}],children:["$",_o," min"]}),jsxRuntime.jsx(kt,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(ln,{visible:$e,onClose:()=>We(false),tokens:X,selectedToken:T,selectedChainKey:p,onSelect:(Z,be)=>{A(Z),$(be);},borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??h}),jsxRuntime.jsx(reactNative.View,{style:k.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[k.qrWrapper,{backgroundColor:u.background,borderColor:u.border}],children:M?jsxRuntime.jsxs(reactNative.View,{style:k.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[k.loadingText,{color:u.foregroundMuted,fontFamily:i.regular}],children:"Loading..."})]}):we?jsxRuntime.jsx(go,{value:we,size:180,logoUri:G(ce(ve,"png")||ze("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:k.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[k.errorText,{color:u.error,fontFamily:i.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:k.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:k.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[k.addressLabel,{color:f.card.labelColor,fontFamily:i.medium}],children:"Deposit Address"}),Y&&jsxRuntime.jsxs(reactNative.View,{style:k.copiedIndicator,children:[jsxRuntime.jsx(De,{size:14,color:u.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[k.copiedText,{color:u.success,fontFamily:i.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:eo,disabled:!we||M,activeOpacity:.7,style:[k.addressBox,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[k.addressText,{color:f.card.titleColor,fontFamily:i.regular}],numberOfLines:2,children:M?"Loading...":we||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:k.addressCopyIcon,children:jsxRuntime.jsx(Vo,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsx(ir,{depositConfirmationMode:b,depositAddress:we,showWaitingUi:Xt,latestExecution:le,onIveDeposited:Zt}),jsxRuntime.jsxs(reactNative.View,{style:[k.detailsCard,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Ve(!et),style:k.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:k.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[k.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(jt,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[k.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:k.chevronContainer,children:et?jsxRuntime.jsx(Dt,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Me,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),et&&jsxRuntime.jsxs(reactNative.View,{style:k.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:k.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[k.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(io,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[k.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:["Price impact: ",Ot.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ot(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(so,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:k.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[k.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(ao,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[k.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:["Slippage: Auto \u2022 ",lt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ot(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(so,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:k.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[k.detailIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ko,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[k.detailsLabel,{color:f.card.titleColor,fontFamily:i.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:k.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[k.termsText,{color:u.primary,fontFamily:i.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ge,{visible:wo,onClose:()=>ot(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:m?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:m?.infoSheet?.borderTopRightRadius??h,children:[jsxRuntime.jsxs(reactNative.View,{style:[k.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:k.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[k.sheetTitle,{color:f.header.titleColor,fontFamily:i.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ot(false),style:k.sheetCloseButton,children:jsxRuntime.jsx(Oe,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:k.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[k.infoCard,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:k.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[k.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(io,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[k.infoCardTitle,{color:f.card.titleColor,fontFamily:i.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[k.infoCardValue,{color:f.card.titleColor,fontFamily:i.medium}],children:[Ot.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[k.infoCardDescription,{color:f.card.descriptionColor,fontFamily:i.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[k.infoCard,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:k.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[k.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor}],children:jsxRuntime.jsx(ao,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[k.infoCardTitle,{color:f.card.titleColor,fontFamily:i.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[k.infoCardValue,{color:f.card.titleColor,fontFamily:i.medium}],children:[lt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[k.infoCardDescription,{color:f.card.descriptionColor,fontFamily:i.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),le&&jsxRuntime.jsx(fo,{visible:ko,status:le.status,tokenIconUrl:le.destination_token_metadata?.icon_urls?.find(Z=>Z.format==="png")?.url||le.destination_token_metadata?.icon_url||ce(Re,"png"),explorerUrl:le.explorer_url,completionExplorerUrl:le.destination_explorer_url,date:le.created_at?new Date(le.created_at):void 0,amountUsd:le.source_amount_usd?parseFloat(le.source_amount_usd):void 0,onClose:()=>At(false),borderTopLeftRadius:m?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:m?.depositStatus?.borderTopRightRadius??h})]})}var k=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,borderRadius: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,borderRadius:16,borderWidth:1},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,borderRadius:8},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 Kt={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Gs({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:r="Deposit",destinationTokenSymbol:s,recipientAddress:l,destinationChainType:d,destinationChainId:a,destinationTokenAddress:c,defaultChainType:b,defaultChainId:y,defaultTokenAddress:v,showBalance:V=false,hideDepositTracker:L=false,depositConfirmationMode:w="auto_ui",transferInputVariant:h="double_input",onDepositSuccess:m,onDepositError:u,sheetBorderRadius:i}){let f=i?.globalBorderTopLeftRadius,S=i?.globalBorderTopRightRadius,{colors:T,fonts:A}=O(),[p,$]=react.useState([]),[se,ee]=react.useState(false),[M,z]=react.useState(false),[te,X]=react.useState(false),[Ce,Ze]=react.useState(null),[Ne,Y]=react.useState("amount"),{isAllowed:Pe,isLoading:et}=Uo(n,e);react.useEffect(()=>{e&&!Ce&&Lo(n).then(Ze).catch(console.error);},[e,Ce,n]);let Ve=()=>{t();},$e=p.filter(tt=>tt.status==="pending"||tt.status==="waiting").length,qe=!!(l&&d&&a&&c&&n)&&V!==false&&!!Ce,at=et||e&&!Ce,ht=Pe===false;return jsxRuntime.jsxs(ge,{visible:e,onClose:Ve,closeOnBackdropPress:false,showHandle:false,borderTopLeftRadius:i?.main?.borderTopLeftRadius??f,borderTopRightRadius:i?.main?.borderTopRightRadius??S,children:[jsxRuntime.jsx(Je,{title:r,showBack:false,onClose:Ve,showBalance:qe,balanceAddress:l,balanceChainType:d,balanceChainId:a,balanceTokenAddress:c,publishableKey:n,projectName:Ce?.project_name}),at&&jsxRuntime.jsx(reactNative.View,{style:It.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:T.primary})}),!at&&ht&&jsxRuntime.jsxs(reactNative.View,{style:It.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[It.iconContainer,{backgroundColor:T.cardHover}],children:jsxRuntime.jsx(Xo,{size:32,color:T.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[It.blockedTitle,{color:T.foreground,fontFamily:A.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[It.blockedDescription,{color:T.foreground,opacity:.7,fontFamily:A.regular}],children:"There are no supported tokens available from your current location."})]}),!at&&!ht&&jsxRuntime.jsxs(reactNative.View,{style:It.optionsContainer,children:[jsxRuntime.jsx(Bo,{onPress:()=>z(true),title:Kt.transferCrypto.title,subtitle:Kt.transferCrypto.subtitle,featuredTokens:Ce?.transfer_crypto?.networks}),jsxRuntime.jsx(Eo,{onPress:()=>X(true),title:Kt.depositWithCard.title,subtitle:Kt.depositWithCard.subtitle,paymentNetworks:Ce?.payment_networks?.networks}),!L&&jsxRuntime.jsx(Wo,{onPress:()=>ee(true),title:Kt.depositTracker.title,subtitle:Kt.depositTracker.subtitle,badge:$e>0?$e:void 0})]}),jsxRuntime.jsx(hr,{visible:se,onClose:()=>ee(false),executions:p,externalUserId:o,publishableKey:n,borderTopLeftRadius:i?.depositsTracker?.borderTopLeftRadius??f,borderTopRightRadius:i?.depositsTracker?.borderTopRightRadius??S}),jsxRuntime.jsxs(ge,{visible:M,onClose:()=>z(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:i?.transferCrypto?.borderTopLeftRadius??f,borderTopRightRadius:i?.transferCrypto?.borderTopRightRadius??S,children:[jsxRuntime.jsx(Je,{title:Kt.transferCrypto.title,showBack:false,onClose:()=>z(false),showBalance:qe,balanceAddress:l,balanceChainType:d,balanceChainId:a,balanceTokenAddress:c,publishableKey:n,projectName:Ce?.project_name}),jsxRuntime.jsx(reactNative.ScrollView,{style:It.transferScrollContainer,contentContainerStyle:It.scrollContent,showsVerticalScrollIndicator:false,children:h==="single_input"?jsxRuntime.jsx(cn,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:d,destinationChainId:a,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:b,defaultChainId:y,defaultTokenAddress:v,depositConfirmationMode:w,onExecutionsChange:$,onDepositSuccess:m,onDepositError:u,borderTopLeftRadius:f,borderTopRightRadius:S,sheetBorderRadius:{tokenSelector:i?.tokenSelector,infoSheet:i?.infoSheet,depositStatus:i?.depositStatus}}):jsxRuntime.jsx(ar,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:d,destinationChainId:a,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:b,defaultChainId:y,defaultTokenAddress:v,depositConfirmationMode:w,onExecutionsChange:$,onDepositSuccess:m,onDepositError:u,borderTopLeftRadius:f,borderTopRightRadius:S,sheetBorderRadius:{tokenSelector:i?.tokenSelector,chainSelector:i?.chainSelector,infoSheet:i?.infoSheet,depositStatus:i?.depositStatus}})})]}),jsxRuntime.jsxs(ge,{visible:te,onClose:()=>{X(false),Y("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:i?.buyWithCard?.borderTopLeftRadius??f,borderTopRightRadius:i?.buyWithCard?.borderTopRightRadius??S,children:[jsxRuntime.jsx(Je,{title:`Deposit ${s||"USDC"}`,showBack:Ne==="onramp",onBack:()=>Y("amount"),onClose:()=>{X(false),Y("amount");},showBalance:qe,balanceAddress:l,balanceChainType:d,balanceChainId:a,balanceTokenAddress:c,publishableKey:n,projectName:Ce?.project_name}),jsxRuntime.jsx(reactNative.View,{style:It.buyWithCardContainer,children:jsxRuntime.jsx(ur,{externalUserId:o,publishableKey:n,destinationTokenSymbol:s,recipientAddress:l,destinationChainType:d,destinationChainId:a,destinationTokenAddress:c,onDepositSuccess:m,onDepositError:u,view:Ne,onViewChange:tt=>Y(tt),borderTopLeftRadius:f,borderTopRightRadius:S,sheetBorderRadius:{providerModal:i?.providerModal,webView:i?.webView,currencyModal:i?.currencyModal}})})]})]})}function Tr({theme:e="auto",...t}){return jsxRuntime.jsx(Gs,{...t})}var It=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{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}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var na=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),ci=react.createContext(null);function ia({children:e,publishableKey:t,config:o}){let[n]=react.useState(()=>na()),[r,s]=react.useState(false),[l,d]=react.useState(null),a=reactNative.useColorScheme(),c=react.useRef(false);c.current||(Go({publishableKey:t}),c.current=true);let b=react.useMemo(()=>{let u=o?.appearance||"dark";return u==="auto"?a==="dark"?"dark":"light":u},[o?.appearance,a]);react.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.'),Go({publishableKey:t});},[t]);let y=react.useRef(null),v=react.useRef(null),V=react.useCallback(u=>{v.current&&(clearTimeout(v.current),v.current=null),y.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),y.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),y.current=null);let i=new Promise((f,S)=>{y.current={resolve:f,reject:S};});return d(u),s(true),i},[]),L=react.useCallback(()=>{y.current&&(y.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),y.current=null),s(false),v.current=setTimeout(()=>{d(null),v.current=null;},200);},[]),w=react.useCallback(u=>{l?.onSuccess&&l.onSuccess(u),y.current&&(y.current.resolve(u),y.current=null);},[l]),h=react.useCallback(u=>{console.error("[UnifoldProvider] Deposit error:",u),l?.onError&&l.onError(u),y.current&&(y.current.reject(u),y.current=null);},[l]),m=react.useMemo(()=>({publishableKey:t,beginDeposit:V,closeDeposit:L}),[t,V,L]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:n,children:jsxRuntime.jsx(ci.Provider,{value:m,children:jsxRuntime.jsxs($o,{mode:b,accentColor:o?.accentColor,theme:o?.theme,fontFamily:o?.fontFamily,fonts:o?.fonts,components:o?.components,children:[e,l&&jsxRuntime.jsx(Tr,{visible:r,onClose:L,publishableKey:t,modalTitle:o?.modalTitle,externalUserId:l.externalUserId,destinationChainType:l.destinationChainType,destinationChainId:l.destinationChainId,destinationTokenSymbol:l.destinationTokenSymbol,recipientAddress:l.recipientAddress,destinationTokenAddress:l.destinationTokenAddress,defaultChainType:l.defaultChainType,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,showBalance:l.showBalance,depositConfirmationMode:l.depositConfirmationMode??"auto_ui",hideDepositTracker:o?.hideDepositTracker,transferInputVariant:o?.transferInputVariant,onDepositSuccess:w,onDepositError:h,theme:b,sheetBorderRadius:o?.sheetBorderRadius})]})})})}function sa(){let e=react.useContext(ci);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
2
+ exports.UnifoldProvider=ia;exports.setDevApiUrl=hn;exports.useAllowedCountry=Uo;exports.useUnifold=sa;