@unifold/connect-react-native 0.1.19 → 0.1.20

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