@spicenet-io/spiceflow-ui 1.10.3 → 1.10.4
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.cjs.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
transform: translateY(100%);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`})]})},gs=({depositBatches:t,tokenAddress:o,tokenDecimals:r,supportedChains:n,supportedTokens:s,theme:c="light",styles:i,className:d="",depositInputHook:g,onDepositSuccess:f,onDepositError:u,onTopUp:l})=>{const C=de.createTheme(c),A={...C,typography:{...C.typography,fontFamily:i?.fontFamily||C.typography.fontFamily},colors:{...C.colors,primary:i?.primaryColor||C.colors.primary,primaryHover:i?.primaryColor?`${i.primaryColor}dd`:C.colors.primaryHover}},w=Lt(),{isReady:k,isAuthenticated:p,isConnected:b,address:m,provider:j,actions:y}=w,[h,x]=a.useState(null),{assets:S,loading:F,error:B,hasBalance:I,refetch:G}=us({address:m,supportedChains:n,enabled:b,refetchInterval:3e4}),[P,_]=a.useState(!1),[$,J]=a.useState(null),[M,z]=a.useState(!1),[E,U]=a.useState(!1),[X,ee]=a.useState(!1),H=a.useRef(null),{intentStatus:ne,startStatusPolling:xe,clearStatus:ue}=kt({checkStepStatus:(Z,he)=>we.checkStepStatus(Z,he)});a.useEffect(()=>{if(ne?.overallStatus==="success"&&ne.intentId&&H.current!==ne.intentId&&h&&m){const Z=ne.steps.find(he=>he.transactionHash);if(Z?.transactionHash){H.current=ne.intentId;const he=re.parseUnits(h.amount,h.asset.decimals);we.submitSpiceDeposit({user:m,txHash:Z.transactionHash,sender:m,tokenAddress:h.asset.address,chainId:h.asset.chainId,amount:he.toString(),isDeposit:!1}).then(()=>{G()}).catch(()=>{H.current=null})}}},[ne,m]),a.useEffect(()=>{g&&g.assetAmount!==h?.amount&&h&&x({...h,amount:g.assetAmount})},[g?.assetAmount,h]);const Ee=a.useCallback(()=>{J(null)},[]),R=Z=>{x({asset:Z,amount:h?.amount||""}),Ee()},q=a.useCallback(Z=>{h&&(a.startTransition(()=>{x({...h,amount:Z}),Ee()}),g&&g.setAssetAmount(Z))},[h,g,Ee]),pe=async()=>{if(!(!h||!m||t.length===0)){if(!k||!p){J(`Please authenticate with ${j||"wallet provider"} to continue`);return}_(!0),J(null),ee(!0);try{const Z=[...t],he=[...new Set(Z.map(ce=>ce.chainId))],Ce=[];for(const ce of he){const ze=Ve(ce),W=ct(ce),K=await Ye.getAccountNonce(m,ze),ie=await y.signAuthorization({contractAddress:W,chainId:ce,nonce:Number(K)});Ce.push(ie)}const T=Ye.hashChainBatches(Z),oe=Math.floor(Date.now()/1e3)+60*10,le=Ye.getIntentHash(0n,BigInt(oe),T),Se=await y.signMessage({raw:le}),ve=typeof Se=="string"?Se:Se.signature;if(!ve)throw new Error("Failed to sign intent authorization");const ke={mode:"7702",signatureType:"ecdsa",signature:ve,nbf:0,exp:oe,chainBatches:T.map(ce=>({hash:ce.hash,chainId:ce.chainId,tokenTransfers:[{from:"solver",to:m,token:"0x0",amount:re.parseUnits("0.01",18)},{from:"solver",to:m,token:o,amount:re.parseUnits(h.amount,r)}],calls:ce.calls}))},Ie=await we.createAction({user:m,chainAuthorizations:Ce.map(ce=>({...ce,r:ce.r,s:ce.s,yParity:ce.yParity,address:ce.address,chainId:Number(ce.chainId),nonce:Number(ce.nonce)})),intents:[ke]});if(Ie){const ce=Et(Z,ie=>`Chain ${ie}`),[ze,W]=Ie.intentIds[0].split("/"),K=parseInt(W||"0",10);xe(Ie.intentIds[0],ce);for(let ie=0;ie<Z.length;ie++)await we.executeStep(ze,K,ie,{action:"execute"})}}catch(Z){const he=Z instanceof Error?Z.message:"Deposit failed";J(he),u?.(he)}finally{_(!1)}}},v=a.useMemo(()=>s&&s.length>0?S.filter(Z=>s.some(he=>he.toLowerCase()===Z.symbol.toLowerCase())):S,[S,s]),N=h&&h.amount&&parseFloat(h.amount)>0&&parseFloat(h.amount)<=h.asset.balanceFormatted&&b&&!P&&t.length>0,O=B||$,se={backgroundColor:i?.container?.backgroundColor||i?.primaryBackground||A.colors.background,border:`1px solid ${i?.container?.borderColor||A.colors.border}`,borderRadius:i?.container?.borderRadius||A.borderRadius.lg,padding:i?.container?.padding||A.spacing.md,width:i?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:A.colors.text,fontFamily:A.typography.fontFamily,boxShadow:i?.container?.boxShadow||(A.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},ae=ne?e.jsx(qt,{type:"deposit",isOpen:!!ne&&ne.overallStatus!=="processing",isProcessing:P||ne?.overallStatus==="processing",onRetryTx:()=>{ue(),ee(!1),pe()},onNewTx:()=>{ue(),ee(!1),x(null),H.current=null,G()},onClose:()=>{ue(),ee(!1)},onComplete:()=>{ue(),ee(!1),x(null),H.current=null,G()},results:ne?.overallStatus==="success"||ne?.overallStatus==="failed"?ne.steps.map(Z=>({asset:{symbol:h?.asset.symbol||"Token",address:h?.asset.address||""},txHash:Z.transactionHash||"",success:Z.status==="success",amount:h?.amount})):void 0,chainName:h?st(t[t.length-1].chainId):"Network",explorerUrl:h?Wt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:A}):null;return e.jsxs("div",{style:{...se,position:"relative"},className:d,children:[ae&&e.jsx("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:ae})}),!F&&!I&&e.jsx("div",{style:{backgroundColor:A.mode==="light"?"#fef3c7":`${A.colors.warning||"#f59e0b"}20`,border:`1px solid ${A.mode==="light"?"#fcd34d":A.colors.warning||"#f59e0b"}`,borderRadius:A.borderRadius.md,padding:A.spacing.md,marginBottom:A.spacing.md,textAlign:"center"},children:e.jsxs("p",{style:{color:A.mode==="light"?"#92400e":"#fbbf24",fontSize:A.typography.fontSize.sm,fontFamily:A.typography.fontFamily,margin:0,lineHeight:1.5},children:["You do not have any cross-chain balance."," ",l&&e.jsx("span",{onClick:l,style:{color:A.colors.primary,textDecoration:"underline",cursor:"pointer",fontWeight:600},children:"Top-up here."})]})}),e.jsx("div",{style:{marginBottom:A.spacing.sm},children:e.jsx(ht,{assets:v,selectedAsset:h||void 0,onAssetSelect:R,onAmountChange:q,loading:F,label:"Amount",showBalance:!0,showMaxButton:!0,theme:A,styles:i})}),O&&e.jsx("div",{style:{backgroundColor:i?.errorMessage?.backgroundColor||(A.mode==="light"?"#fef2f2":`${i?.statusDisplay?.errorColor||A.colors.error}20`),border:`1px solid ${i?.errorMessage?.borderColor||(A.mode==="light"?"#fecaca":i?.statusDisplay?.errorColor||A.colors.error)}`,borderRadius:i?.errorMessage?.borderRadius||A.borderRadius.md,padding:i?.errorMessage?.padding||A.spacing.md,marginBottom:A.spacing.sm},children:e.jsx("p",{style:{color:i?.errorMessage?.color||i?.statusDisplay?.errorColor||A.colors.error,fontSize:i?.errorMessage?.fontSize||A.typography.fontSize.sm,fontWeight:i?.errorMessage?.fontWeight,fontFamily:i?.errorMessage?.fontFamily||A.typography.fontFamily,margin:0},children:O})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:A.spacing.sm},children:e.jsx(de.Button,{variant:"outline",fullWidth:!0,onClick:pe,onMouseEnter:()=>z(!0),onMouseLeave:()=>{z(!1),U(!1)},onMouseDown:()=>U(!0),onMouseUp:()=>U(!1),loading:P,disabled:!N||!b,theme:A,styles:i,style:{width:"100%",padding:"8px",backgroundColor:N?E?"#d43d3d":M?"#f05555":"#ea4b4b":"#d1d5db",color:N?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:N?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:N?E?"scale(0.98)":M?"translateY(-2px)":"none":"none",boxShadow:E?"1px 1px 0px black":M&&N?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:k?p?b?P?"Executing Deposit...":h?h.amount?parseFloat(h.amount)>h.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Deposit Batches":"Execute Deposit":"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})};var xs="data:image/svg+xml,%3csvg width='108' height='22' viewBox='0 0 108 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1.9916 11.9854V11.2041H3.98379C4.48835 11.2041 4.87897 11.0739 5.15566 10.8135C5.43236 10.5498 5.5707 10.1868 5.5707 9.72461V9.71484C5.5707 9.24935 5.43236 8.88639 5.15566 8.62598C4.87897 8.36556 4.48835 8.23535 3.98379 8.23535H1.9916V7.4541H4.2084C4.65111 7.4541 5.04173 7.5485 5.38027 7.7373C5.71882 7.92611 5.98411 8.18978 6.17617 8.52832C6.37148 8.86686 6.46914 9.25911 6.46914 9.70508V9.71484C6.46914 10.1608 6.37148 10.5547 6.17617 10.8965C5.98411 11.2383 5.71882 11.5052 5.38027 11.6973C5.04173 11.8893 4.65111 11.9854 4.2084 11.9854H1.9916ZM1.55215 14.5V7.4541H2.43106V14.5H1.55215ZM9.51875 14.5928C9.0207 14.5928 8.58939 14.4837 8.2248 14.2656C7.86348 14.0443 7.58353 13.7301 7.38496 13.3232C7.18965 12.9163 7.09199 12.4329 7.09199 11.873V11.8633C7.09199 11.3001 7.18965 10.8151 7.38496 10.4082C7.58353 10.0013 7.86348 9.6888 8.2248 9.4707C8.58939 9.2526 9.0207 9.14355 9.51875 9.14355C10.0201 9.14355 10.4514 9.2526 10.8127 9.4707C11.174 9.6888 11.4523 10.0013 11.6477 10.4082C11.8462 10.8151 11.9455 11.3001 11.9455 11.8633V11.873C11.9455 12.4329 11.8462 12.9163 11.6477 13.3232C11.4523 13.7301 11.174 14.0443 10.8127 14.2656C10.4514 14.4837 10.0201 14.5928 9.51875 14.5928ZM9.51875 13.8408C9.85078 13.8408 10.1324 13.7627 10.3635 13.6064C10.5946 13.4502 10.7704 13.2256 10.8908 12.9326C11.0145 12.6396 11.0764 12.2865 11.0764 11.873V11.8633C11.0764 11.4466 11.0145 11.0918 10.8908 10.7988C10.7704 10.5059 10.5946 10.2829 10.3635 10.1299C10.1324 9.97363 9.85078 9.89551 9.51875 9.89551C9.18672 9.89551 8.90514 9.97363 8.67402 10.1299C8.4429 10.2829 8.26549 10.5059 8.1418 10.7988C8.02135 11.0918 7.96113 11.4466 7.96113 11.8633V11.873C7.96113 12.2865 8.02135 12.6396 8.1418 12.9326C8.26549 13.2256 8.4429 13.4502 8.67402 13.6064C8.90514 13.7627 9.18672 13.8408 9.51875 13.8408ZM13.7842 14.5L12.3096 9.23633H13.1592L14.1943 13.4453H14.2725L15.4492 9.23633H16.2549L17.4316 13.4453H17.5098L18.5449 9.23633H19.3896L17.915 14.5H17.0605L15.8838 10.4277H15.8057L14.6338 14.5H13.7842ZM22.1658 14.5928C21.6645 14.5928 21.2332 14.4821 20.8719 14.2607C20.5138 14.0394 20.2371 13.7269 20.0418 13.3232C19.8497 12.9163 19.7537 12.4378 19.7537 11.8877V11.8828C19.7537 11.3392 19.8497 10.8623 20.0418 10.4521C20.2371 10.042 20.5122 9.72135 20.867 9.49023C21.2218 9.25911 21.6368 9.14355 22.1121 9.14355C22.5906 9.14355 23.0008 9.25423 23.3426 9.47559C23.6876 9.69694 23.9513 10.0062 24.1336 10.4033C24.3191 10.7972 24.4119 11.2562 24.4119 11.7803V12.1123H20.1932V11.4336H23.9773L23.5574 12.0537V11.7168C23.5574 11.3034 23.4956 10.9632 23.3719 10.6963C23.2482 10.4294 23.0773 10.2308 22.8592 10.1006C22.6411 9.96712 22.3904 9.90039 22.1072 9.90039C21.824 9.90039 21.5701 9.97038 21.3455 10.1104C21.1242 10.2471 20.9484 10.4505 20.8182 10.7207C20.688 10.9909 20.6229 11.3229 20.6229 11.7168V12.0537C20.6229 12.4281 20.6863 12.7487 20.8133 13.0156C20.9402 13.2793 21.1209 13.4827 21.3553 13.626C21.5896 13.766 21.8663 13.8359 22.1854 13.8359C22.423 13.8359 22.6297 13.8034 22.8055 13.7383C22.9813 13.6732 23.1261 13.5902 23.24 13.4893C23.354 13.3883 23.4337 13.2858 23.4793 13.1816L23.4988 13.1377H24.3484L24.3387 13.1768C24.2931 13.3558 24.2117 13.5299 24.0945 13.6992C23.9806 13.8652 23.8325 14.0166 23.6502 14.1533C23.4679 14.2868 23.2514 14.3942 23.0008 14.4756C22.7534 14.5537 22.4751 14.5928 22.1658 14.5928ZM25.4303 14.5V9.23633H26.2799V10.0176H26.358C26.4589 9.74089 26.6298 9.52604 26.8707 9.37305C27.1116 9.22005 27.4094 9.14355 27.7643 9.14355C27.8456 9.14355 27.9254 9.14844 28.0035 9.1582C28.0849 9.16471 28.1467 9.17122 28.1891 9.17773V10.0029C28.1012 9.98665 28.0149 9.97526 27.9303 9.96875C27.8489 9.95898 27.761 9.9541 27.6666 9.9541C27.3964 9.9541 27.1572 10.0078 26.9488 10.1152C26.7405 10.2227 26.5761 10.3724 26.4557 10.5645C26.3385 10.7565 26.2799 10.9811 26.2799 11.2383V14.5H25.4303ZM30.9408 14.5928C30.4395 14.5928 30.0082 14.4821 29.6469 14.2607C29.2888 14.0394 29.0121 13.7269 28.8168 13.3232C28.6247 12.9163 28.5287 12.4378 28.5287 11.8877V11.8828C28.5287 11.3392 28.6247 10.8623 28.8168 10.4521C29.0121 10.042 29.2872 9.72135 29.642 9.49023C29.9968 9.25911 30.4118 9.14355 30.8871 9.14355C31.3656 9.14355 31.7758 9.25423 32.1176 9.47559C32.4626 9.69694 32.7263 10.0062 32.9086 10.4033C33.0941 10.7972 33.1869 11.2562 33.1869 11.7803V12.1123H28.9682V11.4336H32.7523L32.3324 12.0537V11.7168C32.3324 11.3034 32.2706 10.9632 32.1469 10.6963C32.0232 10.4294 31.8523 10.2308 31.6342 10.1006C31.4161 9.96712 31.1654 9.90039 30.8822 9.90039C30.599 9.90039 30.3451 9.97038 30.1205 10.1104C29.8992 10.2471 29.7234 10.4505 29.5932 10.7207C29.463 10.9909 29.3979 11.3229 29.3979 11.7168V12.0537C29.3979 12.4281 29.4613 12.7487 29.5883 13.0156C29.7152 13.2793 29.8959 13.4827 30.1303 13.626C30.3646 13.766 30.6413 13.8359 30.9604 13.8359C31.198 13.8359 31.4047 13.8034 31.5805 13.7383C31.7563 13.6732 31.9011 13.5902 32.015 13.4893C32.129 13.3883 32.2087 13.2858 32.2543 13.1816L32.2738 13.1377H33.1234L33.1137 13.1768C33.0681 13.3558 32.9867 13.5299 32.8695 13.6992C32.7556 13.8652 32.6075 14.0166 32.4252 14.1533C32.2429 14.2868 32.0264 14.3942 31.7758 14.4756C31.5284 14.5537 31.2501 14.5928 30.9408 14.5928ZM36.1486 14.5928C35.7059 14.5928 35.3186 14.4805 34.9865 14.2559C34.6545 14.0312 34.3973 13.7155 34.215 13.3086C34.0328 12.8984 33.9416 12.4199 33.9416 11.873V11.8633C33.9416 11.3132 34.0328 10.8346 34.215 10.4277C34.3973 10.0208 34.6529 9.70508 34.9816 9.48047C35.3137 9.25586 35.7027 9.14355 36.1486 9.14355C36.3895 9.14355 36.6158 9.18262 36.8273 9.26074C37.0422 9.33561 37.2326 9.44141 37.3986 9.57812C37.5647 9.71484 37.6949 9.8776 37.7893 10.0664H37.8674V7.14648H38.717V14.5H37.8674V13.6602H37.7893C37.6818 13.8555 37.5467 14.0231 37.384 14.1631C37.2212 14.2998 37.0357 14.4056 36.8273 14.4805C36.619 14.5553 36.3928 14.5928 36.1486 14.5928ZM36.3439 13.8408C36.663 13.8408 36.938 13.7611 37.1691 13.6016C37.4003 13.4421 37.5777 13.2158 37.7014 12.9229C37.8251 12.6266 37.8869 12.2767 37.8869 11.873V11.8633C37.8869 11.4564 37.8251 11.1064 37.7014 10.8135C37.5777 10.5205 37.4003 10.2943 37.1691 10.1348C36.938 9.97526 36.663 9.89551 36.3439 9.89551C36.0249 9.89551 35.7499 9.97526 35.5188 10.1348C35.2909 10.291 35.1151 10.5156 34.9914 10.8086C34.871 11.1016 34.8107 11.4531 34.8107 11.8633V11.873C34.8107 12.2799 34.871 12.6315 34.9914 12.9277C35.1151 13.2207 35.2909 13.4469 35.5188 13.6064C35.7499 13.7627 36.0249 13.8408 36.3439 13.8408ZM45.1775 14.5928C44.9334 14.5928 44.7072 14.5553 44.4988 14.4805C44.2905 14.4056 44.1049 14.2998 43.9422 14.1631C43.7794 14.0231 43.6443 13.8555 43.5369 13.6602H43.4588V14.5H42.6092V7.14648H43.4588V10.0664H43.5369C43.6346 9.8776 43.7648 9.71484 43.9275 9.57812C44.0936 9.44141 44.2824 9.33561 44.4939 9.26074C44.7088 9.18262 44.9367 9.14355 45.1775 9.14355C45.6235 9.14355 46.0109 9.25586 46.3396 9.48047C46.6717 9.70508 46.9288 10.0208 47.1111 10.4277C47.2934 10.8346 47.3846 11.3132 47.3846 11.8633V11.873C47.3846 12.4199 47.2934 12.8984 47.1111 13.3086C46.9288 13.7155 46.6717 14.0312 46.3396 14.2559C46.0109 14.4805 45.6235 14.5928 45.1775 14.5928ZM44.9822 13.8408C45.3045 13.8408 45.5796 13.7627 45.8074 13.6064C46.0353 13.4469 46.2094 13.2207 46.3299 12.9277C46.4536 12.6315 46.5154 12.2799 46.5154 11.873V11.8633C46.5154 11.4531 46.4536 11.1016 46.3299 10.8086C46.2094 10.5156 46.0353 10.291 45.8074 10.1348C45.5796 9.97526 45.3045 9.89551 44.9822 9.89551C44.6632 9.89551 44.3881 9.97526 44.157 10.1348C43.9259 10.2943 43.7485 10.5205 43.6248 10.8135C43.5011 11.1064 43.4393 11.4564 43.4393 11.8633V11.873C43.4393 12.2767 43.5011 12.6266 43.6248 12.9229C43.7485 13.2158 43.9259 13.4421 44.157 13.6016C44.3881 13.7611 44.6632 13.8408 44.9822 13.8408ZM48.6568 16.3457C48.6015 16.3457 48.5396 16.3424 48.4713 16.3359C48.4029 16.3327 48.3395 16.3262 48.2809 16.3164V15.6182C48.3329 15.6279 48.3899 15.6344 48.4518 15.6377C48.5136 15.641 48.5738 15.6426 48.6324 15.6426C48.8733 15.6426 49.0702 15.5807 49.2232 15.457C49.3795 15.3333 49.5048 15.1201 49.5992 14.8174L49.6969 14.5049L47.7486 9.23633H48.6568L50.2779 14.0996L49.941 13.5674H50.3414L50.0045 14.0996L51.6207 9.23633H52.5143L50.4586 14.8223C50.3154 15.2161 50.164 15.5238 50.0045 15.7451C49.845 15.9665 49.6578 16.1211 49.443 16.209C49.2314 16.3001 48.9693 16.3457 48.6568 16.3457Z' fill='%230E0D0B'/%3e%3cpath d='M62.7081 13.27C62.742 13.27 62.7642 13.3057 62.7491 13.3362V13.336L61.1229 16.6083C61.0892 16.6761 60.9926 16.6759 60.959 16.6083L59.3382 13.336C59.3232 13.3057 59.3453 13.27 59.3792 13.27H62.7081Z' fill='%23EA4B4B'/%3e%3cpath d='M61.0026 9.71913C61.0194 9.68524 61.0678 9.68524 61.0845 9.71913L62.747 13.0897C62.762 13.12 62.7399 13.1557 62.706 13.1557H59.3763C59.3424 13.1557 59.3203 13.12 59.3353 13.0897L61.0026 9.71913Z' fill='%23EA4B4B'/%3e%3cpath d='M60.8426 9.63827C60.8766 9.63827 60.8987 9.6741 60.8835 9.70444L59.2164 13.0594C59.1995 13.0932 59.1513 13.0932 59.1345 13.0594L57.5001 9.77047C57.47 9.70962 57.5142 9.63827 57.5821 9.63827H60.8426Z' fill='%23EA4B4B'/%3e%3cpath d='M64.5036 9.63617C64.5715 9.63618 64.6157 9.70753 64.5855 9.76838H64.5854L62.9512 13.0573C62.9344 13.0911 62.8862 13.0912 62.8692 13.0573L61.2021 9.70235C61.187 9.672 61.2091 9.63617 61.2431 9.63617H64.5036Z' fill='%23EA4B4B'/%3e%3cpath d='M62.8284 6.18281C62.862 6.11518 62.9586 6.11518 62.9922 6.18281L64.5855 9.38969C64.6157 9.45054 64.5715 9.52189 64.5036 9.52189H61.2431C61.2091 9.52189 61.187 9.48605 61.2021 9.45571L62.8283 6.18265L62.8284 6.18281Z' fill='%23EA4B4B'/%3e%3cpath d='M62.3131 6.13196C62.381 6.13196 62.4252 6.20331 62.3951 6.26416C62.154 6.74935 61.9128 7.23455 61.6718 7.71975H61.6716C61.4225 8.22125 61.1733 8.72259 60.9242 9.22409C60.9074 9.25799 60.859 9.25799 60.8422 9.22409L60.6305 8.79587C60.6275 8.78957 60.6259 8.78263 60.6259 8.77553V6.22349C60.6259 6.17297 60.6668 6.13196 60.7173 6.13196H62.3131Z' fill='%23EA4B4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M74.8537 10.0096C75.2721 10.0096 75.654 10.1125 75.9993 10.3184C76.3513 10.5177 76.6303 10.8032 76.8361 11.1751C77.0487 11.547 77.1549 11.9953 77.1549 12.52V12.6495C77.1549 13.1675 77.052 13.6158 76.8461 13.9943C76.6402 14.3729 76.3613 14.6618 76.0093 14.861C75.664 15.0603 75.2788 15.1599 74.8537 15.1599C74.515 15.1599 74.2261 15.1134 73.9871 15.0204C73.7546 14.9341 73.5653 14.8212 73.4192 14.6817C73.2731 14.5423 73.1602 14.3995 73.0805 14.2534H72.941V16.9659L72.1541 16.0013V10.1491H72.9211V10.956H73.0352C73.2729 10.6733 73.3893 10.4911 73.6683 10.2985C73.9538 10.1059 74.349 10.0096 74.8537 10.0096ZM74.6445 10.7069C74.1464 10.7069 73.7347 10.8696 73.4092 11.195C73.0905 11.5138 72.9311 11.9621 72.9311 12.5399V12.6296C72.9311 13.2074 73.0905 13.659 73.4092 13.9844C73.7347 14.3032 74.1464 14.4626 74.6445 14.4626C75.1492 14.4626 75.5577 14.3032 75.8698 13.9844C76.1886 13.659 76.348 13.2074 76.348 12.6296V12.5399C76.348 11.9621 76.1886 11.5138 75.8698 11.195C75.5577 10.8696 75.1492 10.7069 74.6445 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M78.5848 11.9583L78.5555 15.4596L77.7681 14.4846V10.9583L78.5848 11.9583Z' fill='%230E0D0B'/%3e%3cpath d='M101.588 10.2986H102.444L103 10.986H101.588V10.9867H100.802L101.588 11.9623V14.1937C101.588 14.3929 101.685 14.4926 101.877 14.4926H102.379L102.928 15.17H101.668C101.389 15.17 101.173 15.0936 101.021 14.9409C100.874 14.7881 100.801 14.5789 100.801 14.3133V10.986H99.8799L99.3217 10.2986H100.801V9.13501H101.588V10.2986Z' fill='%230E0D0B'/%3e%3cpath d='M69.0133 7.90764C69.4848 7.90764 69.9065 7.99068 70.2784 8.15671C70.6569 8.3161 70.9525 8.55517 71.165 8.87395C71.3842 9.18609 71.4938 9.58126 71.4938 10.0594V10.4778H70.667V10.0594C70.667 9.72072 70.5939 9.44842 70.4477 9.24254C70.3083 9.03666 70.1124 8.88392 69.86 8.7843C69.6143 8.68469 69.332 8.63487 69.0133 8.63487C68.555 8.63487 68.1864 8.7378 67.9075 8.94367C67.6286 9.14291 67.4891 9.4285 67.4891 9.80041C67.4891 10.0461 67.5488 10.2453 67.6684 10.3981C67.7879 10.5508 67.9573 10.677 68.1764 10.7767C68.3956 10.8696 68.658 10.9527 68.9635 11.0257L69.4815 11.1552C69.8866 11.2416 70.2485 11.3611 70.5673 11.5138C70.8927 11.6599 71.1517 11.8625 71.3443 12.1215C71.5369 12.3739 71.6332 12.706 71.6332 13.1177C71.6332 13.5295 71.5303 13.8881 71.3244 14.1936C71.1185 14.4991 70.8263 14.7382 70.4477 14.9109C70.0758 15.0769 69.6375 15.1599 69.1328 15.1599C68.6281 15.1599 68.1765 15.0702 67.778 14.8909C67.3795 14.7116 67.0641 14.4426 66.8316 14.084C66.6058 13.7187 66.4929 13.2638 66.4929 12.7192V12.51H67.3197V12.7192C67.3197 13.297 67.4891 13.7287 67.8278 14.0143C68.1665 14.2932 68.6015 14.4327 69.1328 14.4327C69.6774 14.4327 70.0924 14.3098 70.378 14.0641C70.6636 13.8183 70.8064 13.5095 70.8064 13.1376C70.8064 12.8786 70.74 12.6727 70.6072 12.52C70.481 12.3673 70.3017 12.2444 70.0692 12.1514C69.8368 12.0518 69.5645 11.9655 69.2523 11.8924L68.7343 11.7629C68.3292 11.6566 67.9706 11.5271 67.6584 11.3744C67.3463 11.2216 67.1006 11.0224 66.9213 10.7767C66.7486 10.5243 66.6623 10.2022 66.6623 9.81035C66.6623 9.41852 66.7585 9.07981 66.9511 8.79424C67.1504 8.50866 67.426 8.28953 67.778 8.13678C68.1366 7.98404 68.5484 7.90764 69.0133 7.90764Z' fill='%230E0D0B'/%3e%3cpath d='M81.6544 10.0096C82.1193 10.0096 82.5145 10.0959 82.8399 10.2686C83.1719 10.4412 83.431 10.6704 83.6169 10.956C83.8095 11.2415 83.9324 11.5471 83.9855 11.8725L83.2185 12.0318C83.1853 11.7928 83.1056 11.5736 82.9794 11.3744C82.8598 11.1752 82.6905 11.0158 82.4713 10.8962C82.2521 10.7767 81.9832 10.7169 81.6644 10.7169C81.339 10.7169 81.0468 10.7899 80.7877 10.936C80.5354 11.0821 80.3328 11.2914 80.1801 11.5637C80.034 11.836 79.9609 12.1614 79.9609 12.5399V12.6296C79.9609 13.0081 80.034 13.3335 80.1801 13.6058C80.3328 13.8781 80.5354 14.0873 80.7877 14.2334C81.0468 14.3795 81.339 14.4526 81.6644 14.4526C82.1492 14.4526 82.5178 14.3264 82.7702 14.0741C83.0292 13.8217 83.1886 13.5095 83.2483 13.1376L84.0254 13.307C83.9523 13.6257 83.8195 13.9279 83.6269 14.2135C83.4343 14.4991 83.172 14.7282 82.8399 14.9009C82.5145 15.0735 82.1193 15.1599 81.6544 15.1599C81.1829 15.1599 80.7579 15.0603 80.3793 14.861C80.0074 14.6551 79.7119 14.363 79.4927 13.9844C79.2802 13.6059 79.1739 13.1575 79.1739 12.6395V12.5299C79.1739 12.0053 79.2802 11.557 79.4927 11.1851C79.7119 10.8066 80.0074 10.5177 80.3793 10.3184C80.7579 10.1126 81.1829 10.0096 81.6544 10.0096Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M86.7515 10.0096C87.2097 10.0096 87.6149 10.1092 87.9668 10.3084C88.3188 10.501 88.5944 10.78 88.7937 11.1452C88.9929 11.5105 89.0925 11.9389 89.0925 12.4304V12.7889H85.1177C85.1377 13.3136 85.3071 13.7254 85.6258 14.0243C85.9446 14.3165 86.3431 14.4626 86.8212 14.4626C87.2396 14.4626 87.5617 14.3663 87.7875 14.1737C88.0133 13.9811 88.186 13.752 88.3056 13.4863L88.983 13.815C88.8833 14.0209 88.7439 14.2268 88.5646 14.4327C88.3919 14.6386 88.1628 14.8113 87.8772 14.9507C87.5983 15.0902 87.2396 15.1599 86.8013 15.1599C86.3099 15.1599 85.8782 15.057 85.5063 14.8511C85.1344 14.6386 84.8455 14.343 84.6396 13.9645C84.4337 13.5859 84.3307 13.1476 84.3307 12.6495V12.5299C84.3307 12.0252 84.4337 11.5836 84.6396 11.205C84.8455 10.8265 85.1311 10.5342 85.4963 10.3284C85.8616 10.1159 86.28 10.0096 86.7515 10.0096ZM86.7515 10.7069C86.3066 10.7069 85.9413 10.8331 85.6557 11.0855C85.3701 11.3378 85.1941 11.6898 85.1277 12.1414H88.2956C88.269 11.6898 88.113 11.3378 87.8274 11.0855C87.5485 10.8331 87.1898 10.7069 86.7515 10.7069Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M97.1624 10.0096C97.6207 10.0096 98.0258 10.1092 98.3778 10.3084C98.7298 10.501 99.0054 10.78 99.2046 11.1452C99.4039 11.5105 99.5035 11.9389 99.5035 12.4304V12.7889H95.5287C95.5487 13.3136 95.718 13.7254 96.0368 14.0243C96.3555 14.3165 96.754 14.4626 97.2322 14.4626C97.6505 14.4626 97.9727 14.3663 98.1985 14.1737C98.4243 13.9811 98.5969 13.752 98.7165 13.4863L99.3939 13.815C99.2943 14.0209 99.1548 14.2268 98.9755 14.4327C98.8028 14.6386 98.5737 14.8113 98.2881 14.9507C98.0092 15.0902 97.6506 15.1599 97.2123 15.1599C96.7208 15.1599 96.2892 15.057 95.9172 14.8511C95.5453 14.6386 95.2564 14.343 95.0505 13.9645C94.8446 13.5859 94.7417 13.1476 94.7417 12.6495V12.5299C94.7417 12.0252 94.8446 11.5836 95.0505 11.205C95.2564 10.8265 95.542 10.5342 95.9073 10.3284C96.2725 10.1158 96.6909 10.0096 97.1624 10.0096ZM97.1624 10.7069C96.7175 10.7069 96.3522 10.8331 96.0666 11.0855C95.7811 11.3378 95.6051 11.6898 95.5387 12.1414H98.7066C98.68 11.6898 98.5239 11.3378 98.2383 11.0855C97.9594 10.8331 97.6008 10.7069 97.1624 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M92.2484 10.0594C92.6137 10.0594 92.9391 10.1358 93.2247 10.2885C93.5169 10.4413 93.7494 10.6671 93.9221 10.966C94.0947 11.2648 94.1811 11.6334 94.1811 12.0717V15.1458H93.394V12.1315C93.394 11.6467 93.2712 11.2947 93.0255 11.0755C92.7864 10.8564 92.461 10.7468 92.0492 10.7468C91.5777 10.7468 91.1925 10.8995 90.8936 11.205C90.6014 11.5105 90.4553 11.9655 90.4553 12.5698V15.1458H89.6683V10.1491H90.4354V10.9582H90.5361C90.7355 10.7018 90.8604 10.5342 91.1128 10.3483C91.3718 10.1557 91.7503 10.0594 92.2484 10.0594Z' fill='%230E0D0B'/%3e%3cpath d='M78.5932 10.9581H77.7681V10.1514H78.6L78.5932 10.9581Z' fill='%230E0D0B'/%3e%3c/svg%3e";const xt=({isOpen:t,onClose:o,title:r,subtitle:n,children:s,overlayContent:c,styles:i,theme:d,maxWidth:g="522px"})=>{const f=d||de.createTheme("light");return t?e.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:50},children:e.jsxs("div",{style:{border:"6px solid #E9E9E9",backgroundColor:"white",borderRadius:"12px",width:"100%",padding:"0",display:"flex",flexDirection:"column",maxWidth:g,position:"relative",overflow:"hidden"},children:[c&&e.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:5,pointerEvents:"none",borderRadius:"12px"}}),e.jsxs("div",{style:{padding:"24px 24px 16px 24px",borderBottom:"1px solid #cdcfd1",position:"relative"},children:[e.jsx("button",{onClick:o,style:{position:"absolute",top:"16px",right:"16px",color:"#111827",padding:"8px",backgroundColor:"transparent",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",fontSize:"20px",fontWeight:"600"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("h2",{style:{fontSize:"23px",fontWeight:"600",color:"#111827",margin:"0",fontFamily:i?.fontFamily||f.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:r})]}),n&&e.jsx("div",{style:{padding:"16px 24px 0px 24px",fontSize:"12px",color:"#6b7280",margin:"0 0 2rem 0",lineHeight:"1.4",fontFamily:i?.fontFamily||f.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:n}),s,e.jsxs("div",{style:{padding:"0px 28px 8px 28px",margin:0,marginTop:"10px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("img",{src:xs,alt:"Powered by SpiceNet",style:{height:"auto",width:"auto",opacity:1,margin:0,display:"block"}}),e.jsxs("a",{href:"https://spicenet.io/accounts",target:"_blank",rel:"noopener noreferrer",style:{fontSize:"10px",color:"#51514f",textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",fontFamily:i?.fontFamily||f.typography.fontFamily,lineHeight:"1"},children:[e.jsx("span",{children:"Learn more about"}),e.jsx("span",{style:{color:i?.primaryColor||f.colors.primary,textDecoration:"underline",fontWeight:"500"},children:"Spicenet accounts \u2192"})]})]}),c]})}):null};var Pt="data:image/svg+xml,%3csvg width='15' height='15' viewBox='0 0 15 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 7.49993V10.4999M7.5 4.96868V4.96784M14.25 7.5C14.25 11.2279 11.2279 14.25 7.5 14.25C3.77208 14.25 0.75 11.2279 0.75 7.5C0.75 3.77208 3.77208 0.75 7.5 0.75C11.2279 0.75 14.25 3.77208 14.25 7.5Z' stroke='%23ED6969' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const wo=({isOpen:t,onClose:o,title:r="Deposit",maxWidth:n="480px",depositBatches:s,tokenAddress:c,tokenDecimals:i,supportedChains:d,supportedTokens:g,theme:f="light",styles:u,className:l,depositInputHook:C,onDepositSuccess:A,onDepositError:w})=>{const k=de.createTheme(f),p=b=>{A?.(b)};return e.jsx(xt,{isOpen:t,onClose:o,title:r,subtitle:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e.jsx("img",{src:Pt,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e.jsx("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Use your cross-chain balance to deposit WBTC to earn 6.3% yield, all in one click."})]}),styles:u,theme:k,maxWidth:n,children:e.jsx("div",{style:{padding:"0 24px 24px 24px"},children:e.jsx(gs,{depositBatches:s,tokenAddress:c,tokenDecimals:i,supportedChains:d,supportedTokens:g,theme:f,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,depositInputHook:C,onDepositSuccess:p,onDepositError:w})})})},So=({asset:t,amount:o,onAmountChange:r,onPercentageClick:n,usdValue:s,disabled:c,styles:i,theme:d})=>{const g=t.balanceFormatted??0,f=parseFloat(o)||0,u=g>0?f/g*100:0,[l,C]=a.useState(null),[A,w]=a.useState(null),k=p=>{const b=p.target.value;(b===""||/^\d*\.?\d*$/.test(b))&&r(b)};return e.jsx("div",{style:{backgroundColor:"#e9e9e9",border:"0.5px solid #A8A8A7",borderRadius:"6px",padding:"16px",height:"144px",display:"flex",flexDirection:"column",gap:"8px",position:"relative"},children:e.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"100%"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("span",{style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#7d7c7b",lineHeight:"24px"},children:"Amount"}),e.jsx("input",{type:"text",value:o,onChange:k,placeholder:"0.00",disabled:c,style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"40px",fontWeight:700,color:c?"rgba(14, 13, 11, 0.16)":o?"#0e0d0b":"#d1d5db",lineHeight:"1.08",letterSpacing:"-1.2px",backgroundColor:"transparent",border:"none",outline:"none",padding:0,width:"100%",maxWidth:"200px"}})]})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"space-between",height:"100%",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"},children:[e.jsxs("span",{style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"12px",fontWeight:500,color:"#71757a",lineHeight:"16px"},children:["Balance: ",g.toFixed(4)]}),e.jsx("div",{style:{width:"128px"},children:e.jsxs("div",{style:{border:"1px solid #CDCFD1",borderRadius:"6px 6px 6px 6px",backgroundColor:"transparent",padding:"8px 12px 8px 8px",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(ot,{symbol:t.symbol,logoURI:t.logoURI,size:30,theme:d}),e.jsx("span",{style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#3c3e42",lineHeight:"1.5"},children:t.symbol})]})})]}),e.jsx("div",{style:{display:"flex",gap:"10px",height:"14px",alignItems:"center",justifyContent:"flex-end"},children:[0,25,50,75,100].map((p,b)=>{const m=Math.abs(u-p)<1,j=b===4,y=p/100,h=l===p,x=A===p;return e.jsx("button",{onClick:()=>n(p),onMouseEnter:()=>C(p),onMouseLeave:()=>{C(null),w(null)},onMouseDown:()=>w(p),onMouseUp:()=>w(null),disabled:c,title:`${p}%`,style:{width:"14px",height:"14px",padding:0,border:"none",backgroundColor:"transparent",cursor:c?"not-allowed":"pointer",opacity:m?1:h?.8:.5,transform:x?"scale(0.85)":h?"scale(1.15)":"scale(1)",transition:"all 0.15s ease"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:[e.jsx("circle",{cx:"7",cy:"7",r:"6.84375",fill:j?"#ea4b4b":"none",stroke:j?"#ea4b4b":"#3C3E42",strokeWidth:"0.3125"}),!j&&y>0&&e.jsx("path",{d:`M 7 7 L 7 0.15625 A 6.84375 6.84375 0 ${y>.5?1:0} 1 ${7+6.84375*Math.sin(y*2*Math.PI)} ${7-6.84375*Math.cos(y*2*Math.PI)} Z`,fill:"#3C3E42"})]})},p)})})]})]})})};var ko="data:image/svg+xml,%3csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.83337 11.0833C8.73287 11.0833 11.0834 8.73275 11.0834 5.83325C11.0834 2.93376 8.73287 0.583252 5.83337 0.583252C2.93388 0.583252 0.583374 2.93376 0.583374 5.83325C0.583374 8.73275 2.93388 11.0833 5.83337 11.0833Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.84329 4.48988C5.18981 4.14336 5.36306 3.97011 5.56285 3.90519C5.73859 3.84809 5.92789 3.84809 6.10363 3.90519C6.30342 3.97011 6.47668 4.14336 6.82319 4.48988L7.17663 4.84331C7.52314 5.18983 7.6964 5.36308 7.76131 5.56287C7.81841 5.73861 7.81841 5.92791 7.76131 6.10365C7.6964 6.30344 7.52314 6.4767 7.17663 6.82321L6.82319 7.17665C6.47668 7.52316 6.30342 7.69642 6.10363 7.76133C5.92789 7.81843 5.73859 7.81843 5.56285 7.76133C5.36306 7.69642 5.18981 7.52316 4.84329 7.17665L4.48986 6.82321C4.14334 6.4767 3.97009 6.30344 3.90517 6.10365C3.84807 5.92791 3.84807 5.73861 3.90517 5.56287C3.97009 5.36308 4.14334 5.18983 4.48986 4.84331L4.84329 4.48988Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const Io=({isOpen:t,onClose:o,onComplete:r,title:n="Deposit to Spicenet",description:s="Select tokens and enter amounts to deposit to your Spicenet Account",chainId:c,embeddedWalletAddress:i,externalWalletAddress:d,escrowAddress:g="0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",getChainConfig:f,getSupportedTokens:u})=>{const l=de.createTheme("light"),[C,A]=a.useState(new Map),[w,k]=a.useState(!1),[p,b]=a.useState(null),[m,j]=a.useState([]),[y,h]=a.useState(!1),[x,S]=a.useState(null),[F,B]=a.useState(null),[I,G]=a.useState(!1),[P,_]=a.useState(!1),{chain:$}=Ae.useAccount(),{data:J,isLoading:M}=Ae.useWalletClient(),{switchChainAsync:z}=Ae.useSwitchChain(),E=a.useMemo(()=>u(c),[c,u]),{data:U}=Ae.useReadContracts({contracts:E.map(v=>({address:v.address,abi:re.erc20Abi,functionName:"balanceOf",args:[d],chainId:c}))}),X=a.useMemo(()=>{if(!f(c))return[];const v=[];return E.forEach((N,O)=>{const se=U?.[O],ae=se?.status==="success"?se.result:BigInt(0),Z=Number(ae)/Math.pow(10,N.decimals);v.push({address:N.address,symbol:N.symbol,name:N.name,decimals:N.decimals,isNative:!1,chainId:c,balance:ae,balanceFormatted:Z})}),v},[c,U,E,f]);a.useEffect(()=>{if(X.length>0&&C.size>0){const v=new Map(C);let N=!1;C.forEach((O,se)=>{const ae=X.find(Z=>Z.address===se);ae&&ae.balanceFormatted!==O.asset.balanceFormatted&&(v.set(se,{...O,asset:ae}),N=!0)}),N&&A(v)}},[X,C]);const ee=f(c),H=v=>{const N=new Map(C);N.has(v.address)?N.delete(v.address):N.set(v.address,{asset:v,amount:""}),A(N),b(null)},ne=(v,N)=>{if(N===""||/^\d*\.?\d*$/.test(N)){const O=new Map(C),se=O.get(v);se&&(O.set(v,{...se,amount:N}),A(O),b(null))}},xe=(v,N)=>{const O=C.get(v);if(O?.asset.balanceFormatted!==void 0){const se=O.asset.balanceFormatted*N/100;ne(v,se.toString())}},ue=a.useCallback(async()=>{if(C.size===0){b("Please select at least one asset");return}for(const[N,O]of Array.from(C.entries())){if(!O.amount){b(`Please enter an amount for ${O.asset.symbol}`);return}const se=parseFloat(O.amount);if(isNaN(se)||se<=0){b(`Please enter a valid amount for ${O.asset.symbol}`);return}const ae=X.find(Z=>Z.address===N)?.balanceFormatted??O.asset.balanceFormatted;if(ae!==void 0&&se>ae){b(`Insufficient ${O.asset.symbol} balance`);return}}if(!J){b("Wallet not connected. Please reconnect your external wallet.");return}k(!0),b(null);const v=[];try{$?.id!==c&&await z({chainId:c});for(const[,N]of Array.from(C.entries())){const{asset:O,amount:se}=N;try{const ae=re.parseUnits(se,O.decimals);let Z;if(O.isNative)Z=await J.sendTransaction({to:g,value:ae});else{const T=re.encodeFunctionData({abi:re.erc20Abi,functionName:"transfer",args:[g,ae]});Z=await J.sendTransaction({to:O.address,data:T})}const he=Ve(c),Ce=await he.waitForTransactionReceipt({hash:Z,timeout:12e4,pollingInterval:2e3,confirmations:2});if(Ce.status!=="success")throw new Error(`Transfer to escrow failed for ${O.symbol}`);await he.getBlockNumber()-Ce.blockNumber<2&&await new Promise(T=>setTimeout(T,3e3)),await we.submitSpiceDeposit({txHash:Z,sender:i,tokenAddress:O.address,chainId:c,amount:re.parseUnits(se,O.decimals).toString(),user:i,isDeposit:!0}),v.push({asset:O,txHash:Z,success:!0})}catch(ae){const Z=ae;let he=Z?.message||"Deposit failed";Z?.code===4001||Z?.message?.includes("rejected")?he="Transaction rejected by user":Z?.message?.includes("insufficient funds")&&(he="Insufficient funds for transaction"),v.push({asset:O,txHash:"",success:!1,error:he})}}j(v),h(!0)}catch(N){b(N?.message||"Deposit failed")}finally{k(!1)}},[C,J,$,c,z,g,X]);a.useEffect(()=>{t||(A(new Map),b(null),j([]),h(!1),k(!1))},[t]);const Ee=a.useCallback(()=>{j([]),h(!1),b(null)},[]),R=C.size>0&&Array.from(C.values()).every(v=>v.amount&&parseFloat(v.amount)>0)&&!w&&!y&&J,q=e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e.jsx("img",{src:Pt,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e.jsx("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:s})]}),pe=w||y&&m.length>0?e.jsx(qt,{type:"deposit",isOpen:y&&m.length>0,isProcessing:w,onClose:o,onComplete:r,onRetryTx:Ee,onNewTx:()=>{},results:m.length>0?m.map(v=>({asset:{symbol:v.asset.symbol,address:v.asset.address},txHash:v.txHash,success:v.success,error:v.error})):void 0,chainName:st(c),explorerUrl:ee?.blockExplorers?.default?.url,theme:l}):null;return e.jsx(xt,{isOpen:t,onClose:o,title:n,subtitle:q,theme:l,maxWidth:"480px",children:e.jsxs("div",{style:{padding:"0 24px 32px 24px",position:"relative"},children:[pe&&e.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none"},children:e.jsx("div",{style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto"},children:pe})}),e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:[e.jsx("span",{style:{fontSize:"14px",color:"#6b7280"},children:e.jsx("img",{src:ko,alt:"Info",style:{width:"10.5px",height:"10.5px",top:"1.75px",left:"1.75px",flexShrink:0}})}),e.jsx("label",{style:{fontSize:"12px",fontWeight:590,color:"#374151"},children:"Select Assets to Deposit"})]}),e.jsx("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:X.map(v=>{const N=C.has(v.address);return e.jsx("button",{onClick:()=>H(v),onMouseEnter:()=>S(v.address),onMouseLeave:()=>{S(null),B(null)},onMouseDown:()=>B(v.address),onMouseUp:()=>B(null),style:{padding:"4px 8px 4px 8px",borderRadius:"8px",border:`1px solid ${N?"#EA4B4B7A":x===v.address?"#F4A5A5":"#e5e7eb"}`,backgroundColor:N?"#FEF2F2":F===v.address?"#f5f5f5":x===v.address?"#fafafa":"white",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",transition:"all 150ms ease",transform:F===v.address?"scale(0.96)":x===v.address?"translateY(-1px)":"none",boxShadow:N?"0 0 0 3px #FBDBDB":F===v.address?"0 1px 2px rgba(0, 0, 0, 0.05)":x===v.address?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(ot,{symbol:v.symbol,size:24,theme:l}),e.jsx("span",{style:{fontSize:"16px",fontWeight:510,color:"#3C3E42"},children:v.symbol}),v.balanceFormatted!==void 0&&e.jsxs("span",{style:{fontSize:"10px",fontWeight:500,color:"#939291",fontFamily:'"IBM Plex Mono", monospace'},children:["(",v.balanceFormatted.toFixed(4),")"]})]})},v.address)})})]}),C.size>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:Array.from(C.values()).map(({asset:v,amount:N})=>e.jsx(So,{asset:v,amount:N,onAmountChange:O=>ne(v.address,O),onPercentageClick:O=>xe(v.address,O),theme:l,disabled:w},v.address))}),p&&e.jsx("div",{style:{padding:"12px",backgroundColor:"#fef2f2",border:"1px solid #fecaca",borderRadius:"8px",marginTop:"16px"},children:e.jsx("p",{style:{fontSize:"14px",color:"#dc2626",margin:0},children:p})}),!y&&e.jsx(de.Button,{variant:"outline",fullWidth:!0,onClick:ue,onMouseEnter:()=>G(!0),onMouseLeave:()=>{G(!1),_(!1)},onMouseDown:()=>_(!0),onMouseUp:()=>_(!1),disabled:!R,theme:l,style:{width:"100%",padding:"8px ",backgroundColor:R?P?"#d43d3d":I?"#f05555":"#ea4b4b":"#d1d5db",color:R?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:R?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:R?P?"scale(0.98)":I?"translateY(-2px)":"none":"none",boxShadow:P?"1px 1px 0px black":I&&R?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:w?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"18px",height:"18px",border:"2px solid white",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("span",{children:"PROCESSING..."})]}):M?"CONNECTING WALLET...":J?C.size===0?"SELECT ASSETS":Array.from(C.values()).every(v=>v.amount)?"DEPOSIT":"ENTER AMOUNTS":"WALLET NOT CONNECTED"}),e.jsx("style",{children:`
|
|
38
|
+
`})]})},gs=({depositBatches:t,tokenAddress:o,tokenDecimals:r,supportedChains:n,supportedTokens:s,theme:c="light",styles:i,className:d="",depositInputHook:g,onDepositSuccess:f,onDepositError:u,onTopUp:l})=>{const C=de.createTheme(c),A={...C,typography:{...C.typography,fontFamily:i?.fontFamily||C.typography.fontFamily},colors:{...C.colors,primary:i?.primaryColor||C.colors.primary,primaryHover:i?.primaryColor?`${i.primaryColor}dd`:C.colors.primaryHover}},w=Lt(),{isReady:k,isAuthenticated:p,isConnected:b,address:m,provider:j,actions:y}=w,[h,x]=a.useState(null),{assets:S,loading:F,error:B,hasBalance:I,refetch:G}=us({address:m,supportedChains:n,enabled:b,refetchInterval:3e4}),[P,_]=a.useState(!1),[$,J]=a.useState(null),[M,z]=a.useState(!1),[E,U]=a.useState(!1),[X,ee]=a.useState(!1),H=a.useRef(null),{intentStatus:ne,startStatusPolling:xe,clearStatus:ue}=kt({checkStepStatus:(Z,he)=>we.checkStepStatus(Z,he)});a.useEffect(()=>{if(ne?.overallStatus==="success"&&ne.intentId&&H.current!==ne.intentId&&h&&m){const Z=ne.steps.find(he=>he.transactionHash);if(Z?.transactionHash){H.current=ne.intentId;const he=re.parseUnits(h.amount,h.asset.decimals);we.submitSpiceDeposit({user:m,txHash:Z.transactionHash,sender:m,tokenAddress:h.asset.address,chainId:h.asset.chainId,amount:he.toString(),isDeposit:!1}).then(()=>{G()}).catch(()=>{H.current=null})}}},[ne,m]),a.useEffect(()=>{g&&g.assetAmount!==h?.amount&&h&&x({...h,amount:g.assetAmount})},[g?.assetAmount,h]);const Ee=a.useCallback(()=>{J(null)},[]),R=Z=>{x({asset:Z,amount:h?.amount||""}),Ee()},q=a.useCallback(Z=>{h&&(a.startTransition(()=>{x({...h,amount:Z}),Ee()}),g&&g.setAssetAmount(Z))},[h,g,Ee]),pe=async()=>{if(!(!h||!m||t.length===0)){if(!k||!p){J(`Please authenticate with ${j||"wallet provider"} to continue`);return}_(!0),J(null),ee(!0);try{const Z=[...t],he=[...new Set(Z.map(ce=>ce.chainId))],Ce=[];for(const ce of he){const ze=Ve(ce),W=ct(ce),K=await Ye.getAccountNonce(m,ze),ie=await y.signAuthorization({contractAddress:W,chainId:ce,nonce:Number(K)});Ce.push(ie)}const T=Ye.hashChainBatches(Z),oe=Math.floor(Date.now()/1e3)+60*10,le=Ye.getIntentHash(0n,BigInt(oe),T),Se=await y.signMessage({raw:le}),ve=typeof Se=="string"?Se:Se.signature;if(!ve)throw new Error("Failed to sign intent authorization");const ke={mode:"7702",signatureType:"ecdsa",signature:ve,nbf:0,exp:oe,chainBatches:T.map(ce=>({hash:ce.hash,chainId:ce.chainId,tokenTransfers:[{from:"solver",to:m,token:"0x0000000000000000000000000000000000000000",amount:re.parseUnits("0.01",18)},{from:"solver",to:m,token:o,amount:re.parseUnits(h.amount,r)}],calls:ce.calls}))},Ie=await we.createAction({user:m,chainAuthorizations:Ce.map(ce=>({...ce,r:ce.r,s:ce.s,yParity:ce.yParity,address:ce.address,chainId:Number(ce.chainId),nonce:Number(ce.nonce)})),intents:[ke]});if(Ie){const ce=Et(Z,ie=>`Chain ${ie}`),[ze,W]=Ie.intentIds[0].split("/"),K=parseInt(W||"0",10);xe(Ie.intentIds[0],ce);for(let ie=0;ie<Z.length;ie++)await we.executeStep(ze,K,ie,{action:"execute"})}}catch(Z){const he=Z instanceof Error?Z.message:"Deposit failed";J(he),u?.(he)}finally{_(!1)}}},v=a.useMemo(()=>s&&s.length>0?S.filter(Z=>s.some(he=>he.toLowerCase()===Z.symbol.toLowerCase())):S,[S,s]),N=h&&h.amount&&parseFloat(h.amount)>0&&parseFloat(h.amount)<=h.asset.balanceFormatted&&b&&!P&&t.length>0,O=B||$,se={backgroundColor:i?.container?.backgroundColor||i?.primaryBackground||A.colors.background,border:`1px solid ${i?.container?.borderColor||A.colors.border}`,borderRadius:i?.container?.borderRadius||A.borderRadius.lg,padding:i?.container?.padding||A.spacing.md,width:i?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:A.colors.text,fontFamily:A.typography.fontFamily,boxShadow:i?.container?.boxShadow||(A.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},ae=ne?e.jsx(qt,{type:"deposit",isOpen:!!ne&&ne.overallStatus!=="processing",isProcessing:P||ne?.overallStatus==="processing",onRetryTx:()=>{ue(),ee(!1),pe()},onNewTx:()=>{ue(),ee(!1),x(null),H.current=null,G()},onClose:()=>{ue(),ee(!1)},onComplete:()=>{ue(),ee(!1),x(null),H.current=null,G()},results:ne?.overallStatus==="success"||ne?.overallStatus==="failed"?ne.steps.map(Z=>({asset:{symbol:h?.asset.symbol||"Token",address:h?.asset.address||""},txHash:Z.transactionHash||"",success:Z.status==="success",amount:h?.amount})):void 0,chainName:h?st(t[t.length-1].chainId):"Network",explorerUrl:h?Wt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:A}):null;return e.jsxs("div",{style:{...se,position:"relative"},className:d,children:[ae&&e.jsx("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:ae})}),!F&&!I&&e.jsx("div",{style:{backgroundColor:A.mode==="light"?"#fef3c7":`${A.colors.warning||"#f59e0b"}20`,border:`1px solid ${A.mode==="light"?"#fcd34d":A.colors.warning||"#f59e0b"}`,borderRadius:A.borderRadius.md,padding:A.spacing.md,marginBottom:A.spacing.md,textAlign:"center"},children:e.jsxs("p",{style:{color:A.mode==="light"?"#92400e":"#fbbf24",fontSize:A.typography.fontSize.sm,fontFamily:A.typography.fontFamily,margin:0,lineHeight:1.5},children:["You do not have any cross-chain balance."," ",l&&e.jsx("span",{onClick:l,style:{color:A.colors.primary,textDecoration:"underline",cursor:"pointer",fontWeight:600},children:"Top-up here."})]})}),e.jsx("div",{style:{marginBottom:A.spacing.sm},children:e.jsx(ht,{assets:v,selectedAsset:h||void 0,onAssetSelect:R,onAmountChange:q,loading:F,label:"Amount",showBalance:!0,showMaxButton:!0,theme:A,styles:i})}),O&&e.jsx("div",{style:{backgroundColor:i?.errorMessage?.backgroundColor||(A.mode==="light"?"#fef2f2":`${i?.statusDisplay?.errorColor||A.colors.error}20`),border:`1px solid ${i?.errorMessage?.borderColor||(A.mode==="light"?"#fecaca":i?.statusDisplay?.errorColor||A.colors.error)}`,borderRadius:i?.errorMessage?.borderRadius||A.borderRadius.md,padding:i?.errorMessage?.padding||A.spacing.md,marginBottom:A.spacing.sm},children:e.jsx("p",{style:{color:i?.errorMessage?.color||i?.statusDisplay?.errorColor||A.colors.error,fontSize:i?.errorMessage?.fontSize||A.typography.fontSize.sm,fontWeight:i?.errorMessage?.fontWeight,fontFamily:i?.errorMessage?.fontFamily||A.typography.fontFamily,margin:0},children:O})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:A.spacing.sm},children:e.jsx(de.Button,{variant:"outline",fullWidth:!0,onClick:pe,onMouseEnter:()=>z(!0),onMouseLeave:()=>{z(!1),U(!1)},onMouseDown:()=>U(!0),onMouseUp:()=>U(!1),loading:P,disabled:!N||!b,theme:A,styles:i,style:{width:"100%",padding:"8px",backgroundColor:N?E?"#d43d3d":M?"#f05555":"#ea4b4b":"#d1d5db",color:N?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:N?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:N?E?"scale(0.98)":M?"translateY(-2px)":"none":"none",boxShadow:E?"1px 1px 0px black":M&&N?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:k?p?b?P?"Executing Deposit...":h?h.amount?parseFloat(h.amount)>h.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Deposit Batches":"Execute Deposit":"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})};var xs="data:image/svg+xml,%3csvg width='108' height='22' viewBox='0 0 108 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1.9916 11.9854V11.2041H3.98379C4.48835 11.2041 4.87897 11.0739 5.15566 10.8135C5.43236 10.5498 5.5707 10.1868 5.5707 9.72461V9.71484C5.5707 9.24935 5.43236 8.88639 5.15566 8.62598C4.87897 8.36556 4.48835 8.23535 3.98379 8.23535H1.9916V7.4541H4.2084C4.65111 7.4541 5.04173 7.5485 5.38027 7.7373C5.71882 7.92611 5.98411 8.18978 6.17617 8.52832C6.37148 8.86686 6.46914 9.25911 6.46914 9.70508V9.71484C6.46914 10.1608 6.37148 10.5547 6.17617 10.8965C5.98411 11.2383 5.71882 11.5052 5.38027 11.6973C5.04173 11.8893 4.65111 11.9854 4.2084 11.9854H1.9916ZM1.55215 14.5V7.4541H2.43106V14.5H1.55215ZM9.51875 14.5928C9.0207 14.5928 8.58939 14.4837 8.2248 14.2656C7.86348 14.0443 7.58353 13.7301 7.38496 13.3232C7.18965 12.9163 7.09199 12.4329 7.09199 11.873V11.8633C7.09199 11.3001 7.18965 10.8151 7.38496 10.4082C7.58353 10.0013 7.86348 9.6888 8.2248 9.4707C8.58939 9.2526 9.0207 9.14355 9.51875 9.14355C10.0201 9.14355 10.4514 9.2526 10.8127 9.4707C11.174 9.6888 11.4523 10.0013 11.6477 10.4082C11.8462 10.8151 11.9455 11.3001 11.9455 11.8633V11.873C11.9455 12.4329 11.8462 12.9163 11.6477 13.3232C11.4523 13.7301 11.174 14.0443 10.8127 14.2656C10.4514 14.4837 10.0201 14.5928 9.51875 14.5928ZM9.51875 13.8408C9.85078 13.8408 10.1324 13.7627 10.3635 13.6064C10.5946 13.4502 10.7704 13.2256 10.8908 12.9326C11.0145 12.6396 11.0764 12.2865 11.0764 11.873V11.8633C11.0764 11.4466 11.0145 11.0918 10.8908 10.7988C10.7704 10.5059 10.5946 10.2829 10.3635 10.1299C10.1324 9.97363 9.85078 9.89551 9.51875 9.89551C9.18672 9.89551 8.90514 9.97363 8.67402 10.1299C8.4429 10.2829 8.26549 10.5059 8.1418 10.7988C8.02135 11.0918 7.96113 11.4466 7.96113 11.8633V11.873C7.96113 12.2865 8.02135 12.6396 8.1418 12.9326C8.26549 13.2256 8.4429 13.4502 8.67402 13.6064C8.90514 13.7627 9.18672 13.8408 9.51875 13.8408ZM13.7842 14.5L12.3096 9.23633H13.1592L14.1943 13.4453H14.2725L15.4492 9.23633H16.2549L17.4316 13.4453H17.5098L18.5449 9.23633H19.3896L17.915 14.5H17.0605L15.8838 10.4277H15.8057L14.6338 14.5H13.7842ZM22.1658 14.5928C21.6645 14.5928 21.2332 14.4821 20.8719 14.2607C20.5138 14.0394 20.2371 13.7269 20.0418 13.3232C19.8497 12.9163 19.7537 12.4378 19.7537 11.8877V11.8828C19.7537 11.3392 19.8497 10.8623 20.0418 10.4521C20.2371 10.042 20.5122 9.72135 20.867 9.49023C21.2218 9.25911 21.6368 9.14355 22.1121 9.14355C22.5906 9.14355 23.0008 9.25423 23.3426 9.47559C23.6876 9.69694 23.9513 10.0062 24.1336 10.4033C24.3191 10.7972 24.4119 11.2562 24.4119 11.7803V12.1123H20.1932V11.4336H23.9773L23.5574 12.0537V11.7168C23.5574 11.3034 23.4956 10.9632 23.3719 10.6963C23.2482 10.4294 23.0773 10.2308 22.8592 10.1006C22.6411 9.96712 22.3904 9.90039 22.1072 9.90039C21.824 9.90039 21.5701 9.97038 21.3455 10.1104C21.1242 10.2471 20.9484 10.4505 20.8182 10.7207C20.688 10.9909 20.6229 11.3229 20.6229 11.7168V12.0537C20.6229 12.4281 20.6863 12.7487 20.8133 13.0156C20.9402 13.2793 21.1209 13.4827 21.3553 13.626C21.5896 13.766 21.8663 13.8359 22.1854 13.8359C22.423 13.8359 22.6297 13.8034 22.8055 13.7383C22.9813 13.6732 23.1261 13.5902 23.24 13.4893C23.354 13.3883 23.4337 13.2858 23.4793 13.1816L23.4988 13.1377H24.3484L24.3387 13.1768C24.2931 13.3558 24.2117 13.5299 24.0945 13.6992C23.9806 13.8652 23.8325 14.0166 23.6502 14.1533C23.4679 14.2868 23.2514 14.3942 23.0008 14.4756C22.7534 14.5537 22.4751 14.5928 22.1658 14.5928ZM25.4303 14.5V9.23633H26.2799V10.0176H26.358C26.4589 9.74089 26.6298 9.52604 26.8707 9.37305C27.1116 9.22005 27.4094 9.14355 27.7643 9.14355C27.8456 9.14355 27.9254 9.14844 28.0035 9.1582C28.0849 9.16471 28.1467 9.17122 28.1891 9.17773V10.0029C28.1012 9.98665 28.0149 9.97526 27.9303 9.96875C27.8489 9.95898 27.761 9.9541 27.6666 9.9541C27.3964 9.9541 27.1572 10.0078 26.9488 10.1152C26.7405 10.2227 26.5761 10.3724 26.4557 10.5645C26.3385 10.7565 26.2799 10.9811 26.2799 11.2383V14.5H25.4303ZM30.9408 14.5928C30.4395 14.5928 30.0082 14.4821 29.6469 14.2607C29.2888 14.0394 29.0121 13.7269 28.8168 13.3232C28.6247 12.9163 28.5287 12.4378 28.5287 11.8877V11.8828C28.5287 11.3392 28.6247 10.8623 28.8168 10.4521C29.0121 10.042 29.2872 9.72135 29.642 9.49023C29.9968 9.25911 30.4118 9.14355 30.8871 9.14355C31.3656 9.14355 31.7758 9.25423 32.1176 9.47559C32.4626 9.69694 32.7263 10.0062 32.9086 10.4033C33.0941 10.7972 33.1869 11.2562 33.1869 11.7803V12.1123H28.9682V11.4336H32.7523L32.3324 12.0537V11.7168C32.3324 11.3034 32.2706 10.9632 32.1469 10.6963C32.0232 10.4294 31.8523 10.2308 31.6342 10.1006C31.4161 9.96712 31.1654 9.90039 30.8822 9.90039C30.599 9.90039 30.3451 9.97038 30.1205 10.1104C29.8992 10.2471 29.7234 10.4505 29.5932 10.7207C29.463 10.9909 29.3979 11.3229 29.3979 11.7168V12.0537C29.3979 12.4281 29.4613 12.7487 29.5883 13.0156C29.7152 13.2793 29.8959 13.4827 30.1303 13.626C30.3646 13.766 30.6413 13.8359 30.9604 13.8359C31.198 13.8359 31.4047 13.8034 31.5805 13.7383C31.7563 13.6732 31.9011 13.5902 32.015 13.4893C32.129 13.3883 32.2087 13.2858 32.2543 13.1816L32.2738 13.1377H33.1234L33.1137 13.1768C33.0681 13.3558 32.9867 13.5299 32.8695 13.6992C32.7556 13.8652 32.6075 14.0166 32.4252 14.1533C32.2429 14.2868 32.0264 14.3942 31.7758 14.4756C31.5284 14.5537 31.2501 14.5928 30.9408 14.5928ZM36.1486 14.5928C35.7059 14.5928 35.3186 14.4805 34.9865 14.2559C34.6545 14.0312 34.3973 13.7155 34.215 13.3086C34.0328 12.8984 33.9416 12.4199 33.9416 11.873V11.8633C33.9416 11.3132 34.0328 10.8346 34.215 10.4277C34.3973 10.0208 34.6529 9.70508 34.9816 9.48047C35.3137 9.25586 35.7027 9.14355 36.1486 9.14355C36.3895 9.14355 36.6158 9.18262 36.8273 9.26074C37.0422 9.33561 37.2326 9.44141 37.3986 9.57812C37.5647 9.71484 37.6949 9.8776 37.7893 10.0664H37.8674V7.14648H38.717V14.5H37.8674V13.6602H37.7893C37.6818 13.8555 37.5467 14.0231 37.384 14.1631C37.2212 14.2998 37.0357 14.4056 36.8273 14.4805C36.619 14.5553 36.3928 14.5928 36.1486 14.5928ZM36.3439 13.8408C36.663 13.8408 36.938 13.7611 37.1691 13.6016C37.4003 13.4421 37.5777 13.2158 37.7014 12.9229C37.8251 12.6266 37.8869 12.2767 37.8869 11.873V11.8633C37.8869 11.4564 37.8251 11.1064 37.7014 10.8135C37.5777 10.5205 37.4003 10.2943 37.1691 10.1348C36.938 9.97526 36.663 9.89551 36.3439 9.89551C36.0249 9.89551 35.7499 9.97526 35.5188 10.1348C35.2909 10.291 35.1151 10.5156 34.9914 10.8086C34.871 11.1016 34.8107 11.4531 34.8107 11.8633V11.873C34.8107 12.2799 34.871 12.6315 34.9914 12.9277C35.1151 13.2207 35.2909 13.4469 35.5188 13.6064C35.7499 13.7627 36.0249 13.8408 36.3439 13.8408ZM45.1775 14.5928C44.9334 14.5928 44.7072 14.5553 44.4988 14.4805C44.2905 14.4056 44.1049 14.2998 43.9422 14.1631C43.7794 14.0231 43.6443 13.8555 43.5369 13.6602H43.4588V14.5H42.6092V7.14648H43.4588V10.0664H43.5369C43.6346 9.8776 43.7648 9.71484 43.9275 9.57812C44.0936 9.44141 44.2824 9.33561 44.4939 9.26074C44.7088 9.18262 44.9367 9.14355 45.1775 9.14355C45.6235 9.14355 46.0109 9.25586 46.3396 9.48047C46.6717 9.70508 46.9288 10.0208 47.1111 10.4277C47.2934 10.8346 47.3846 11.3132 47.3846 11.8633V11.873C47.3846 12.4199 47.2934 12.8984 47.1111 13.3086C46.9288 13.7155 46.6717 14.0312 46.3396 14.2559C46.0109 14.4805 45.6235 14.5928 45.1775 14.5928ZM44.9822 13.8408C45.3045 13.8408 45.5796 13.7627 45.8074 13.6064C46.0353 13.4469 46.2094 13.2207 46.3299 12.9277C46.4536 12.6315 46.5154 12.2799 46.5154 11.873V11.8633C46.5154 11.4531 46.4536 11.1016 46.3299 10.8086C46.2094 10.5156 46.0353 10.291 45.8074 10.1348C45.5796 9.97526 45.3045 9.89551 44.9822 9.89551C44.6632 9.89551 44.3881 9.97526 44.157 10.1348C43.9259 10.2943 43.7485 10.5205 43.6248 10.8135C43.5011 11.1064 43.4393 11.4564 43.4393 11.8633V11.873C43.4393 12.2767 43.5011 12.6266 43.6248 12.9229C43.7485 13.2158 43.9259 13.4421 44.157 13.6016C44.3881 13.7611 44.6632 13.8408 44.9822 13.8408ZM48.6568 16.3457C48.6015 16.3457 48.5396 16.3424 48.4713 16.3359C48.4029 16.3327 48.3395 16.3262 48.2809 16.3164V15.6182C48.3329 15.6279 48.3899 15.6344 48.4518 15.6377C48.5136 15.641 48.5738 15.6426 48.6324 15.6426C48.8733 15.6426 49.0702 15.5807 49.2232 15.457C49.3795 15.3333 49.5048 15.1201 49.5992 14.8174L49.6969 14.5049L47.7486 9.23633H48.6568L50.2779 14.0996L49.941 13.5674H50.3414L50.0045 14.0996L51.6207 9.23633H52.5143L50.4586 14.8223C50.3154 15.2161 50.164 15.5238 50.0045 15.7451C49.845 15.9665 49.6578 16.1211 49.443 16.209C49.2314 16.3001 48.9693 16.3457 48.6568 16.3457Z' fill='%230E0D0B'/%3e%3cpath d='M62.7081 13.27C62.742 13.27 62.7642 13.3057 62.7491 13.3362V13.336L61.1229 16.6083C61.0892 16.6761 60.9926 16.6759 60.959 16.6083L59.3382 13.336C59.3232 13.3057 59.3453 13.27 59.3792 13.27H62.7081Z' fill='%23EA4B4B'/%3e%3cpath d='M61.0026 9.71913C61.0194 9.68524 61.0678 9.68524 61.0845 9.71913L62.747 13.0897C62.762 13.12 62.7399 13.1557 62.706 13.1557H59.3763C59.3424 13.1557 59.3203 13.12 59.3353 13.0897L61.0026 9.71913Z' fill='%23EA4B4B'/%3e%3cpath d='M60.8426 9.63827C60.8766 9.63827 60.8987 9.6741 60.8835 9.70444L59.2164 13.0594C59.1995 13.0932 59.1513 13.0932 59.1345 13.0594L57.5001 9.77047C57.47 9.70962 57.5142 9.63827 57.5821 9.63827H60.8426Z' fill='%23EA4B4B'/%3e%3cpath d='M64.5036 9.63617C64.5715 9.63618 64.6157 9.70753 64.5855 9.76838H64.5854L62.9512 13.0573C62.9344 13.0911 62.8862 13.0912 62.8692 13.0573L61.2021 9.70235C61.187 9.672 61.2091 9.63617 61.2431 9.63617H64.5036Z' fill='%23EA4B4B'/%3e%3cpath d='M62.8284 6.18281C62.862 6.11518 62.9586 6.11518 62.9922 6.18281L64.5855 9.38969C64.6157 9.45054 64.5715 9.52189 64.5036 9.52189H61.2431C61.2091 9.52189 61.187 9.48605 61.2021 9.45571L62.8283 6.18265L62.8284 6.18281Z' fill='%23EA4B4B'/%3e%3cpath d='M62.3131 6.13196C62.381 6.13196 62.4252 6.20331 62.3951 6.26416C62.154 6.74935 61.9128 7.23455 61.6718 7.71975H61.6716C61.4225 8.22125 61.1733 8.72259 60.9242 9.22409C60.9074 9.25799 60.859 9.25799 60.8422 9.22409L60.6305 8.79587C60.6275 8.78957 60.6259 8.78263 60.6259 8.77553V6.22349C60.6259 6.17297 60.6668 6.13196 60.7173 6.13196H62.3131Z' fill='%23EA4B4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M74.8537 10.0096C75.2721 10.0096 75.654 10.1125 75.9993 10.3184C76.3513 10.5177 76.6303 10.8032 76.8361 11.1751C77.0487 11.547 77.1549 11.9953 77.1549 12.52V12.6495C77.1549 13.1675 77.052 13.6158 76.8461 13.9943C76.6402 14.3729 76.3613 14.6618 76.0093 14.861C75.664 15.0603 75.2788 15.1599 74.8537 15.1599C74.515 15.1599 74.2261 15.1134 73.9871 15.0204C73.7546 14.9341 73.5653 14.8212 73.4192 14.6817C73.2731 14.5423 73.1602 14.3995 73.0805 14.2534H72.941V16.9659L72.1541 16.0013V10.1491H72.9211V10.956H73.0352C73.2729 10.6733 73.3893 10.4911 73.6683 10.2985C73.9538 10.1059 74.349 10.0096 74.8537 10.0096ZM74.6445 10.7069C74.1464 10.7069 73.7347 10.8696 73.4092 11.195C73.0905 11.5138 72.9311 11.9621 72.9311 12.5399V12.6296C72.9311 13.2074 73.0905 13.659 73.4092 13.9844C73.7347 14.3032 74.1464 14.4626 74.6445 14.4626C75.1492 14.4626 75.5577 14.3032 75.8698 13.9844C76.1886 13.659 76.348 13.2074 76.348 12.6296V12.5399C76.348 11.9621 76.1886 11.5138 75.8698 11.195C75.5577 10.8696 75.1492 10.7069 74.6445 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M78.5848 11.9583L78.5555 15.4596L77.7681 14.4846V10.9583L78.5848 11.9583Z' fill='%230E0D0B'/%3e%3cpath d='M101.588 10.2986H102.444L103 10.986H101.588V10.9867H100.802L101.588 11.9623V14.1937C101.588 14.3929 101.685 14.4926 101.877 14.4926H102.379L102.928 15.17H101.668C101.389 15.17 101.173 15.0936 101.021 14.9409C100.874 14.7881 100.801 14.5789 100.801 14.3133V10.986H99.8799L99.3217 10.2986H100.801V9.13501H101.588V10.2986Z' fill='%230E0D0B'/%3e%3cpath d='M69.0133 7.90764C69.4848 7.90764 69.9065 7.99068 70.2784 8.15671C70.6569 8.3161 70.9525 8.55517 71.165 8.87395C71.3842 9.18609 71.4938 9.58126 71.4938 10.0594V10.4778H70.667V10.0594C70.667 9.72072 70.5939 9.44842 70.4477 9.24254C70.3083 9.03666 70.1124 8.88392 69.86 8.7843C69.6143 8.68469 69.332 8.63487 69.0133 8.63487C68.555 8.63487 68.1864 8.7378 67.9075 8.94367C67.6286 9.14291 67.4891 9.4285 67.4891 9.80041C67.4891 10.0461 67.5488 10.2453 67.6684 10.3981C67.7879 10.5508 67.9573 10.677 68.1764 10.7767C68.3956 10.8696 68.658 10.9527 68.9635 11.0257L69.4815 11.1552C69.8866 11.2416 70.2485 11.3611 70.5673 11.5138C70.8927 11.6599 71.1517 11.8625 71.3443 12.1215C71.5369 12.3739 71.6332 12.706 71.6332 13.1177C71.6332 13.5295 71.5303 13.8881 71.3244 14.1936C71.1185 14.4991 70.8263 14.7382 70.4477 14.9109C70.0758 15.0769 69.6375 15.1599 69.1328 15.1599C68.6281 15.1599 68.1765 15.0702 67.778 14.8909C67.3795 14.7116 67.0641 14.4426 66.8316 14.084C66.6058 13.7187 66.4929 13.2638 66.4929 12.7192V12.51H67.3197V12.7192C67.3197 13.297 67.4891 13.7287 67.8278 14.0143C68.1665 14.2932 68.6015 14.4327 69.1328 14.4327C69.6774 14.4327 70.0924 14.3098 70.378 14.0641C70.6636 13.8183 70.8064 13.5095 70.8064 13.1376C70.8064 12.8786 70.74 12.6727 70.6072 12.52C70.481 12.3673 70.3017 12.2444 70.0692 12.1514C69.8368 12.0518 69.5645 11.9655 69.2523 11.8924L68.7343 11.7629C68.3292 11.6566 67.9706 11.5271 67.6584 11.3744C67.3463 11.2216 67.1006 11.0224 66.9213 10.7767C66.7486 10.5243 66.6623 10.2022 66.6623 9.81035C66.6623 9.41852 66.7585 9.07981 66.9511 8.79424C67.1504 8.50866 67.426 8.28953 67.778 8.13678C68.1366 7.98404 68.5484 7.90764 69.0133 7.90764Z' fill='%230E0D0B'/%3e%3cpath d='M81.6544 10.0096C82.1193 10.0096 82.5145 10.0959 82.8399 10.2686C83.1719 10.4412 83.431 10.6704 83.6169 10.956C83.8095 11.2415 83.9324 11.5471 83.9855 11.8725L83.2185 12.0318C83.1853 11.7928 83.1056 11.5736 82.9794 11.3744C82.8598 11.1752 82.6905 11.0158 82.4713 10.8962C82.2521 10.7767 81.9832 10.7169 81.6644 10.7169C81.339 10.7169 81.0468 10.7899 80.7877 10.936C80.5354 11.0821 80.3328 11.2914 80.1801 11.5637C80.034 11.836 79.9609 12.1614 79.9609 12.5399V12.6296C79.9609 13.0081 80.034 13.3335 80.1801 13.6058C80.3328 13.8781 80.5354 14.0873 80.7877 14.2334C81.0468 14.3795 81.339 14.4526 81.6644 14.4526C82.1492 14.4526 82.5178 14.3264 82.7702 14.0741C83.0292 13.8217 83.1886 13.5095 83.2483 13.1376L84.0254 13.307C83.9523 13.6257 83.8195 13.9279 83.6269 14.2135C83.4343 14.4991 83.172 14.7282 82.8399 14.9009C82.5145 15.0735 82.1193 15.1599 81.6544 15.1599C81.1829 15.1599 80.7579 15.0603 80.3793 14.861C80.0074 14.6551 79.7119 14.363 79.4927 13.9844C79.2802 13.6059 79.1739 13.1575 79.1739 12.6395V12.5299C79.1739 12.0053 79.2802 11.557 79.4927 11.1851C79.7119 10.8066 80.0074 10.5177 80.3793 10.3184C80.7579 10.1126 81.1829 10.0096 81.6544 10.0096Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M86.7515 10.0096C87.2097 10.0096 87.6149 10.1092 87.9668 10.3084C88.3188 10.501 88.5944 10.78 88.7937 11.1452C88.9929 11.5105 89.0925 11.9389 89.0925 12.4304V12.7889H85.1177C85.1377 13.3136 85.3071 13.7254 85.6258 14.0243C85.9446 14.3165 86.3431 14.4626 86.8212 14.4626C87.2396 14.4626 87.5617 14.3663 87.7875 14.1737C88.0133 13.9811 88.186 13.752 88.3056 13.4863L88.983 13.815C88.8833 14.0209 88.7439 14.2268 88.5646 14.4327C88.3919 14.6386 88.1628 14.8113 87.8772 14.9507C87.5983 15.0902 87.2396 15.1599 86.8013 15.1599C86.3099 15.1599 85.8782 15.057 85.5063 14.8511C85.1344 14.6386 84.8455 14.343 84.6396 13.9645C84.4337 13.5859 84.3307 13.1476 84.3307 12.6495V12.5299C84.3307 12.0252 84.4337 11.5836 84.6396 11.205C84.8455 10.8265 85.1311 10.5342 85.4963 10.3284C85.8616 10.1159 86.28 10.0096 86.7515 10.0096ZM86.7515 10.7069C86.3066 10.7069 85.9413 10.8331 85.6557 11.0855C85.3701 11.3378 85.1941 11.6898 85.1277 12.1414H88.2956C88.269 11.6898 88.113 11.3378 87.8274 11.0855C87.5485 10.8331 87.1898 10.7069 86.7515 10.7069Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M97.1624 10.0096C97.6207 10.0096 98.0258 10.1092 98.3778 10.3084C98.7298 10.501 99.0054 10.78 99.2046 11.1452C99.4039 11.5105 99.5035 11.9389 99.5035 12.4304V12.7889H95.5287C95.5487 13.3136 95.718 13.7254 96.0368 14.0243C96.3555 14.3165 96.754 14.4626 97.2322 14.4626C97.6505 14.4626 97.9727 14.3663 98.1985 14.1737C98.4243 13.9811 98.5969 13.752 98.7165 13.4863L99.3939 13.815C99.2943 14.0209 99.1548 14.2268 98.9755 14.4327C98.8028 14.6386 98.5737 14.8113 98.2881 14.9507C98.0092 15.0902 97.6506 15.1599 97.2123 15.1599C96.7208 15.1599 96.2892 15.057 95.9172 14.8511C95.5453 14.6386 95.2564 14.343 95.0505 13.9645C94.8446 13.5859 94.7417 13.1476 94.7417 12.6495V12.5299C94.7417 12.0252 94.8446 11.5836 95.0505 11.205C95.2564 10.8265 95.542 10.5342 95.9073 10.3284C96.2725 10.1158 96.6909 10.0096 97.1624 10.0096ZM97.1624 10.7069C96.7175 10.7069 96.3522 10.8331 96.0666 11.0855C95.7811 11.3378 95.6051 11.6898 95.5387 12.1414H98.7066C98.68 11.6898 98.5239 11.3378 98.2383 11.0855C97.9594 10.8331 97.6008 10.7069 97.1624 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M92.2484 10.0594C92.6137 10.0594 92.9391 10.1358 93.2247 10.2885C93.5169 10.4413 93.7494 10.6671 93.9221 10.966C94.0947 11.2648 94.1811 11.6334 94.1811 12.0717V15.1458H93.394V12.1315C93.394 11.6467 93.2712 11.2947 93.0255 11.0755C92.7864 10.8564 92.461 10.7468 92.0492 10.7468C91.5777 10.7468 91.1925 10.8995 90.8936 11.205C90.6014 11.5105 90.4553 11.9655 90.4553 12.5698V15.1458H89.6683V10.1491H90.4354V10.9582H90.5361C90.7355 10.7018 90.8604 10.5342 91.1128 10.3483C91.3718 10.1557 91.7503 10.0594 92.2484 10.0594Z' fill='%230E0D0B'/%3e%3cpath d='M78.5932 10.9581H77.7681V10.1514H78.6L78.5932 10.9581Z' fill='%230E0D0B'/%3e%3c/svg%3e";const xt=({isOpen:t,onClose:o,title:r,subtitle:n,children:s,overlayContent:c,styles:i,theme:d,maxWidth:g="522px"})=>{const f=d||de.createTheme("light");return t?e.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:50},children:e.jsxs("div",{style:{border:"6px solid #E9E9E9",backgroundColor:"white",borderRadius:"12px",width:"100%",padding:"0",display:"flex",flexDirection:"column",maxWidth:g,position:"relative",overflow:"hidden"},children:[c&&e.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:5,pointerEvents:"none",borderRadius:"12px"}}),e.jsxs("div",{style:{padding:"24px 24px 16px 24px",borderBottom:"1px solid #cdcfd1",position:"relative"},children:[e.jsx("button",{onClick:o,style:{position:"absolute",top:"16px",right:"16px",color:"#111827",padding:"8px",backgroundColor:"transparent",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",fontSize:"20px",fontWeight:"600"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("h2",{style:{fontSize:"23px",fontWeight:"600",color:"#111827",margin:"0",fontFamily:i?.fontFamily||f.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:r})]}),n&&e.jsx("div",{style:{padding:"16px 24px 0px 24px",fontSize:"12px",color:"#6b7280",margin:"0 0 2rem 0",lineHeight:"1.4",fontFamily:i?.fontFamily||f.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:n}),s,e.jsxs("div",{style:{padding:"0px 28px 8px 28px",margin:0,marginTop:"10px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("img",{src:xs,alt:"Powered by SpiceNet",style:{height:"auto",width:"auto",opacity:1,margin:0,display:"block"}}),e.jsxs("a",{href:"https://spicenet.io/accounts",target:"_blank",rel:"noopener noreferrer",style:{fontSize:"10px",color:"#51514f",textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",fontFamily:i?.fontFamily||f.typography.fontFamily,lineHeight:"1"},children:[e.jsx("span",{children:"Learn more about"}),e.jsx("span",{style:{color:i?.primaryColor||f.colors.primary,textDecoration:"underline",fontWeight:"500"},children:"Spicenet accounts \u2192"})]})]}),c]})}):null};var Pt="data:image/svg+xml,%3csvg width='15' height='15' viewBox='0 0 15 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 7.49993V10.4999M7.5 4.96868V4.96784M14.25 7.5C14.25 11.2279 11.2279 14.25 7.5 14.25C3.77208 14.25 0.75 11.2279 0.75 7.5C0.75 3.77208 3.77208 0.75 7.5 0.75C11.2279 0.75 14.25 3.77208 14.25 7.5Z' stroke='%23ED6969' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const wo=({isOpen:t,onClose:o,title:r="Deposit",maxWidth:n="480px",depositBatches:s,tokenAddress:c,tokenDecimals:i,supportedChains:d,supportedTokens:g,theme:f="light",styles:u,className:l,depositInputHook:C,onDepositSuccess:A,onDepositError:w})=>{const k=de.createTheme(f),p=b=>{A?.(b)};return e.jsx(xt,{isOpen:t,onClose:o,title:r,subtitle:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e.jsx("img",{src:Pt,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e.jsx("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Use your cross-chain balance to deposit WBTC to earn 6.3% yield, all in one click."})]}),styles:u,theme:k,maxWidth:n,children:e.jsx("div",{style:{padding:"0 24px 24px 24px"},children:e.jsx(gs,{depositBatches:s,tokenAddress:c,tokenDecimals:i,supportedChains:d,supportedTokens:g,theme:f,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,depositInputHook:C,onDepositSuccess:p,onDepositError:w})})})},So=({asset:t,amount:o,onAmountChange:r,onPercentageClick:n,usdValue:s,disabled:c,styles:i,theme:d})=>{const g=t.balanceFormatted??0,f=parseFloat(o)||0,u=g>0?f/g*100:0,[l,C]=a.useState(null),[A,w]=a.useState(null),k=p=>{const b=p.target.value;(b===""||/^\d*\.?\d*$/.test(b))&&r(b)};return e.jsx("div",{style:{backgroundColor:"#e9e9e9",border:"0.5px solid #A8A8A7",borderRadius:"6px",padding:"16px",height:"144px",display:"flex",flexDirection:"column",gap:"8px",position:"relative"},children:e.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"100%"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("span",{style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#7d7c7b",lineHeight:"24px"},children:"Amount"}),e.jsx("input",{type:"text",value:o,onChange:k,placeholder:"0.00",disabled:c,style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"40px",fontWeight:700,color:c?"rgba(14, 13, 11, 0.16)":o?"#0e0d0b":"#d1d5db",lineHeight:"1.08",letterSpacing:"-1.2px",backgroundColor:"transparent",border:"none",outline:"none",padding:0,width:"100%",maxWidth:"200px"}})]})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"space-between",height:"100%",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"},children:[e.jsxs("span",{style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"12px",fontWeight:500,color:"#71757a",lineHeight:"16px"},children:["Balance: ",g.toFixed(4)]}),e.jsx("div",{style:{width:"128px"},children:e.jsxs("div",{style:{border:"1px solid #CDCFD1",borderRadius:"6px 6px 6px 6px",backgroundColor:"transparent",padding:"8px 12px 8px 8px",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(ot,{symbol:t.symbol,logoURI:t.logoURI,size:30,theme:d}),e.jsx("span",{style:{fontFamily:i?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#3c3e42",lineHeight:"1.5"},children:t.symbol})]})})]}),e.jsx("div",{style:{display:"flex",gap:"10px",height:"14px",alignItems:"center",justifyContent:"flex-end"},children:[0,25,50,75,100].map((p,b)=>{const m=Math.abs(u-p)<1,j=b===4,y=p/100,h=l===p,x=A===p;return e.jsx("button",{onClick:()=>n(p),onMouseEnter:()=>C(p),onMouseLeave:()=>{C(null),w(null)},onMouseDown:()=>w(p),onMouseUp:()=>w(null),disabled:c,title:`${p}%`,style:{width:"14px",height:"14px",padding:0,border:"none",backgroundColor:"transparent",cursor:c?"not-allowed":"pointer",opacity:m?1:h?.8:.5,transform:x?"scale(0.85)":h?"scale(1.15)":"scale(1)",transition:"all 0.15s ease"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:[e.jsx("circle",{cx:"7",cy:"7",r:"6.84375",fill:j?"#ea4b4b":"none",stroke:j?"#ea4b4b":"#3C3E42",strokeWidth:"0.3125"}),!j&&y>0&&e.jsx("path",{d:`M 7 7 L 7 0.15625 A 6.84375 6.84375 0 ${y>.5?1:0} 1 ${7+6.84375*Math.sin(y*2*Math.PI)} ${7-6.84375*Math.cos(y*2*Math.PI)} Z`,fill:"#3C3E42"})]})},p)})})]})]})})};var ko="data:image/svg+xml,%3csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.83337 11.0833C8.73287 11.0833 11.0834 8.73275 11.0834 5.83325C11.0834 2.93376 8.73287 0.583252 5.83337 0.583252C2.93388 0.583252 0.583374 2.93376 0.583374 5.83325C0.583374 8.73275 2.93388 11.0833 5.83337 11.0833Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.84329 4.48988C5.18981 4.14336 5.36306 3.97011 5.56285 3.90519C5.73859 3.84809 5.92789 3.84809 6.10363 3.90519C6.30342 3.97011 6.47668 4.14336 6.82319 4.48988L7.17663 4.84331C7.52314 5.18983 7.6964 5.36308 7.76131 5.56287C7.81841 5.73861 7.81841 5.92791 7.76131 6.10365C7.6964 6.30344 7.52314 6.4767 7.17663 6.82321L6.82319 7.17665C6.47668 7.52316 6.30342 7.69642 6.10363 7.76133C5.92789 7.81843 5.73859 7.81843 5.56285 7.76133C5.36306 7.69642 5.18981 7.52316 4.84329 7.17665L4.48986 6.82321C4.14334 6.4767 3.97009 6.30344 3.90517 6.10365C3.84807 5.92791 3.84807 5.73861 3.90517 5.56287C3.97009 5.36308 4.14334 5.18983 4.48986 4.84331L4.84329 4.48988Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const Io=({isOpen:t,onClose:o,onComplete:r,title:n="Deposit to Spicenet",description:s="Select tokens and enter amounts to deposit to your Spicenet Account",chainId:c,embeddedWalletAddress:i,externalWalletAddress:d,escrowAddress:g="0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",getChainConfig:f,getSupportedTokens:u})=>{const l=de.createTheme("light"),[C,A]=a.useState(new Map),[w,k]=a.useState(!1),[p,b]=a.useState(null),[m,j]=a.useState([]),[y,h]=a.useState(!1),[x,S]=a.useState(null),[F,B]=a.useState(null),[I,G]=a.useState(!1),[P,_]=a.useState(!1),{chain:$}=Ae.useAccount(),{data:J,isLoading:M}=Ae.useWalletClient(),{switchChainAsync:z}=Ae.useSwitchChain(),E=a.useMemo(()=>u(c),[c,u]),{data:U}=Ae.useReadContracts({contracts:E.map(v=>({address:v.address,abi:re.erc20Abi,functionName:"balanceOf",args:[d],chainId:c}))}),X=a.useMemo(()=>{if(!f(c))return[];const v=[];return E.forEach((N,O)=>{const se=U?.[O],ae=se?.status==="success"?se.result:BigInt(0),Z=Number(ae)/Math.pow(10,N.decimals);v.push({address:N.address,symbol:N.symbol,name:N.name,decimals:N.decimals,isNative:!1,chainId:c,balance:ae,balanceFormatted:Z})}),v},[c,U,E,f]);a.useEffect(()=>{if(X.length>0&&C.size>0){const v=new Map(C);let N=!1;C.forEach((O,se)=>{const ae=X.find(Z=>Z.address===se);ae&&ae.balanceFormatted!==O.asset.balanceFormatted&&(v.set(se,{...O,asset:ae}),N=!0)}),N&&A(v)}},[X,C]);const ee=f(c),H=v=>{const N=new Map(C);N.has(v.address)?N.delete(v.address):N.set(v.address,{asset:v,amount:""}),A(N),b(null)},ne=(v,N)=>{if(N===""||/^\d*\.?\d*$/.test(N)){const O=new Map(C),se=O.get(v);se&&(O.set(v,{...se,amount:N}),A(O),b(null))}},xe=(v,N)=>{const O=C.get(v);if(O?.asset.balanceFormatted!==void 0){const se=O.asset.balanceFormatted*N/100;ne(v,se.toString())}},ue=a.useCallback(async()=>{if(C.size===0){b("Please select at least one asset");return}for(const[N,O]of Array.from(C.entries())){if(!O.amount){b(`Please enter an amount for ${O.asset.symbol}`);return}const se=parseFloat(O.amount);if(isNaN(se)||se<=0){b(`Please enter a valid amount for ${O.asset.symbol}`);return}const ae=X.find(Z=>Z.address===N)?.balanceFormatted??O.asset.balanceFormatted;if(ae!==void 0&&se>ae){b(`Insufficient ${O.asset.symbol} balance`);return}}if(!J){b("Wallet not connected. Please reconnect your external wallet.");return}k(!0),b(null);const v=[];try{$?.id!==c&&await z({chainId:c});for(const[,N]of Array.from(C.entries())){const{asset:O,amount:se}=N;try{const ae=re.parseUnits(se,O.decimals);let Z;if(O.isNative)Z=await J.sendTransaction({to:g,value:ae});else{const T=re.encodeFunctionData({abi:re.erc20Abi,functionName:"transfer",args:[g,ae]});Z=await J.sendTransaction({to:O.address,data:T})}const he=Ve(c),Ce=await he.waitForTransactionReceipt({hash:Z,timeout:12e4,pollingInterval:2e3,confirmations:2});if(Ce.status!=="success")throw new Error(`Transfer to escrow failed for ${O.symbol}`);await he.getBlockNumber()-Ce.blockNumber<2&&await new Promise(T=>setTimeout(T,3e3)),await we.submitSpiceDeposit({txHash:Z,sender:i,tokenAddress:O.address,chainId:c,amount:re.parseUnits(se,O.decimals).toString(),user:i,isDeposit:!0}),v.push({asset:O,txHash:Z,success:!0})}catch(ae){const Z=ae;let he=Z?.message||"Deposit failed";Z?.code===4001||Z?.message?.includes("rejected")?he="Transaction rejected by user":Z?.message?.includes("insufficient funds")&&(he="Insufficient funds for transaction"),v.push({asset:O,txHash:"",success:!1,error:he})}}j(v),h(!0)}catch(N){b(N?.message||"Deposit failed")}finally{k(!1)}},[C,J,$,c,z,g,X]);a.useEffect(()=>{t||(A(new Map),b(null),j([]),h(!1),k(!1))},[t]);const Ee=a.useCallback(()=>{j([]),h(!1),b(null)},[]),R=C.size>0&&Array.from(C.values()).every(v=>v.amount&&parseFloat(v.amount)>0)&&!w&&!y&&J,q=e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e.jsx("img",{src:Pt,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e.jsx("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:s})]}),pe=w||y&&m.length>0?e.jsx(qt,{type:"deposit",isOpen:y&&m.length>0,isProcessing:w,onClose:o,onComplete:r,onRetryTx:Ee,onNewTx:()=>{},results:m.length>0?m.map(v=>({asset:{symbol:v.asset.symbol,address:v.asset.address},txHash:v.txHash,success:v.success,error:v.error})):void 0,chainName:st(c),explorerUrl:ee?.blockExplorers?.default?.url,theme:l}):null;return e.jsx(xt,{isOpen:t,onClose:o,title:n,subtitle:q,theme:l,maxWidth:"480px",children:e.jsxs("div",{style:{padding:"0 24px 32px 24px",position:"relative"},children:[pe&&e.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none"},children:e.jsx("div",{style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto"},children:pe})}),e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:[e.jsx("span",{style:{fontSize:"14px",color:"#6b7280"},children:e.jsx("img",{src:ko,alt:"Info",style:{width:"10.5px",height:"10.5px",top:"1.75px",left:"1.75px",flexShrink:0}})}),e.jsx("label",{style:{fontSize:"12px",fontWeight:590,color:"#374151"},children:"Select Assets to Deposit"})]}),e.jsx("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:X.map(v=>{const N=C.has(v.address);return e.jsx("button",{onClick:()=>H(v),onMouseEnter:()=>S(v.address),onMouseLeave:()=>{S(null),B(null)},onMouseDown:()=>B(v.address),onMouseUp:()=>B(null),style:{padding:"4px 8px 4px 8px",borderRadius:"8px",border:`1px solid ${N?"#EA4B4B7A":x===v.address?"#F4A5A5":"#e5e7eb"}`,backgroundColor:N?"#FEF2F2":F===v.address?"#f5f5f5":x===v.address?"#fafafa":"white",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",transition:"all 150ms ease",transform:F===v.address?"scale(0.96)":x===v.address?"translateY(-1px)":"none",boxShadow:N?"0 0 0 3px #FBDBDB":F===v.address?"0 1px 2px rgba(0, 0, 0, 0.05)":x===v.address?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(ot,{symbol:v.symbol,size:24,theme:l}),e.jsx("span",{style:{fontSize:"16px",fontWeight:510,color:"#3C3E42"},children:v.symbol}),v.balanceFormatted!==void 0&&e.jsxs("span",{style:{fontSize:"10px",fontWeight:500,color:"#939291",fontFamily:'"IBM Plex Mono", monospace'},children:["(",v.balanceFormatted.toFixed(4),")"]})]})},v.address)})})]}),C.size>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:Array.from(C.values()).map(({asset:v,amount:N})=>e.jsx(So,{asset:v,amount:N,onAmountChange:O=>ne(v.address,O),onPercentageClick:O=>xe(v.address,O),theme:l,disabled:w},v.address))}),p&&e.jsx("div",{style:{padding:"12px",backgroundColor:"#fef2f2",border:"1px solid #fecaca",borderRadius:"8px",marginTop:"16px"},children:e.jsx("p",{style:{fontSize:"14px",color:"#dc2626",margin:0},children:p})}),!y&&e.jsx(de.Button,{variant:"outline",fullWidth:!0,onClick:ue,onMouseEnter:()=>G(!0),onMouseLeave:()=>{G(!1),_(!1)},onMouseDown:()=>_(!0),onMouseUp:()=>_(!1),disabled:!R,theme:l,style:{width:"100%",padding:"8px ",backgroundColor:R?P?"#d43d3d":I?"#f05555":"#ea4b4b":"#d1d5db",color:R?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:R?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:R?P?"scale(0.98)":I?"translateY(-2px)":"none":"none",boxShadow:P?"1px 1px 0px black":I&&R?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:w?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"18px",height:"18px",border:"2px solid white",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("span",{children:"PROCESSING..."})]}):M?"CONNECTING WALLET...":J?C.size===0?"SELECT ASSETS":Array.from(C.values()).every(v=>v.amount)?"DEPOSIT":"ENTER AMOUNTS":"WALLET NOT CONNECTED"}),e.jsx("style",{children:`
|
|
39
39
|
@keyframes spin {
|
|
40
40
|
from { transform: rotate(0deg); }
|
|
41
41
|
to { transform: rotate(360deg); }
|
|
42
42
|
}
|
|
43
|
-
`})]})})},Fo=[{id:"external",label:"External Wallet"},{id:"embedded",label:"Embedded Wallet"}],fs=({withdrawBatches:t,externalWithdrawBatches:o,tokens:r,supportedTokens:n,enableSpiceBalanceUpdate:s=!1,theme:c="light",styles:i,className:d="",withdrawInputHook:g,defaultSelectedAsset:f,filterChains:u,withdrawMode:l="external",onWithdrawModeChange:C,externalWalletAddress:A,embeddedWalletAddress:w,onWithdrawSuccess:k,onWithdrawError:p})=>{const b=de.createTheme(c),m={...b,typography:{...b.typography,fontFamily:i?.fontFamily||b.typography.fontFamily},colors:{...b.colors,primary:i?.primaryColor||b.colors.primary,primaryHover:i?.primaryColor?`${i.primaryColor}dd`:b.colors.primaryHover}},j=Lt(),{isReady:y,isAuthenticated:h,isConnected:x,address:S,provider:F,actions:B}=j,[I,G]=a.useState(()=>f?{asset:f,amount:""}:null),[P,_]=a.useState([]),[$,J]=a.useState(!1),[M,z]=a.useState(null),E=a.useMemo(()=>!r||r.length===0?[]:!n||n.length===0?r:r.filter(Y=>n.some(te=>te.toLowerCase()===Y.symbol.toLowerCase())),[r,n]),U=a.useCallback(async()=>{if(!E||E.length===0||!w){_([]);return}J(!0),z(null);try{const Y=await Promise.all(E.map(async te=>{try{const Fe=await Ve(te.chainId).readContract({address:te.address,abi:re.erc20Abi,functionName:"balanceOf",args:[w]}),De=parseFloat(re.formatUnits(Fe,te.decimals));return{address:te.address,symbol:te.symbol,name:te.name,decimals:te.decimals,chainId:te.chainId,balance:Fe,balanceFormatted:De,balanceUsd:0,isNative:!1,logoURI:te.logoURI}}catch(Fe){return console.error(`Failed to fetch balance for ${te.symbol}:`,Fe),{address:te.address,symbol:te.symbol,name:te.name,decimals:te.decimals,chainId:te.chainId,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,isNative:!1,logoURI:te.logoURI}}}));_(Y)}catch(Y){console.error("Failed to fetch token balances:",Y),z(Y instanceof Error?Y.message:"Failed to fetch token balances")}finally{J(!1)}},[E,w]);a.useEffect(()=>{U()},[U]),a.useEffect(()=>{if(!E||E.length===0)return;const Y=setInterval(()=>{U()},3e4);return()=>clearInterval(Y)},[U,E]);const X=P.some(Y=>Y.balanceFormatted>0),[ee,H]=a.useState(!1),[ne,xe]=a.useState(null),[ue,Ee]=a.useState(!1),[R,q]=a.useState(!1),[pe,v]=a.useState(!1),[N,O]=a.useState(l),[se,ae]=a.useState(null),[Z,he]=a.useState(null),Ce=a.useRef(null),T=a.useMemo(()=>N==="external"?A:w,[N,A,w]),oe=a.useCallback(Y=>{O(Y),C?.(Y)},[C]),{intentStatus:le,startStatusPolling:Se,clearStatus:ve}=kt({checkStepStatus:(Y,te)=>we.checkStepStatus(Y,te)});a.useEffect(()=>{if(le?.overallStatus==="success"&&le.intentId&&Ce.current!==le.intentId&&I&&S){const Y=le.steps.find(te=>te.transactionHash);if(Y?.transactionHash)if(Ce.current=le.intentId,s){const te=re.parseUnits(I.amount,I.asset.decimals);we.submitSpiceDeposit({user:S,txHash:Y.transactionHash,sender:S,tokenAddress:I.asset.address,chainId:I.asset.chainId,amount:te.toString(),isDeposit:!1}).then(()=>{U()}).catch(()=>{Ce.current=null})}else U()}},[le,S,s]),a.useEffect(()=>{g&&g.assetAmount!==I?.amount&&I&&G({...I,amount:g.assetAmount})},[g?.assetAmount,I]);const ke=a.useCallback(()=>{xe(null)},[]),Ie=Y=>{G({asset:Y,amount:I?.amount||""}),ke()},ce=a.useCallback(Y=>{I&&(a.startTransition(()=>{G({...I,amount:Y}),ke()}),g&&g.setAssetAmount(Y))},[I,g,ke]),ze=async()=>{if(!(!I||!S||t.length===0)){if(!T){xe(`Please provide a ${N==="external"?"external":"embedded"} wallet address`);return}if(!y||!h){xe(`Please authenticate with ${F||"wallet provider"} to continue`);return}H(!0),xe(null),v(!0);try{const Y=N==="external"&&o?[...t,...o]:[...t],te=[...new Set(Y.map(ge=>ge.chainId))],Fe=[];for(const ge of te){const nt=Ve(ge),tt=ct(ge),ft=await Ye.getAccountNonce(S,nt),Ge=await B.signAuthorization({contractAddress:tt,chainId:ge,nonce:Number(ft)});Fe.push(Ge)}const De=Ye.hashChainBatches(Y),_e=Math.floor(Date.now()/1e3)+60*10,at=Ye.getIntentHash(0n,BigInt(_e),De),et=await B.signMessage({raw:at}),Ze=typeof et=="string"?et:et.signature;if(!Ze)throw new Error("Failed to sign intent authorization");const be={mode:"7702",signatureType:"ecdsa",signature:Ze,nbf:0,exp:_e,chainBatches:De.map(ge=>({hash:ge.hash,chainId:ge.chainId,tokenTransfers:[{from:"solver",to:S,token:"0x0",amount:re.parseUnits("0.01",18)}],calls:ge.calls}))},Re=await we.createAction({user:S,chainAuthorizations:Fe.map(ge=>({...ge,r:ge.r,s:ge.s,yParity:ge.yParity,address:ge.address,chainId:Number(ge.chainId),nonce:Number(ge.nonce)})),intents:[be]});if(Re){const ge=Et(Y,Ge=>`Chain ${Ge}`),[nt,tt]=Re.intentIds[0].split("/"),ft=parseInt(tt||"0",10);Se(Re.intentIds[0],ge);for(let Ge=0;Ge<Y.length;Ge++)await we.executeStep(nt,ft,Ge,{action:"execute"})}}catch(Y){const te=Y instanceof Error?Y.message:"Withdraw failed";xe(te),p?.(te)}finally{H(!1)}}},W=a.useMemo(()=>{let Y=P;return u&&u.length>0&&(Y=Y.filter(te=>u.includes(te.chainId))),Y},[P,u]),K=I&&I.amount&&parseFloat(I.amount)>0&&parseFloat(I.amount)<=I.asset.balanceFormatted&&x&&!ee&&t.length>0&&!!T,ie=M||ne,me={backgroundColor:i?.container?.backgroundColor||i?.primaryBackground||m.colors.background,border:`1px solid ${i?.container?.borderColor||m.colors.border}`,borderRadius:i?.container?.borderRadius||m.borderRadius.lg,padding:i?.container?.padding||m.spacing.md,width:i?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:m.colors.text,fontFamily:m.typography.fontFamily,boxShadow:i?.container?.boxShadow||(m.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},$e=le?e.jsx(qt,{type:"withdraw",isOpen:!!le&&le.overallStatus!=="processing",isProcessing:ee||le?.overallStatus==="processing",onRetryTx:()=>{ve(),v(!1),ze()},onNewTx:()=>{ve(),v(!1),G(null),Ce.current=null,U()},onClose:()=>{ve(),v(!1)},onComplete:()=>{ve(),v(!1),G(null),Ce.current=null,U()},results:le?.overallStatus==="success"||le?.overallStatus==="failed"?le.steps.map(Y=>({asset:{symbol:I?.asset.symbol||"Token",address:I?.asset.address||""},txHash:Y.transactionHash||"",success:Y.status==="success",amount:I?.amount})):void 0,chainName:I?st(t[t.length-1].chainId):"Network",explorerUrl:I?Wt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:m}):null;return e.jsxs("div",{style:{...me,position:"relative"},className:d,children:[$e&&e.jsx("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:$e})}),!$&&!X&&e.jsx("div",{style:{backgroundColor:m.mode==="light"?"#fef3c7":`${m.colors.warning||"#f59e0b"}20`,border:`1px solid ${m.mode==="light"?"#fcd34d":m.colors.warning||"#f59e0b"}`,borderRadius:m.borderRadius.md,padding:m.spacing.md,marginBottom:m.spacing.md,textAlign:"center"}}),e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:e.jsx("label",{style:{fontSize:"12px",fontWeight:590,color:m.mode==="light"?"#374151":"#d1d5db"},children:"Withdraw To"})}),e.jsx("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:Fo.map(Y=>{const te=N===Y.id,Fe=Y.id==="external"?A:w,De=Fe?`${Fe.slice(0,6)}...${Fe.slice(-4)}`:null;return e.jsxs("button",{onClick:()=>oe(Y.id),onMouseEnter:()=>ae(Y.id),onMouseLeave:()=>{ae(null),he(null)},onMouseDown:()=>he(Y.id),onMouseUp:()=>he(null),style:{padding:"8px 12px",borderRadius:"8px",border:`1px solid ${te?"#EA4B4B7A":se===Y.id?"#F4A5A5":m.mode==="light"?"#e5e7eb":"#374151"}`,backgroundColor:te?m.mode==="light"?"#FEF2F2":"#451a1a":Z===Y.id?m.mode==="light"?"#f5f5f5":"#2d2d2d":se===Y.id?m.mode==="light"?"#fafafa":"#333333":m.mode==="light"?"white":"#1f1f1f",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",transition:"all 150ms ease",transform:Z===Y.id?"scale(0.96)":se===Y.id?"translateY(-1px)":"none",boxShadow:te?"0 0 0 3px #FBDBDB":Z===Y.id?"0 1px 2px rgba(0, 0, 0, 0.05)":se===Y.id?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:[e.jsx("span",{style:{fontSize:"14px",fontWeight:510,color:m.mode==="light"?"#3C3E42":"#e5e7eb"},children:Y.label}),De&&e.jsx("span",{style:{fontSize:"10px",fontWeight:500,color:m.mode==="light"?"#939291":"#6b7280",fontFamily:'"IBM Plex Mono", monospace'},children:De})]},Y.id)})})]}),e.jsx("div",{style:{marginBottom:m.spacing.sm},children:e.jsx(ht,{assets:W,selectedAsset:I||void 0,onAssetSelect:Ie,onAmountChange:ce,loading:$,label:"Amount",showBalance:!0,showMaxButton:!0,theme:m,styles:i})}),ie&&e.jsx("div",{style:{backgroundColor:i?.errorMessage?.backgroundColor||(m.mode==="light"?"#fef2f2":`${i?.statusDisplay?.errorColor||m.colors.error}20`),border:`1px solid ${i?.errorMessage?.borderColor||(m.mode==="light"?"#fecaca":i?.statusDisplay?.errorColor||m.colors.error)}`,borderRadius:i?.errorMessage?.borderRadius||m.borderRadius.md,padding:i?.errorMessage?.padding||m.spacing.md,marginBottom:m.spacing.sm},children:e.jsx("p",{style:{color:i?.errorMessage?.color||i?.statusDisplay?.errorColor||m.colors.error,fontSize:i?.errorMessage?.fontSize||m.typography.fontSize.sm,fontWeight:i?.errorMessage?.fontWeight,fontFamily:i?.errorMessage?.fontFamily||m.typography.fontFamily,margin:0},children:ie})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:m.spacing.sm},children:e.jsx(de.Button,{variant:"outline",fullWidth:!0,onClick:ze,onMouseEnter:()=>Ee(!0),onMouseLeave:()=>{Ee(!1),q(!1)},onMouseDown:()=>q(!0),onMouseUp:()=>q(!1),loading:ee,disabled:!K||!x,theme:m,styles:i,style:{width:"100%",padding:"8px",backgroundColor:K?R?"#d43d3d":ue?"#f05555":"#ea4b4b":"#d1d5db",color:K?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:K?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:K?R?"scale(0.98)":ue?"translateY(-2px)":"none":"none",boxShadow:R?"1px 1px 0px black":ue&&K?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:y?h?x?ee?"Executing Withdraw...":I?I.amount?parseFloat(I.amount)>I.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Withdraw Batches":T?"Execute Withdraw":`Set ${N==="external"?"External":"Embedded"} Wallet`:"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})},Eo=({isOpen:t,onClose:o,title:r="Withdraw",maxWidth:n="480px",withdrawBatches:s,externalWithdrawBatches:c,tokens:i,supportedTokens:d,enableSpiceBalanceUpdate:g=!1,theme:f="light",styles:u,className:l,withdrawInputHook:C,defaultSelectedAsset:A,filterChains:w,withdrawMode:k,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:m,onWithdrawSuccess:j,onWithdrawError:y})=>{const h=de.createTheme(f),x=S=>{j?.(S)};return e.jsx(xt,{isOpen:t,onClose:o,title:r,subtitle:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e.jsx("img",{src:Pt,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e.jsx("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Withdraw your vault tokens to your external or embedded wallet."})]}),styles:u,theme:h,maxWidth:n,children:e.jsx("div",{style:{padding:"0 24px 24px 24px"},children:e.jsx(fs,{withdrawBatches:s,externalWithdrawBatches:c,tokens:i,supportedTokens:d,enableSpiceBalanceUpdate:g,theme:f,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,withdrawInputHook:C,defaultSelectedAsset:A,filterChains:w,withdrawMode:k,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:m,onWithdrawSuccess:x,onWithdrawError:y})})})};/**
|
|
43
|
+
`})]})})},Fo=[{id:"external",label:"External Wallet"},{id:"embedded",label:"Embedded Wallet"}],fs=({withdrawBatches:t,externalWithdrawBatches:o,tokens:r,supportedTokens:n,enableSpiceBalanceUpdate:s=!1,theme:c="light",styles:i,className:d="",withdrawInputHook:g,defaultSelectedAsset:f,filterChains:u,withdrawMode:l="external",onWithdrawModeChange:C,externalWalletAddress:A,embeddedWalletAddress:w,onWithdrawSuccess:k,onWithdrawError:p})=>{const b=de.createTheme(c),m={...b,typography:{...b.typography,fontFamily:i?.fontFamily||b.typography.fontFamily},colors:{...b.colors,primary:i?.primaryColor||b.colors.primary,primaryHover:i?.primaryColor?`${i.primaryColor}dd`:b.colors.primaryHover}},j=Lt(),{isReady:y,isAuthenticated:h,isConnected:x,address:S,provider:F,actions:B}=j,[I,G]=a.useState(()=>f?{asset:f,amount:""}:null),[P,_]=a.useState([]),[$,J]=a.useState(!1),[M,z]=a.useState(null),E=a.useMemo(()=>!r||r.length===0?[]:!n||n.length===0?r:r.filter(Y=>n.some(te=>te.toLowerCase()===Y.symbol.toLowerCase())),[r,n]),U=a.useCallback(async()=>{if(!E||E.length===0||!w){_([]);return}J(!0),z(null);try{const Y=await Promise.all(E.map(async te=>{try{const Fe=await Ve(te.chainId).readContract({address:te.address,abi:re.erc20Abi,functionName:"balanceOf",args:[w]}),De=parseFloat(re.formatUnits(Fe,te.decimals));return{address:te.address,symbol:te.symbol,name:te.name,decimals:te.decimals,chainId:te.chainId,balance:Fe,balanceFormatted:De,balanceUsd:0,isNative:!1,logoURI:te.logoURI}}catch(Fe){return console.error(`Failed to fetch balance for ${te.symbol}:`,Fe),{address:te.address,symbol:te.symbol,name:te.name,decimals:te.decimals,chainId:te.chainId,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,isNative:!1,logoURI:te.logoURI}}}));_(Y)}catch(Y){console.error("Failed to fetch token balances:",Y),z(Y instanceof Error?Y.message:"Failed to fetch token balances")}finally{J(!1)}},[E,w]);a.useEffect(()=>{U()},[U]),a.useEffect(()=>{if(!E||E.length===0)return;const Y=setInterval(()=>{U()},3e4);return()=>clearInterval(Y)},[U,E]);const X=P.some(Y=>Y.balanceFormatted>0),[ee,H]=a.useState(!1),[ne,xe]=a.useState(null),[ue,Ee]=a.useState(!1),[R,q]=a.useState(!1),[pe,v]=a.useState(!1),[N,O]=a.useState(l),[se,ae]=a.useState(null),[Z,he]=a.useState(null),Ce=a.useRef(null),T=a.useMemo(()=>N==="external"?A:w,[N,A,w]),oe=a.useCallback(Y=>{O(Y),C?.(Y)},[C]),{intentStatus:le,startStatusPolling:Se,clearStatus:ve}=kt({checkStepStatus:(Y,te)=>we.checkStepStatus(Y,te)});a.useEffect(()=>{if(le?.overallStatus==="success"&&le.intentId&&Ce.current!==le.intentId&&I&&S){const Y=le.steps.find(te=>te.transactionHash);if(Y?.transactionHash)if(Ce.current=le.intentId,s){const te=re.parseUnits(I.amount,I.asset.decimals);we.submitSpiceDeposit({user:S,txHash:Y.transactionHash,sender:S,tokenAddress:I.asset.address,chainId:I.asset.chainId,amount:te.toString(),isDeposit:!1}).then(()=>{U()}).catch(()=>{Ce.current=null})}else U()}},[le,S,s]),a.useEffect(()=>{g&&g.assetAmount!==I?.amount&&I&&G({...I,amount:g.assetAmount})},[g?.assetAmount,I]);const ke=a.useCallback(()=>{xe(null)},[]),Ie=Y=>{G({asset:Y,amount:I?.amount||""}),ke()},ce=a.useCallback(Y=>{I&&(a.startTransition(()=>{G({...I,amount:Y}),ke()}),g&&g.setAssetAmount(Y))},[I,g,ke]),ze=async()=>{if(!(!I||!S||t.length===0)){if(!T){xe(`Please provide a ${N==="external"?"external":"embedded"} wallet address`);return}if(!y||!h){xe(`Please authenticate with ${F||"wallet provider"} to continue`);return}H(!0),xe(null),v(!0);try{const Y=N==="external"&&o?[...t,...o]:[...t],te=[...new Set(Y.map(ge=>ge.chainId))],Fe=[];for(const ge of te){const nt=Ve(ge),tt=ct(ge),ft=await Ye.getAccountNonce(S,nt),Ge=await B.signAuthorization({contractAddress:tt,chainId:ge,nonce:Number(ft)});Fe.push(Ge)}const De=Ye.hashChainBatches(Y),_e=Math.floor(Date.now()/1e3)+60*10,at=Ye.getIntentHash(0n,BigInt(_e),De),et=await B.signMessage({raw:at}),Ze=typeof et=="string"?et:et.signature;if(!Ze)throw new Error("Failed to sign intent authorization");const be={mode:"7702",signatureType:"ecdsa",signature:Ze,nbf:0,exp:_e,chainBatches:De.map(ge=>({hash:ge.hash,chainId:ge.chainId,tokenTransfers:[{from:"solver",to:S,token:"0x0000000000000000000000000000000000000000",amount:re.parseUnits("0.01",18)}],calls:ge.calls}))},Re=await we.createAction({user:S,chainAuthorizations:Fe.map(ge=>({...ge,r:ge.r,s:ge.s,yParity:ge.yParity,address:ge.address,chainId:Number(ge.chainId),nonce:Number(ge.nonce)})),intents:[be]});if(Re){const ge=Et(Y,Ge=>`Chain ${Ge}`),[nt,tt]=Re.intentIds[0].split("/"),ft=parseInt(tt||"0",10);Se(Re.intentIds[0],ge);for(let Ge=0;Ge<Y.length;Ge++)await we.executeStep(nt,ft,Ge,{action:"execute"})}}catch(Y){const te=Y instanceof Error?Y.message:"Withdraw failed";xe(te),p?.(te)}finally{H(!1)}}},W=a.useMemo(()=>{let Y=P;return u&&u.length>0&&(Y=Y.filter(te=>u.includes(te.chainId))),Y},[P,u]),K=I&&I.amount&&parseFloat(I.amount)>0&&parseFloat(I.amount)<=I.asset.balanceFormatted&&x&&!ee&&t.length>0&&!!T,ie=M||ne,me={backgroundColor:i?.container?.backgroundColor||i?.primaryBackground||m.colors.background,border:`1px solid ${i?.container?.borderColor||m.colors.border}`,borderRadius:i?.container?.borderRadius||m.borderRadius.lg,padding:i?.container?.padding||m.spacing.md,width:i?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:m.colors.text,fontFamily:m.typography.fontFamily,boxShadow:i?.container?.boxShadow||(m.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},$e=le?e.jsx(qt,{type:"withdraw",isOpen:!!le&&le.overallStatus!=="processing",isProcessing:ee||le?.overallStatus==="processing",onRetryTx:()=>{ve(),v(!1),ze()},onNewTx:()=>{ve(),v(!1),G(null),Ce.current=null,U()},onClose:()=>{ve(),v(!1)},onComplete:()=>{ve(),v(!1),G(null),Ce.current=null,U()},results:le?.overallStatus==="success"||le?.overallStatus==="failed"?le.steps.map(Y=>({asset:{symbol:I?.asset.symbol||"Token",address:I?.asset.address||""},txHash:Y.transactionHash||"",success:Y.status==="success",amount:I?.amount})):void 0,chainName:I?st(t[t.length-1].chainId):"Network",explorerUrl:I?Wt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:m}):null;return e.jsxs("div",{style:{...me,position:"relative"},className:d,children:[$e&&e.jsx("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:$e})}),!$&&!X&&e.jsx("div",{style:{backgroundColor:m.mode==="light"?"#fef3c7":`${m.colors.warning||"#f59e0b"}20`,border:`1px solid ${m.mode==="light"?"#fcd34d":m.colors.warning||"#f59e0b"}`,borderRadius:m.borderRadius.md,padding:m.spacing.md,marginBottom:m.spacing.md,textAlign:"center"}}),e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:e.jsx("label",{style:{fontSize:"12px",fontWeight:590,color:m.mode==="light"?"#374151":"#d1d5db"},children:"Withdraw To"})}),e.jsx("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:Fo.map(Y=>{const te=N===Y.id,Fe=Y.id==="external"?A:w,De=Fe?`${Fe.slice(0,6)}...${Fe.slice(-4)}`:null;return e.jsxs("button",{onClick:()=>oe(Y.id),onMouseEnter:()=>ae(Y.id),onMouseLeave:()=>{ae(null),he(null)},onMouseDown:()=>he(Y.id),onMouseUp:()=>he(null),style:{padding:"8px 12px",borderRadius:"8px",border:`1px solid ${te?"#EA4B4B7A":se===Y.id?"#F4A5A5":m.mode==="light"?"#e5e7eb":"#374151"}`,backgroundColor:te?m.mode==="light"?"#FEF2F2":"#451a1a":Z===Y.id?m.mode==="light"?"#f5f5f5":"#2d2d2d":se===Y.id?m.mode==="light"?"#fafafa":"#333333":m.mode==="light"?"white":"#1f1f1f",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",transition:"all 150ms ease",transform:Z===Y.id?"scale(0.96)":se===Y.id?"translateY(-1px)":"none",boxShadow:te?"0 0 0 3px #FBDBDB":Z===Y.id?"0 1px 2px rgba(0, 0, 0, 0.05)":se===Y.id?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:[e.jsx("span",{style:{fontSize:"14px",fontWeight:510,color:m.mode==="light"?"#3C3E42":"#e5e7eb"},children:Y.label}),De&&e.jsx("span",{style:{fontSize:"10px",fontWeight:500,color:m.mode==="light"?"#939291":"#6b7280",fontFamily:'"IBM Plex Mono", monospace'},children:De})]},Y.id)})})]}),e.jsx("div",{style:{marginBottom:m.spacing.sm},children:e.jsx(ht,{assets:W,selectedAsset:I||void 0,onAssetSelect:Ie,onAmountChange:ce,loading:$,label:"Amount",showBalance:!0,showMaxButton:!0,theme:m,styles:i})}),ie&&e.jsx("div",{style:{backgroundColor:i?.errorMessage?.backgroundColor||(m.mode==="light"?"#fef2f2":`${i?.statusDisplay?.errorColor||m.colors.error}20`),border:`1px solid ${i?.errorMessage?.borderColor||(m.mode==="light"?"#fecaca":i?.statusDisplay?.errorColor||m.colors.error)}`,borderRadius:i?.errorMessage?.borderRadius||m.borderRadius.md,padding:i?.errorMessage?.padding||m.spacing.md,marginBottom:m.spacing.sm},children:e.jsx("p",{style:{color:i?.errorMessage?.color||i?.statusDisplay?.errorColor||m.colors.error,fontSize:i?.errorMessage?.fontSize||m.typography.fontSize.sm,fontWeight:i?.errorMessage?.fontWeight,fontFamily:i?.errorMessage?.fontFamily||m.typography.fontFamily,margin:0},children:ie})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:m.spacing.sm},children:e.jsx(de.Button,{variant:"outline",fullWidth:!0,onClick:ze,onMouseEnter:()=>Ee(!0),onMouseLeave:()=>{Ee(!1),q(!1)},onMouseDown:()=>q(!0),onMouseUp:()=>q(!1),loading:ee,disabled:!K||!x,theme:m,styles:i,style:{width:"100%",padding:"8px",backgroundColor:K?R?"#d43d3d":ue?"#f05555":"#ea4b4b":"#d1d5db",color:K?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:K?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:K?R?"scale(0.98)":ue?"translateY(-2px)":"none":"none",boxShadow:R?"1px 1px 0px black":ue&&K?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:y?h?x?ee?"Executing Withdraw...":I?I.amount?parseFloat(I.amount)>I.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Withdraw Batches":T?"Execute Withdraw":`Set ${N==="external"?"External":"Embedded"} Wallet`:"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})},Eo=({isOpen:t,onClose:o,title:r="Withdraw",maxWidth:n="480px",withdrawBatches:s,externalWithdrawBatches:c,tokens:i,supportedTokens:d,enableSpiceBalanceUpdate:g=!1,theme:f="light",styles:u,className:l,withdrawInputHook:C,defaultSelectedAsset:A,filterChains:w,withdrawMode:k,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:m,onWithdrawSuccess:j,onWithdrawError:y})=>{const h=de.createTheme(f),x=S=>{j?.(S)};return e.jsx(xt,{isOpen:t,onClose:o,title:r,subtitle:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e.jsx("img",{src:Pt,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e.jsx("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Withdraw your vault tokens to your external or embedded wallet."})]}),styles:u,theme:h,maxWidth:n,children:e.jsx("div",{style:{padding:"0 24px 24px 24px"},children:e.jsx(fs,{withdrawBatches:s,externalWithdrawBatches:c,tokens:i,supportedTokens:d,enableSpiceBalanceUpdate:g,theme:f,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,withdrawInputHook:C,defaultSelectedAsset:A,filterChains:w,withdrawMode:k,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:m,onWithdrawSuccess:x,onWithdrawError:y})})})};/**
|
|
44
44
|
* @license lucide-react v0.562.0 - ISC
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the ISC license.
|
package/dist/index.js
CHANGED
|
@@ -35,12 +35,12 @@ import{defineChain as mo,createPublicClient as yo,http as xo,isAddress as Ot,get
|
|
|
35
35
|
transform: translateY(100%);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`})]})},Vo=({depositBatches:t,tokenAddress:r,tokenDecimals:i,supportedChains:n,supportedTokens:o,theme:c="light",styles:a,className:d="",depositInputHook:g,onDepositSuccess:m,onDepositError:u,onTopUp:l})=>{const A=De(c),w={...A,typography:{...A.typography,fontFamily:a?.fontFamily||A.typography.fontFamily},colors:{...A.colors,primary:a?.primaryColor||A.colors.primary,primaryHover:a?.primaryColor?`${a.primaryColor}dd`:A.colors.primaryHover}},I=Pt(),{isReady:S,isAuthenticated:p,isConnected:b,address:y,provider:W,actions:x}=I,[h,f]=C(null),{assets:k,loading:v,error:R,hasBalance:F,refetch:K}=Uo({address:y,supportedChains:n,enabled:b,refetchInterval:3e4}),[J,oe]=C(!1),[ee,Z]=C(null),[H,N]=C(!1),[E,V]=C(!1),[_,ne]=C(!1),z=Me(null),{intentStatus:se,startStatusPolling:me,clearStatus:he}=Wt({checkStepStatus:(G,ge)=>we.checkStepStatus(G,ge)});X(()=>{if(se?.overallStatus==="success"&&se.intentId&&z.current!==se.intentId&&h&&y){const G=se.steps.find(ge=>ge.transactionHash);if(G?.transactionHash){z.current=se.intentId;const ge=Ge(h.amount,h.asset.decimals);we.submitSpiceDeposit({user:y,txHash:G.transactionHash,sender:y,tokenAddress:h.asset.address,chainId:h.asset.chainId,amount:ge.toString(),isDeposit:!1}).then(()=>{K()}).catch(()=>{z.current=null})}}},[se,y]),X(()=>{g&&g.assetAmount!==h?.amount&&h&&f({...h,amount:g.assetAmount})},[g?.assetAmount,h]);const ve=te(()=>{Z(null)},[]),L=G=>{f({asset:G,amount:h?.amount||""}),ve()},P=te(G=>{h&&(wo(()=>{f({...h,amount:G}),ve()}),g&&g.setAssetAmount(G))},[h,g,ve]),ue=async()=>{if(!(!h||!y||t.length===0)){if(!S||!p){Z(`Please authenticate with ${W||"wallet provider"} to continue`);return}oe(!0),Z(null),ne(!0);try{const G=[...t],ge=[...new Set(G.map(pe=>pe.chainId))],Ae=[];for(const pe of ge){const Pe=Je(pe),D=mt(pe),O=await zt(y,Pe),de=await x.signAuthorization({contractAddress:D,chainId:pe,nonce:Number(O)});Ae.push(de)}const T=Vt(G),ae=Math.floor(Date.now()/1e3)+60*10,ce=Tt(0n,BigInt(ae),T),Ie=await x.signMessage({raw:ce}),Ee=typeof Ie=="string"?Ie:Ie.signature;if(!Ee)throw new Error("Failed to sign intent authorization");const ke={mode:"7702",signatureType:"ecdsa",signature:Ee,nbf:0,exp:ae,chainBatches:T.map(pe=>({hash:pe.hash,chainId:pe.chainId,tokenTransfers:[{from:"solver",to:y,token:"0x0",amount:Ge("0.01",18)},{from:"solver",to:y,token:r,amount:Ge(h.amount,i)}],calls:pe.calls}))},Se=await we.createAction({user:y,chainAuthorizations:Ae.map(pe=>({...pe,r:pe.r,s:pe.s,yParity:pe.yParity,address:pe.address,chainId:Number(pe.chainId),nonce:Number(pe.nonce)})),intents:[ke]});if(Se){const pe=Lt(G,de=>`Chain ${de}`),[Pe,D]=Se.intentIds[0].split("/"),O=parseInt(D||"0",10);me(Se.intentIds[0],pe);for(let de=0;de<G.length;de++)await we.executeStep(Pe,O,de,{action:"execute"})}}catch(G){const ge=G instanceof Error?G.message:"Deposit failed";Z(ge),u?.(ge)}finally{oe(!1)}}},B=Qe(()=>o&&o.length>0?k.filter(G=>o.some(ge=>ge.toLowerCase()===G.symbol.toLowerCase())):k,[k,o]),q=h&&h.amount&&parseFloat(h.amount)>0&&parseFloat(h.amount)<=h.asset.balanceFormatted&&b&&!J&&t.length>0,$=R||ee,ie={backgroundColor:a?.container?.backgroundColor||a?.primaryBackground||w.colors.background,border:`1px solid ${a?.container?.borderColor||w.colors.border}`,borderRadius:a?.container?.borderRadius||w.borderRadius.lg,padding:a?.container?.padding||w.spacing.md,width:a?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:w.colors.text,fontFamily:w.typography.fontFamily,boxShadow:a?.container?.boxShadow||(w.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},le=se?e(so,{type:"deposit",isOpen:!!se&&se.overallStatus!=="processing",isProcessing:J||se?.overallStatus==="processing",onRetryTx:()=>{he(),ne(!1),ue()},onNewTx:()=>{he(),ne(!1),f(null),z.current=null,K()},onClose:()=>{he(),ne(!1)},onComplete:()=>{he(),ne(!1),f(null),z.current=null,K()},results:se?.overallStatus==="success"||se?.overallStatus==="failed"?se.steps.map(G=>({asset:{symbol:h?.asset.symbol||"Token",address:h?.asset.address||""},txHash:G.transactionHash||"",success:G.status==="success",amount:h?.amount})):void 0,chainName:h?lt(t[t.length-1].chainId):"Network",explorerUrl:h?Yt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:w}):null;return s("div",{style:{...ie,position:"relative"},className:d,children:[le&&e("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:le})}),!v&&!F&&e("div",{style:{backgroundColor:w.mode==="light"?"#fef3c7":`${w.colors.warning||"#f59e0b"}20`,border:`1px solid ${w.mode==="light"?"#fcd34d":w.colors.warning||"#f59e0b"}`,borderRadius:w.borderRadius.md,padding:w.spacing.md,marginBottom:w.spacing.md,textAlign:"center"},children:s("p",{style:{color:w.mode==="light"?"#92400e":"#fbbf24",fontSize:w.typography.fontSize.sm,fontFamily:w.typography.fontFamily,margin:0,lineHeight:1.5},children:["You do not have any cross-chain balance."," ",l&&e("span",{onClick:l,style:{color:w.colors.primary,textDecoration:"underline",cursor:"pointer",fontWeight:600},children:"Top-up here."})]})}),e("div",{style:{marginBottom:w.spacing.sm},children:e(bt,{assets:B,selectedAsset:h||void 0,onAssetSelect:L,onAmountChange:P,loading:v,label:"Amount",showBalance:!0,showMaxButton:!0,theme:w,styles:a})}),$&&e("div",{style:{backgroundColor:a?.errorMessage?.backgroundColor||(w.mode==="light"?"#fef2f2":`${a?.statusDisplay?.errorColor||w.colors.error}20`),border:`1px solid ${a?.errorMessage?.borderColor||(w.mode==="light"?"#fecaca":a?.statusDisplay?.errorColor||w.colors.error)}`,borderRadius:a?.errorMessage?.borderRadius||w.borderRadius.md,padding:a?.errorMessage?.padding||w.spacing.md,marginBottom:w.spacing.sm},children:e("p",{style:{color:a?.errorMessage?.color||a?.statusDisplay?.errorColor||w.colors.error,fontSize:a?.errorMessage?.fontSize||w.typography.fontSize.sm,fontWeight:a?.errorMessage?.fontWeight,fontFamily:a?.errorMessage?.fontFamily||w.typography.fontFamily,margin:0},children:$})}),e("div",{style:{display:"flex",flexDirection:"column",gap:w.spacing.sm},children:e(je,{variant:"outline",fullWidth:!0,onClick:ue,onMouseEnter:()=>N(!0),onMouseLeave:()=>{N(!1),V(!1)},onMouseDown:()=>V(!0),onMouseUp:()=>V(!1),loading:J,disabled:!q||!b,theme:w,styles:a,style:{width:"100%",padding:"8px",backgroundColor:q?E?"#d43d3d":H?"#f05555":"#ea4b4b":"#d1d5db",color:q?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:q?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:q?E?"scale(0.98)":H?"translateY(-2px)":"none":"none",boxShadow:E?"1px 1px 0px black":H&&q?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:S?p?b?J?"Executing Deposit...":h?h.amount?parseFloat(h.amount)>h.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Deposit Batches":"Execute Deposit":"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})};var To="data:image/svg+xml,%3csvg width='108' height='22' viewBox='0 0 108 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1.9916 11.9854V11.2041H3.98379C4.48835 11.2041 4.87897 11.0739 5.15566 10.8135C5.43236 10.5498 5.5707 10.1868 5.5707 9.72461V9.71484C5.5707 9.24935 5.43236 8.88639 5.15566 8.62598C4.87897 8.36556 4.48835 8.23535 3.98379 8.23535H1.9916V7.4541H4.2084C4.65111 7.4541 5.04173 7.5485 5.38027 7.7373C5.71882 7.92611 5.98411 8.18978 6.17617 8.52832C6.37148 8.86686 6.46914 9.25911 6.46914 9.70508V9.71484C6.46914 10.1608 6.37148 10.5547 6.17617 10.8965C5.98411 11.2383 5.71882 11.5052 5.38027 11.6973C5.04173 11.8893 4.65111 11.9854 4.2084 11.9854H1.9916ZM1.55215 14.5V7.4541H2.43106V14.5H1.55215ZM9.51875 14.5928C9.0207 14.5928 8.58939 14.4837 8.2248 14.2656C7.86348 14.0443 7.58353 13.7301 7.38496 13.3232C7.18965 12.9163 7.09199 12.4329 7.09199 11.873V11.8633C7.09199 11.3001 7.18965 10.8151 7.38496 10.4082C7.58353 10.0013 7.86348 9.6888 8.2248 9.4707C8.58939 9.2526 9.0207 9.14355 9.51875 9.14355C10.0201 9.14355 10.4514 9.2526 10.8127 9.4707C11.174 9.6888 11.4523 10.0013 11.6477 10.4082C11.8462 10.8151 11.9455 11.3001 11.9455 11.8633V11.873C11.9455 12.4329 11.8462 12.9163 11.6477 13.3232C11.4523 13.7301 11.174 14.0443 10.8127 14.2656C10.4514 14.4837 10.0201 14.5928 9.51875 14.5928ZM9.51875 13.8408C9.85078 13.8408 10.1324 13.7627 10.3635 13.6064C10.5946 13.4502 10.7704 13.2256 10.8908 12.9326C11.0145 12.6396 11.0764 12.2865 11.0764 11.873V11.8633C11.0764 11.4466 11.0145 11.0918 10.8908 10.7988C10.7704 10.5059 10.5946 10.2829 10.3635 10.1299C10.1324 9.97363 9.85078 9.89551 9.51875 9.89551C9.18672 9.89551 8.90514 9.97363 8.67402 10.1299C8.4429 10.2829 8.26549 10.5059 8.1418 10.7988C8.02135 11.0918 7.96113 11.4466 7.96113 11.8633V11.873C7.96113 12.2865 8.02135 12.6396 8.1418 12.9326C8.26549 13.2256 8.4429 13.4502 8.67402 13.6064C8.90514 13.7627 9.18672 13.8408 9.51875 13.8408ZM13.7842 14.5L12.3096 9.23633H13.1592L14.1943 13.4453H14.2725L15.4492 9.23633H16.2549L17.4316 13.4453H17.5098L18.5449 9.23633H19.3896L17.915 14.5H17.0605L15.8838 10.4277H15.8057L14.6338 14.5H13.7842ZM22.1658 14.5928C21.6645 14.5928 21.2332 14.4821 20.8719 14.2607C20.5138 14.0394 20.2371 13.7269 20.0418 13.3232C19.8497 12.9163 19.7537 12.4378 19.7537 11.8877V11.8828C19.7537 11.3392 19.8497 10.8623 20.0418 10.4521C20.2371 10.042 20.5122 9.72135 20.867 9.49023C21.2218 9.25911 21.6368 9.14355 22.1121 9.14355C22.5906 9.14355 23.0008 9.25423 23.3426 9.47559C23.6876 9.69694 23.9513 10.0062 24.1336 10.4033C24.3191 10.7972 24.4119 11.2562 24.4119 11.7803V12.1123H20.1932V11.4336H23.9773L23.5574 12.0537V11.7168C23.5574 11.3034 23.4956 10.9632 23.3719 10.6963C23.2482 10.4294 23.0773 10.2308 22.8592 10.1006C22.6411 9.96712 22.3904 9.90039 22.1072 9.90039C21.824 9.90039 21.5701 9.97038 21.3455 10.1104C21.1242 10.2471 20.9484 10.4505 20.8182 10.7207C20.688 10.9909 20.6229 11.3229 20.6229 11.7168V12.0537C20.6229 12.4281 20.6863 12.7487 20.8133 13.0156C20.9402 13.2793 21.1209 13.4827 21.3553 13.626C21.5896 13.766 21.8663 13.8359 22.1854 13.8359C22.423 13.8359 22.6297 13.8034 22.8055 13.7383C22.9813 13.6732 23.1261 13.5902 23.24 13.4893C23.354 13.3883 23.4337 13.2858 23.4793 13.1816L23.4988 13.1377H24.3484L24.3387 13.1768C24.2931 13.3558 24.2117 13.5299 24.0945 13.6992C23.9806 13.8652 23.8325 14.0166 23.6502 14.1533C23.4679 14.2868 23.2514 14.3942 23.0008 14.4756C22.7534 14.5537 22.4751 14.5928 22.1658 14.5928ZM25.4303 14.5V9.23633H26.2799V10.0176H26.358C26.4589 9.74089 26.6298 9.52604 26.8707 9.37305C27.1116 9.22005 27.4094 9.14355 27.7643 9.14355C27.8456 9.14355 27.9254 9.14844 28.0035 9.1582C28.0849 9.16471 28.1467 9.17122 28.1891 9.17773V10.0029C28.1012 9.98665 28.0149 9.97526 27.9303 9.96875C27.8489 9.95898 27.761 9.9541 27.6666 9.9541C27.3964 9.9541 27.1572 10.0078 26.9488 10.1152C26.7405 10.2227 26.5761 10.3724 26.4557 10.5645C26.3385 10.7565 26.2799 10.9811 26.2799 11.2383V14.5H25.4303ZM30.9408 14.5928C30.4395 14.5928 30.0082 14.4821 29.6469 14.2607C29.2888 14.0394 29.0121 13.7269 28.8168 13.3232C28.6247 12.9163 28.5287 12.4378 28.5287 11.8877V11.8828C28.5287 11.3392 28.6247 10.8623 28.8168 10.4521C29.0121 10.042 29.2872 9.72135 29.642 9.49023C29.9968 9.25911 30.4118 9.14355 30.8871 9.14355C31.3656 9.14355 31.7758 9.25423 32.1176 9.47559C32.4626 9.69694 32.7263 10.0062 32.9086 10.4033C33.0941 10.7972 33.1869 11.2562 33.1869 11.7803V12.1123H28.9682V11.4336H32.7523L32.3324 12.0537V11.7168C32.3324 11.3034 32.2706 10.9632 32.1469 10.6963C32.0232 10.4294 31.8523 10.2308 31.6342 10.1006C31.4161 9.96712 31.1654 9.90039 30.8822 9.90039C30.599 9.90039 30.3451 9.97038 30.1205 10.1104C29.8992 10.2471 29.7234 10.4505 29.5932 10.7207C29.463 10.9909 29.3979 11.3229 29.3979 11.7168V12.0537C29.3979 12.4281 29.4613 12.7487 29.5883 13.0156C29.7152 13.2793 29.8959 13.4827 30.1303 13.626C30.3646 13.766 30.6413 13.8359 30.9604 13.8359C31.198 13.8359 31.4047 13.8034 31.5805 13.7383C31.7563 13.6732 31.9011 13.5902 32.015 13.4893C32.129 13.3883 32.2087 13.2858 32.2543 13.1816L32.2738 13.1377H33.1234L33.1137 13.1768C33.0681 13.3558 32.9867 13.5299 32.8695 13.6992C32.7556 13.8652 32.6075 14.0166 32.4252 14.1533C32.2429 14.2868 32.0264 14.3942 31.7758 14.4756C31.5284 14.5537 31.2501 14.5928 30.9408 14.5928ZM36.1486 14.5928C35.7059 14.5928 35.3186 14.4805 34.9865 14.2559C34.6545 14.0312 34.3973 13.7155 34.215 13.3086C34.0328 12.8984 33.9416 12.4199 33.9416 11.873V11.8633C33.9416 11.3132 34.0328 10.8346 34.215 10.4277C34.3973 10.0208 34.6529 9.70508 34.9816 9.48047C35.3137 9.25586 35.7027 9.14355 36.1486 9.14355C36.3895 9.14355 36.6158 9.18262 36.8273 9.26074C37.0422 9.33561 37.2326 9.44141 37.3986 9.57812C37.5647 9.71484 37.6949 9.8776 37.7893 10.0664H37.8674V7.14648H38.717V14.5H37.8674V13.6602H37.7893C37.6818 13.8555 37.5467 14.0231 37.384 14.1631C37.2212 14.2998 37.0357 14.4056 36.8273 14.4805C36.619 14.5553 36.3928 14.5928 36.1486 14.5928ZM36.3439 13.8408C36.663 13.8408 36.938 13.7611 37.1691 13.6016C37.4003 13.4421 37.5777 13.2158 37.7014 12.9229C37.8251 12.6266 37.8869 12.2767 37.8869 11.873V11.8633C37.8869 11.4564 37.8251 11.1064 37.7014 10.8135C37.5777 10.5205 37.4003 10.2943 37.1691 10.1348C36.938 9.97526 36.663 9.89551 36.3439 9.89551C36.0249 9.89551 35.7499 9.97526 35.5188 10.1348C35.2909 10.291 35.1151 10.5156 34.9914 10.8086C34.871 11.1016 34.8107 11.4531 34.8107 11.8633V11.873C34.8107 12.2799 34.871 12.6315 34.9914 12.9277C35.1151 13.2207 35.2909 13.4469 35.5188 13.6064C35.7499 13.7627 36.0249 13.8408 36.3439 13.8408ZM45.1775 14.5928C44.9334 14.5928 44.7072 14.5553 44.4988 14.4805C44.2905 14.4056 44.1049 14.2998 43.9422 14.1631C43.7794 14.0231 43.6443 13.8555 43.5369 13.6602H43.4588V14.5H42.6092V7.14648H43.4588V10.0664H43.5369C43.6346 9.8776 43.7648 9.71484 43.9275 9.57812C44.0936 9.44141 44.2824 9.33561 44.4939 9.26074C44.7088 9.18262 44.9367 9.14355 45.1775 9.14355C45.6235 9.14355 46.0109 9.25586 46.3396 9.48047C46.6717 9.70508 46.9288 10.0208 47.1111 10.4277C47.2934 10.8346 47.3846 11.3132 47.3846 11.8633V11.873C47.3846 12.4199 47.2934 12.8984 47.1111 13.3086C46.9288 13.7155 46.6717 14.0312 46.3396 14.2559C46.0109 14.4805 45.6235 14.5928 45.1775 14.5928ZM44.9822 13.8408C45.3045 13.8408 45.5796 13.7627 45.8074 13.6064C46.0353 13.4469 46.2094 13.2207 46.3299 12.9277C46.4536 12.6315 46.5154 12.2799 46.5154 11.873V11.8633C46.5154 11.4531 46.4536 11.1016 46.3299 10.8086C46.2094 10.5156 46.0353 10.291 45.8074 10.1348C45.5796 9.97526 45.3045 9.89551 44.9822 9.89551C44.6632 9.89551 44.3881 9.97526 44.157 10.1348C43.9259 10.2943 43.7485 10.5205 43.6248 10.8135C43.5011 11.1064 43.4393 11.4564 43.4393 11.8633V11.873C43.4393 12.2767 43.5011 12.6266 43.6248 12.9229C43.7485 13.2158 43.9259 13.4421 44.157 13.6016C44.3881 13.7611 44.6632 13.8408 44.9822 13.8408ZM48.6568 16.3457C48.6015 16.3457 48.5396 16.3424 48.4713 16.3359C48.4029 16.3327 48.3395 16.3262 48.2809 16.3164V15.6182C48.3329 15.6279 48.3899 15.6344 48.4518 15.6377C48.5136 15.641 48.5738 15.6426 48.6324 15.6426C48.8733 15.6426 49.0702 15.5807 49.2232 15.457C49.3795 15.3333 49.5048 15.1201 49.5992 14.8174L49.6969 14.5049L47.7486 9.23633H48.6568L50.2779 14.0996L49.941 13.5674H50.3414L50.0045 14.0996L51.6207 9.23633H52.5143L50.4586 14.8223C50.3154 15.2161 50.164 15.5238 50.0045 15.7451C49.845 15.9665 49.6578 16.1211 49.443 16.209C49.2314 16.3001 48.9693 16.3457 48.6568 16.3457Z' fill='%230E0D0B'/%3e%3cpath d='M62.7081 13.27C62.742 13.27 62.7642 13.3057 62.7491 13.3362V13.336L61.1229 16.6083C61.0892 16.6761 60.9926 16.6759 60.959 16.6083L59.3382 13.336C59.3232 13.3057 59.3453 13.27 59.3792 13.27H62.7081Z' fill='%23EA4B4B'/%3e%3cpath d='M61.0026 9.71913C61.0194 9.68524 61.0678 9.68524 61.0845 9.71913L62.747 13.0897C62.762 13.12 62.7399 13.1557 62.706 13.1557H59.3763C59.3424 13.1557 59.3203 13.12 59.3353 13.0897L61.0026 9.71913Z' fill='%23EA4B4B'/%3e%3cpath d='M60.8426 9.63827C60.8766 9.63827 60.8987 9.6741 60.8835 9.70444L59.2164 13.0594C59.1995 13.0932 59.1513 13.0932 59.1345 13.0594L57.5001 9.77047C57.47 9.70962 57.5142 9.63827 57.5821 9.63827H60.8426Z' fill='%23EA4B4B'/%3e%3cpath d='M64.5036 9.63617C64.5715 9.63618 64.6157 9.70753 64.5855 9.76838H64.5854L62.9512 13.0573C62.9344 13.0911 62.8862 13.0912 62.8692 13.0573L61.2021 9.70235C61.187 9.672 61.2091 9.63617 61.2431 9.63617H64.5036Z' fill='%23EA4B4B'/%3e%3cpath d='M62.8284 6.18281C62.862 6.11518 62.9586 6.11518 62.9922 6.18281L64.5855 9.38969C64.6157 9.45054 64.5715 9.52189 64.5036 9.52189H61.2431C61.2091 9.52189 61.187 9.48605 61.2021 9.45571L62.8283 6.18265L62.8284 6.18281Z' fill='%23EA4B4B'/%3e%3cpath d='M62.3131 6.13196C62.381 6.13196 62.4252 6.20331 62.3951 6.26416C62.154 6.74935 61.9128 7.23455 61.6718 7.71975H61.6716C61.4225 8.22125 61.1733 8.72259 60.9242 9.22409C60.9074 9.25799 60.859 9.25799 60.8422 9.22409L60.6305 8.79587C60.6275 8.78957 60.6259 8.78263 60.6259 8.77553V6.22349C60.6259 6.17297 60.6668 6.13196 60.7173 6.13196H62.3131Z' fill='%23EA4B4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M74.8537 10.0096C75.2721 10.0096 75.654 10.1125 75.9993 10.3184C76.3513 10.5177 76.6303 10.8032 76.8361 11.1751C77.0487 11.547 77.1549 11.9953 77.1549 12.52V12.6495C77.1549 13.1675 77.052 13.6158 76.8461 13.9943C76.6402 14.3729 76.3613 14.6618 76.0093 14.861C75.664 15.0603 75.2788 15.1599 74.8537 15.1599C74.515 15.1599 74.2261 15.1134 73.9871 15.0204C73.7546 14.9341 73.5653 14.8212 73.4192 14.6817C73.2731 14.5423 73.1602 14.3995 73.0805 14.2534H72.941V16.9659L72.1541 16.0013V10.1491H72.9211V10.956H73.0352C73.2729 10.6733 73.3893 10.4911 73.6683 10.2985C73.9538 10.1059 74.349 10.0096 74.8537 10.0096ZM74.6445 10.7069C74.1464 10.7069 73.7347 10.8696 73.4092 11.195C73.0905 11.5138 72.9311 11.9621 72.9311 12.5399V12.6296C72.9311 13.2074 73.0905 13.659 73.4092 13.9844C73.7347 14.3032 74.1464 14.4626 74.6445 14.4626C75.1492 14.4626 75.5577 14.3032 75.8698 13.9844C76.1886 13.659 76.348 13.2074 76.348 12.6296V12.5399C76.348 11.9621 76.1886 11.5138 75.8698 11.195C75.5577 10.8696 75.1492 10.7069 74.6445 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M78.5848 11.9583L78.5555 15.4596L77.7681 14.4846V10.9583L78.5848 11.9583Z' fill='%230E0D0B'/%3e%3cpath d='M101.588 10.2986H102.444L103 10.986H101.588V10.9867H100.802L101.588 11.9623V14.1937C101.588 14.3929 101.685 14.4926 101.877 14.4926H102.379L102.928 15.17H101.668C101.389 15.17 101.173 15.0936 101.021 14.9409C100.874 14.7881 100.801 14.5789 100.801 14.3133V10.986H99.8799L99.3217 10.2986H100.801V9.13501H101.588V10.2986Z' fill='%230E0D0B'/%3e%3cpath d='M69.0133 7.90764C69.4848 7.90764 69.9065 7.99068 70.2784 8.15671C70.6569 8.3161 70.9525 8.55517 71.165 8.87395C71.3842 9.18609 71.4938 9.58126 71.4938 10.0594V10.4778H70.667V10.0594C70.667 9.72072 70.5939 9.44842 70.4477 9.24254C70.3083 9.03666 70.1124 8.88392 69.86 8.7843C69.6143 8.68469 69.332 8.63487 69.0133 8.63487C68.555 8.63487 68.1864 8.7378 67.9075 8.94367C67.6286 9.14291 67.4891 9.4285 67.4891 9.80041C67.4891 10.0461 67.5488 10.2453 67.6684 10.3981C67.7879 10.5508 67.9573 10.677 68.1764 10.7767C68.3956 10.8696 68.658 10.9527 68.9635 11.0257L69.4815 11.1552C69.8866 11.2416 70.2485 11.3611 70.5673 11.5138C70.8927 11.6599 71.1517 11.8625 71.3443 12.1215C71.5369 12.3739 71.6332 12.706 71.6332 13.1177C71.6332 13.5295 71.5303 13.8881 71.3244 14.1936C71.1185 14.4991 70.8263 14.7382 70.4477 14.9109C70.0758 15.0769 69.6375 15.1599 69.1328 15.1599C68.6281 15.1599 68.1765 15.0702 67.778 14.8909C67.3795 14.7116 67.0641 14.4426 66.8316 14.084C66.6058 13.7187 66.4929 13.2638 66.4929 12.7192V12.51H67.3197V12.7192C67.3197 13.297 67.4891 13.7287 67.8278 14.0143C68.1665 14.2932 68.6015 14.4327 69.1328 14.4327C69.6774 14.4327 70.0924 14.3098 70.378 14.0641C70.6636 13.8183 70.8064 13.5095 70.8064 13.1376C70.8064 12.8786 70.74 12.6727 70.6072 12.52C70.481 12.3673 70.3017 12.2444 70.0692 12.1514C69.8368 12.0518 69.5645 11.9655 69.2523 11.8924L68.7343 11.7629C68.3292 11.6566 67.9706 11.5271 67.6584 11.3744C67.3463 11.2216 67.1006 11.0224 66.9213 10.7767C66.7486 10.5243 66.6623 10.2022 66.6623 9.81035C66.6623 9.41852 66.7585 9.07981 66.9511 8.79424C67.1504 8.50866 67.426 8.28953 67.778 8.13678C68.1366 7.98404 68.5484 7.90764 69.0133 7.90764Z' fill='%230E0D0B'/%3e%3cpath d='M81.6544 10.0096C82.1193 10.0096 82.5145 10.0959 82.8399 10.2686C83.1719 10.4412 83.431 10.6704 83.6169 10.956C83.8095 11.2415 83.9324 11.5471 83.9855 11.8725L83.2185 12.0318C83.1853 11.7928 83.1056 11.5736 82.9794 11.3744C82.8598 11.1752 82.6905 11.0158 82.4713 10.8962C82.2521 10.7767 81.9832 10.7169 81.6644 10.7169C81.339 10.7169 81.0468 10.7899 80.7877 10.936C80.5354 11.0821 80.3328 11.2914 80.1801 11.5637C80.034 11.836 79.9609 12.1614 79.9609 12.5399V12.6296C79.9609 13.0081 80.034 13.3335 80.1801 13.6058C80.3328 13.8781 80.5354 14.0873 80.7877 14.2334C81.0468 14.3795 81.339 14.4526 81.6644 14.4526C82.1492 14.4526 82.5178 14.3264 82.7702 14.0741C83.0292 13.8217 83.1886 13.5095 83.2483 13.1376L84.0254 13.307C83.9523 13.6257 83.8195 13.9279 83.6269 14.2135C83.4343 14.4991 83.172 14.7282 82.8399 14.9009C82.5145 15.0735 82.1193 15.1599 81.6544 15.1599C81.1829 15.1599 80.7579 15.0603 80.3793 14.861C80.0074 14.6551 79.7119 14.363 79.4927 13.9844C79.2802 13.6059 79.1739 13.1575 79.1739 12.6395V12.5299C79.1739 12.0053 79.2802 11.557 79.4927 11.1851C79.7119 10.8066 80.0074 10.5177 80.3793 10.3184C80.7579 10.1126 81.1829 10.0096 81.6544 10.0096Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M86.7515 10.0096C87.2097 10.0096 87.6149 10.1092 87.9668 10.3084C88.3188 10.501 88.5944 10.78 88.7937 11.1452C88.9929 11.5105 89.0925 11.9389 89.0925 12.4304V12.7889H85.1177C85.1377 13.3136 85.3071 13.7254 85.6258 14.0243C85.9446 14.3165 86.3431 14.4626 86.8212 14.4626C87.2396 14.4626 87.5617 14.3663 87.7875 14.1737C88.0133 13.9811 88.186 13.752 88.3056 13.4863L88.983 13.815C88.8833 14.0209 88.7439 14.2268 88.5646 14.4327C88.3919 14.6386 88.1628 14.8113 87.8772 14.9507C87.5983 15.0902 87.2396 15.1599 86.8013 15.1599C86.3099 15.1599 85.8782 15.057 85.5063 14.8511C85.1344 14.6386 84.8455 14.343 84.6396 13.9645C84.4337 13.5859 84.3307 13.1476 84.3307 12.6495V12.5299C84.3307 12.0252 84.4337 11.5836 84.6396 11.205C84.8455 10.8265 85.1311 10.5342 85.4963 10.3284C85.8616 10.1159 86.28 10.0096 86.7515 10.0096ZM86.7515 10.7069C86.3066 10.7069 85.9413 10.8331 85.6557 11.0855C85.3701 11.3378 85.1941 11.6898 85.1277 12.1414H88.2956C88.269 11.6898 88.113 11.3378 87.8274 11.0855C87.5485 10.8331 87.1898 10.7069 86.7515 10.7069Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M97.1624 10.0096C97.6207 10.0096 98.0258 10.1092 98.3778 10.3084C98.7298 10.501 99.0054 10.78 99.2046 11.1452C99.4039 11.5105 99.5035 11.9389 99.5035 12.4304V12.7889H95.5287C95.5487 13.3136 95.718 13.7254 96.0368 14.0243C96.3555 14.3165 96.754 14.4626 97.2322 14.4626C97.6505 14.4626 97.9727 14.3663 98.1985 14.1737C98.4243 13.9811 98.5969 13.752 98.7165 13.4863L99.3939 13.815C99.2943 14.0209 99.1548 14.2268 98.9755 14.4327C98.8028 14.6386 98.5737 14.8113 98.2881 14.9507C98.0092 15.0902 97.6506 15.1599 97.2123 15.1599C96.7208 15.1599 96.2892 15.057 95.9172 14.8511C95.5453 14.6386 95.2564 14.343 95.0505 13.9645C94.8446 13.5859 94.7417 13.1476 94.7417 12.6495V12.5299C94.7417 12.0252 94.8446 11.5836 95.0505 11.205C95.2564 10.8265 95.542 10.5342 95.9073 10.3284C96.2725 10.1158 96.6909 10.0096 97.1624 10.0096ZM97.1624 10.7069C96.7175 10.7069 96.3522 10.8331 96.0666 11.0855C95.7811 11.3378 95.6051 11.6898 95.5387 12.1414H98.7066C98.68 11.6898 98.5239 11.3378 98.2383 11.0855C97.9594 10.8331 97.6008 10.7069 97.1624 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M92.2484 10.0594C92.6137 10.0594 92.9391 10.1358 93.2247 10.2885C93.5169 10.4413 93.7494 10.6671 93.9221 10.966C94.0947 11.2648 94.1811 11.6334 94.1811 12.0717V15.1458H93.394V12.1315C93.394 11.6467 93.2712 11.2947 93.0255 11.0755C92.7864 10.8564 92.461 10.7468 92.0492 10.7468C91.5777 10.7468 91.1925 10.8995 90.8936 11.205C90.6014 11.5105 90.4553 11.9655 90.4553 12.5698V15.1458H89.6683V10.1491H90.4354V10.9582H90.5361C90.7355 10.7018 90.8604 10.5342 91.1128 10.3483C91.3718 10.1557 91.7503 10.0594 92.2484 10.0594Z' fill='%230E0D0B'/%3e%3cpath d='M78.5932 10.9581H77.7681V10.1514H78.6L78.5932 10.9581Z' fill='%230E0D0B'/%3e%3c/svg%3e";const At=({isOpen:t,onClose:r,title:i,subtitle:n,children:o,overlayContent:c,styles:a,theme:d,maxWidth:g="522px"})=>{const m=d||De("light");return t?e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:50},children:s("div",{style:{border:"6px solid #E9E9E9",backgroundColor:"white",borderRadius:"12px",width:"100%",padding:"0",display:"flex",flexDirection:"column",maxWidth:g,position:"relative",overflow:"hidden"},children:[c&&e("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:5,pointerEvents:"none",borderRadius:"12px"}}),s("div",{style:{padding:"24px 24px 16px 24px",borderBottom:"1px solid #cdcfd1",position:"relative"},children:[e("button",{onClick:r,style:{position:"absolute",top:"16px",right:"16px",color:"#111827",padding:"8px",backgroundColor:"transparent",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",fontSize:"20px",fontWeight:"600"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e("h2",{style:{fontSize:"23px",fontWeight:"600",color:"#111827",margin:"0",fontFamily:a?.fontFamily||m.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:i})]}),n&&e("div",{style:{padding:"16px 24px 0px 24px",fontSize:"12px",color:"#6b7280",margin:"0 0 2rem 0",lineHeight:"1.4",fontFamily:a?.fontFamily||m.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:n}),o,s("div",{style:{padding:"0px 28px 8px 28px",margin:0,marginTop:"10px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("img",{src:To,alt:"Powered by SpiceNet",style:{height:"auto",width:"auto",opacity:1,margin:0,display:"block"}}),s("a",{href:"https://spicenet.io/accounts",target:"_blank",rel:"noopener noreferrer",style:{fontSize:"10px",color:"#51514f",textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",fontFamily:a?.fontFamily||m.typography.fontFamily,lineHeight:"1"},children:[e("span",{children:"Learn more about"}),e("span",{style:{color:a?.primaryColor||m.colors.primary,textDecoration:"underline",fontWeight:"500"},children:"Spicenet accounts \u2192"})]})]}),c]})}):null};var lo="data:image/svg+xml,%3csvg width='15' height='15' viewBox='0 0 15 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 7.49993V10.4999M7.5 4.96868V4.96784M14.25 7.5C14.25 11.2279 11.2279 14.25 7.5 14.25C3.77208 14.25 0.75 11.2279 0.75 7.5C0.75 3.77208 3.77208 0.75 7.5 0.75C11.2279 0.75 14.25 3.77208 14.25 7.5Z' stroke='%23ED6969' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const lr=({isOpen:t,onClose:r,title:i="Deposit",maxWidth:n="480px",depositBatches:o,tokenAddress:c,tokenDecimals:a,supportedChains:d,supportedTokens:g,theme:m="light",styles:u,className:l,depositInputHook:A,onDepositSuccess:w,onDepositError:I})=>{const S=De(m),p=b=>{w?.(b)};return e(At,{isOpen:t,onClose:r,title:i,subtitle:s("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e("img",{src:lo,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Use your cross-chain balance to deposit WBTC to earn 6.3% yield, all in one click."})]}),styles:u,theme:S,maxWidth:n,children:e("div",{style:{padding:"0 24px 24px 24px"},children:e(Vo,{depositBatches:o,tokenAddress:c,tokenDecimals:a,supportedChains:d,supportedTokens:g,theme:m,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,depositInputHook:A,onDepositSuccess:p,onDepositError:I})})})},dr=({asset:t,amount:r,onAmountChange:i,onPercentageClick:n,usdValue:o,disabled:c,styles:a,theme:d})=>{const g=t.balanceFormatted??0,m=parseFloat(r)||0,u=g>0?m/g*100:0,[l,A]=C(null),[w,I]=C(null),S=p=>{const b=p.target.value;(b===""||/^\d*\.?\d*$/.test(b))&&i(b)};return e("div",{style:{backgroundColor:"#e9e9e9",border:"0.5px solid #A8A8A7",borderRadius:"6px",padding:"16px",height:"144px",display:"flex",flexDirection:"column",gap:"8px",position:"relative"},children:s("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"100%"},children:s("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e("span",{style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#7d7c7b",lineHeight:"24px"},children:"Amount"}),e("input",{type:"text",value:r,onChange:S,placeholder:"0.00",disabled:c,style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"40px",fontWeight:700,color:c?"rgba(14, 13, 11, 0.16)":r?"#0e0d0b":"#d1d5db",lineHeight:"1.08",letterSpacing:"-1.2px",backgroundColor:"transparent",border:"none",outline:"none",padding:0,width:"100%",maxWidth:"200px"}})]})}),s("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"space-between",height:"100%",gap:"12px"},children:[s("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"},children:[s("span",{style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"12px",fontWeight:500,color:"#71757a",lineHeight:"16px"},children:["Balance: ",g.toFixed(4)]}),e("div",{style:{width:"128px"},children:s("div",{style:{border:"1px solid #CDCFD1",borderRadius:"6px 6px 6px 6px",backgroundColor:"transparent",padding:"8px 12px 8px 8px",display:"flex",alignItems:"center",gap:"8px"},children:[e(dt,{symbol:t.symbol,logoURI:t.logoURI,size:30,theme:d}),e("span",{style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#3c3e42",lineHeight:"1.5"},children:t.symbol})]})})]}),e("div",{style:{display:"flex",gap:"10px",height:"14px",alignItems:"center",justifyContent:"flex-end"},children:[0,25,50,75,100].map((p,b)=>{const y=Math.abs(u-p)<1,W=b===4,x=p/100,h=l===p,f=w===p;return e("button",{onClick:()=>n(p),onMouseEnter:()=>A(p),onMouseLeave:()=>{A(null),I(null)},onMouseDown:()=>I(p),onMouseUp:()=>I(null),disabled:c,title:`${p}%`,style:{width:"14px",height:"14px",padding:0,border:"none",backgroundColor:"transparent",cursor:c?"not-allowed":"pointer",opacity:y?1:h?.8:.5,transform:f?"scale(0.85)":h?"scale(1.15)":"scale(1)",transition:"all 0.15s ease"},children:s("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:[e("circle",{cx:"7",cy:"7",r:"6.84375",fill:W?"#ea4b4b":"none",stroke:W?"#ea4b4b":"#3C3E42",strokeWidth:"0.3125"}),!W&&x>0&&e("path",{d:`M 7 7 L 7 0.15625 A 6.84375 6.84375 0 ${x>.5?1:0} 1 ${7+6.84375*Math.sin(x*2*Math.PI)} ${7-6.84375*Math.cos(x*2*Math.PI)} Z`,fill:"#3C3E42"})]})},p)})})]})]})})};var cr="data:image/svg+xml,%3csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.83337 11.0833C8.73287 11.0833 11.0834 8.73275 11.0834 5.83325C11.0834 2.93376 8.73287 0.583252 5.83337 0.583252C2.93388 0.583252 0.583374 2.93376 0.583374 5.83325C0.583374 8.73275 2.93388 11.0833 5.83337 11.0833Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.84329 4.48988C5.18981 4.14336 5.36306 3.97011 5.56285 3.90519C5.73859 3.84809 5.92789 3.84809 6.10363 3.90519C6.30342 3.97011 6.47668 4.14336 6.82319 4.48988L7.17663 4.84331C7.52314 5.18983 7.6964 5.36308 7.76131 5.56287C7.81841 5.73861 7.81841 5.92791 7.76131 6.10365C7.6964 6.30344 7.52314 6.4767 7.17663 6.82321L6.82319 7.17665C6.47668 7.52316 6.30342 7.69642 6.10363 7.76133C5.92789 7.81843 5.73859 7.81843 5.56285 7.76133C5.36306 7.69642 5.18981 7.52316 4.84329 7.17665L4.48986 6.82321C4.14334 6.4767 3.97009 6.30344 3.90517 6.10365C3.84807 5.92791 3.84807 5.73861 3.90517 5.56287C3.97009 5.36308 4.14334 5.18983 4.48986 4.84331L4.84329 4.48988Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const pr=({isOpen:t,onClose:r,onComplete:i,title:n="Deposit to Spicenet",description:o="Select tokens and enter amounts to deposit to your Spicenet Account",chainId:c,embeddedWalletAddress:a,externalWalletAddress:d,escrowAddress:g="0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",getChainConfig:m,getSupportedTokens:u})=>{const l=De("light"),[A,w]=C(new Map),[I,S]=C(!1),[p,b]=C(null),[y,W]=C([]),[x,h]=C(!1),[f,k]=C(null),[v,R]=C(null),[F,K]=C(!1),[J,oe]=C(!1),{chain:ee}=gt(),{data:Z,isLoading:H}=oo(),{switchChainAsync:N}=Nt(),E=Qe(()=>u(c),[c,u]),{data:V}=In({contracts:E.map(B=>({address:B.address,abi:$t,functionName:"balanceOf",args:[d],chainId:c}))}),_=Qe(()=>{if(!m(c))return[];const B=[];return E.forEach((q,$)=>{const ie=V?.[$],le=ie?.status==="success"?ie.result:BigInt(0),G=Number(le)/Math.pow(10,q.decimals);B.push({address:q.address,symbol:q.symbol,name:q.name,decimals:q.decimals,isNative:!1,chainId:c,balance:le,balanceFormatted:G})}),B},[c,V,E,m]);X(()=>{if(_.length>0&&A.size>0){const B=new Map(A);let q=!1;A.forEach(($,ie)=>{const le=_.find(G=>G.address===ie);le&&le.balanceFormatted!==$.asset.balanceFormatted&&(B.set(ie,{...$,asset:le}),q=!0)}),q&&w(B)}},[_,A]);const ne=m(c),z=B=>{const q=new Map(A);q.has(B.address)?q.delete(B.address):q.set(B.address,{asset:B,amount:""}),w(q),b(null)},se=(B,q)=>{if(q===""||/^\d*\.?\d*$/.test(q)){const $=new Map(A),ie=$.get(B);ie&&($.set(B,{...ie,amount:q}),w($),b(null))}},me=(B,q)=>{const $=A.get(B);if($?.asset.balanceFormatted!==void 0){const ie=$.asset.balanceFormatted*q/100;se(B,ie.toString())}},he=te(async()=>{if(A.size===0){b("Please select at least one asset");return}for(const[q,$]of Array.from(A.entries())){if(!$.amount){b(`Please enter an amount for ${$.asset.symbol}`);return}const ie=parseFloat($.amount);if(isNaN(ie)||ie<=0){b(`Please enter a valid amount for ${$.asset.symbol}`);return}const le=_.find(G=>G.address===q)?.balanceFormatted??$.asset.balanceFormatted;if(le!==void 0&&ie>le){b(`Insufficient ${$.asset.symbol} balance`);return}}if(!Z){b("Wallet not connected. Please reconnect your external wallet.");return}S(!0),b(null);const B=[];try{ee?.id!==c&&await N({chainId:c});for(const[,q]of Array.from(A.entries())){const{asset:$,amount:ie}=q;try{const le=Ge(ie,$.decimals);let G;if($.isNative)G=await Z.sendTransaction({to:g,value:le});else{const T=vt({abi:$t,functionName:"transfer",args:[g,le]});G=await Z.sendTransaction({to:$.address,data:T})}const ge=Je(c),Ae=await ge.waitForTransactionReceipt({hash:G,timeout:12e4,pollingInterval:2e3,confirmations:2});if(Ae.status!=="success")throw new Error(`Transfer to escrow failed for ${$.symbol}`);await ge.getBlockNumber()-Ae.blockNumber<2&&await new Promise(T=>setTimeout(T,3e3)),await we.submitSpiceDeposit({txHash:G,sender:a,tokenAddress:$.address,chainId:c,amount:Ge(ie,$.decimals).toString(),user:a,isDeposit:!0}),B.push({asset:$,txHash:G,success:!0})}catch(le){const G=le;let ge=G?.message||"Deposit failed";G?.code===4001||G?.message?.includes("rejected")?ge="Transaction rejected by user":G?.message?.includes("insufficient funds")&&(ge="Insufficient funds for transaction"),B.push({asset:$,txHash:"",success:!1,error:ge})}}W(B),h(!0)}catch(q){b(q?.message||"Deposit failed")}finally{S(!1)}},[A,Z,ee,c,N,g,_]);X(()=>{t||(w(new Map),b(null),W([]),h(!1),S(!1))},[t]);const ve=te(()=>{W([]),h(!1),b(null)},[]),L=A.size>0&&Array.from(A.values()).every(B=>B.amount&&parseFloat(B.amount)>0)&&!I&&!x&&Z,P=s("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e("img",{src:lo,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:o})]}),ue=I||x&&y.length>0?e(so,{type:"deposit",isOpen:x&&y.length>0,isProcessing:I,onClose:r,onComplete:i,onRetryTx:ve,onNewTx:()=>{},results:y.length>0?y.map(B=>({asset:{symbol:B.asset.symbol,address:B.asset.address},txHash:B.txHash,success:B.success,error:B.error})):void 0,chainName:lt(c),explorerUrl:ne?.blockExplorers?.default?.url,theme:l}):null;return e(At,{isOpen:t,onClose:r,title:n,subtitle:P,theme:l,maxWidth:"480px",children:s("div",{style:{padding:"0 24px 32px 24px",position:"relative"},children:[ue&&e("div",{style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none"},children:e("div",{style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto"},children:ue})}),s("div",{style:{marginBottom:"16px"},children:[s("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:[e("span",{style:{fontSize:"14px",color:"#6b7280"},children:e("img",{src:cr,alt:"Info",style:{width:"10.5px",height:"10.5px",top:"1.75px",left:"1.75px",flexShrink:0}})}),e("label",{style:{fontSize:"12px",fontWeight:590,color:"#374151"},children:"Select Assets to Deposit"})]}),e("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:_.map(B=>{const q=A.has(B.address);return e("button",{onClick:()=>z(B),onMouseEnter:()=>k(B.address),onMouseLeave:()=>{k(null),R(null)},onMouseDown:()=>R(B.address),onMouseUp:()=>R(null),style:{padding:"4px 8px 4px 8px",borderRadius:"8px",border:`1px solid ${q?"#EA4B4B7A":f===B.address?"#F4A5A5":"#e5e7eb"}`,backgroundColor:q?"#FEF2F2":v===B.address?"#f5f5f5":f===B.address?"#fafafa":"white",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",transition:"all 150ms ease",transform:v===B.address?"scale(0.96)":f===B.address?"translateY(-1px)":"none",boxShadow:q?"0 0 0 3px #FBDBDB":v===B.address?"0 1px 2px rgba(0, 0, 0, 0.05)":f===B.address?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:s("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e(dt,{symbol:B.symbol,size:24,theme:l}),e("span",{style:{fontSize:"16px",fontWeight:510,color:"#3C3E42"},children:B.symbol}),B.balanceFormatted!==void 0&&s("span",{style:{fontSize:"10px",fontWeight:500,color:"#939291",fontFamily:'"IBM Plex Mono", monospace'},children:["(",B.balanceFormatted.toFixed(4),")"]})]})},B.address)})})]}),A.size>0&&e("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:Array.from(A.values()).map(({asset:B,amount:q})=>e(dr,{asset:B,amount:q,onAmountChange:$=>se(B.address,$),onPercentageClick:$=>me(B.address,$),theme:l,disabled:I},B.address))}),p&&e("div",{style:{padding:"12px",backgroundColor:"#fef2f2",border:"1px solid #fecaca",borderRadius:"8px",marginTop:"16px"},children:e("p",{style:{fontSize:"14px",color:"#dc2626",margin:0},children:p})}),!x&&e(je,{variant:"outline",fullWidth:!0,onClick:he,onMouseEnter:()=>K(!0),onMouseLeave:()=>{K(!1),oe(!1)},onMouseDown:()=>oe(!0),onMouseUp:()=>oe(!1),disabled:!L,theme:l,style:{width:"100%",padding:"8px ",backgroundColor:L?J?"#d43d3d":F?"#f05555":"#ea4b4b":"#d1d5db",color:L?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:L?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:L?J?"scale(0.98)":F?"translateY(-2px)":"none":"none",boxShadow:J?"1px 1px 0px black":F&&L?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:I?s(qe,{children:[e("div",{style:{width:"18px",height:"18px",border:"2px solid white",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e("span",{children:"PROCESSING..."})]}):H?"CONNECTING WALLET...":Z?A.size===0?"SELECT ASSETS":Array.from(A.values()).every(B=>B.amount)?"DEPOSIT":"ENTER AMOUNTS":"WALLET NOT CONNECTED"}),e("style",{children:`
|
|
38
|
+
`})]})},Vo=({depositBatches:t,tokenAddress:r,tokenDecimals:i,supportedChains:n,supportedTokens:o,theme:c="light",styles:a,className:d="",depositInputHook:g,onDepositSuccess:m,onDepositError:u,onTopUp:l})=>{const A=De(c),w={...A,typography:{...A.typography,fontFamily:a?.fontFamily||A.typography.fontFamily},colors:{...A.colors,primary:a?.primaryColor||A.colors.primary,primaryHover:a?.primaryColor?`${a.primaryColor}dd`:A.colors.primaryHover}},I=Pt(),{isReady:S,isAuthenticated:p,isConnected:b,address:y,provider:W,actions:x}=I,[h,f]=C(null),{assets:k,loading:v,error:R,hasBalance:F,refetch:K}=Uo({address:y,supportedChains:n,enabled:b,refetchInterval:3e4}),[J,oe]=C(!1),[ee,Z]=C(null),[H,N]=C(!1),[E,V]=C(!1),[_,ne]=C(!1),z=Me(null),{intentStatus:se,startStatusPolling:me,clearStatus:he}=Wt({checkStepStatus:(G,ge)=>we.checkStepStatus(G,ge)});X(()=>{if(se?.overallStatus==="success"&&se.intentId&&z.current!==se.intentId&&h&&y){const G=se.steps.find(ge=>ge.transactionHash);if(G?.transactionHash){z.current=se.intentId;const ge=Ge(h.amount,h.asset.decimals);we.submitSpiceDeposit({user:y,txHash:G.transactionHash,sender:y,tokenAddress:h.asset.address,chainId:h.asset.chainId,amount:ge.toString(),isDeposit:!1}).then(()=>{K()}).catch(()=>{z.current=null})}}},[se,y]),X(()=>{g&&g.assetAmount!==h?.amount&&h&&f({...h,amount:g.assetAmount})},[g?.assetAmount,h]);const ve=te(()=>{Z(null)},[]),L=G=>{f({asset:G,amount:h?.amount||""}),ve()},P=te(G=>{h&&(wo(()=>{f({...h,amount:G}),ve()}),g&&g.setAssetAmount(G))},[h,g,ve]),ue=async()=>{if(!(!h||!y||t.length===0)){if(!S||!p){Z(`Please authenticate with ${W||"wallet provider"} to continue`);return}oe(!0),Z(null),ne(!0);try{const G=[...t],ge=[...new Set(G.map(pe=>pe.chainId))],Ae=[];for(const pe of ge){const Pe=Je(pe),D=mt(pe),O=await zt(y,Pe),de=await x.signAuthorization({contractAddress:D,chainId:pe,nonce:Number(O)});Ae.push(de)}const T=Vt(G),ae=Math.floor(Date.now()/1e3)+60*10,ce=Tt(0n,BigInt(ae),T),Ie=await x.signMessage({raw:ce}),Ee=typeof Ie=="string"?Ie:Ie.signature;if(!Ee)throw new Error("Failed to sign intent authorization");const ke={mode:"7702",signatureType:"ecdsa",signature:Ee,nbf:0,exp:ae,chainBatches:T.map(pe=>({hash:pe.hash,chainId:pe.chainId,tokenTransfers:[{from:"solver",to:y,token:"0x0000000000000000000000000000000000000000",amount:Ge("0.01",18)},{from:"solver",to:y,token:r,amount:Ge(h.amount,i)}],calls:pe.calls}))},Se=await we.createAction({user:y,chainAuthorizations:Ae.map(pe=>({...pe,r:pe.r,s:pe.s,yParity:pe.yParity,address:pe.address,chainId:Number(pe.chainId),nonce:Number(pe.nonce)})),intents:[ke]});if(Se){const pe=Lt(G,de=>`Chain ${de}`),[Pe,D]=Se.intentIds[0].split("/"),O=parseInt(D||"0",10);me(Se.intentIds[0],pe);for(let de=0;de<G.length;de++)await we.executeStep(Pe,O,de,{action:"execute"})}}catch(G){const ge=G instanceof Error?G.message:"Deposit failed";Z(ge),u?.(ge)}finally{oe(!1)}}},B=Qe(()=>o&&o.length>0?k.filter(G=>o.some(ge=>ge.toLowerCase()===G.symbol.toLowerCase())):k,[k,o]),q=h&&h.amount&&parseFloat(h.amount)>0&&parseFloat(h.amount)<=h.asset.balanceFormatted&&b&&!J&&t.length>0,$=R||ee,ie={backgroundColor:a?.container?.backgroundColor||a?.primaryBackground||w.colors.background,border:`1px solid ${a?.container?.borderColor||w.colors.border}`,borderRadius:a?.container?.borderRadius||w.borderRadius.lg,padding:a?.container?.padding||w.spacing.md,width:a?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:w.colors.text,fontFamily:w.typography.fontFamily,boxShadow:a?.container?.boxShadow||(w.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},le=se?e(so,{type:"deposit",isOpen:!!se&&se.overallStatus!=="processing",isProcessing:J||se?.overallStatus==="processing",onRetryTx:()=>{he(),ne(!1),ue()},onNewTx:()=>{he(),ne(!1),f(null),z.current=null,K()},onClose:()=>{he(),ne(!1)},onComplete:()=>{he(),ne(!1),f(null),z.current=null,K()},results:se?.overallStatus==="success"||se?.overallStatus==="failed"?se.steps.map(G=>({asset:{symbol:h?.asset.symbol||"Token",address:h?.asset.address||""},txHash:G.transactionHash||"",success:G.status==="success",amount:h?.amount})):void 0,chainName:h?lt(t[t.length-1].chainId):"Network",explorerUrl:h?Yt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:w}):null;return s("div",{style:{...ie,position:"relative"},className:d,children:[le&&e("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:le})}),!v&&!F&&e("div",{style:{backgroundColor:w.mode==="light"?"#fef3c7":`${w.colors.warning||"#f59e0b"}20`,border:`1px solid ${w.mode==="light"?"#fcd34d":w.colors.warning||"#f59e0b"}`,borderRadius:w.borderRadius.md,padding:w.spacing.md,marginBottom:w.spacing.md,textAlign:"center"},children:s("p",{style:{color:w.mode==="light"?"#92400e":"#fbbf24",fontSize:w.typography.fontSize.sm,fontFamily:w.typography.fontFamily,margin:0,lineHeight:1.5},children:["You do not have any cross-chain balance."," ",l&&e("span",{onClick:l,style:{color:w.colors.primary,textDecoration:"underline",cursor:"pointer",fontWeight:600},children:"Top-up here."})]})}),e("div",{style:{marginBottom:w.spacing.sm},children:e(bt,{assets:B,selectedAsset:h||void 0,onAssetSelect:L,onAmountChange:P,loading:v,label:"Amount",showBalance:!0,showMaxButton:!0,theme:w,styles:a})}),$&&e("div",{style:{backgroundColor:a?.errorMessage?.backgroundColor||(w.mode==="light"?"#fef2f2":`${a?.statusDisplay?.errorColor||w.colors.error}20`),border:`1px solid ${a?.errorMessage?.borderColor||(w.mode==="light"?"#fecaca":a?.statusDisplay?.errorColor||w.colors.error)}`,borderRadius:a?.errorMessage?.borderRadius||w.borderRadius.md,padding:a?.errorMessage?.padding||w.spacing.md,marginBottom:w.spacing.sm},children:e("p",{style:{color:a?.errorMessage?.color||a?.statusDisplay?.errorColor||w.colors.error,fontSize:a?.errorMessage?.fontSize||w.typography.fontSize.sm,fontWeight:a?.errorMessage?.fontWeight,fontFamily:a?.errorMessage?.fontFamily||w.typography.fontFamily,margin:0},children:$})}),e("div",{style:{display:"flex",flexDirection:"column",gap:w.spacing.sm},children:e(je,{variant:"outline",fullWidth:!0,onClick:ue,onMouseEnter:()=>N(!0),onMouseLeave:()=>{N(!1),V(!1)},onMouseDown:()=>V(!0),onMouseUp:()=>V(!1),loading:J,disabled:!q||!b,theme:w,styles:a,style:{width:"100%",padding:"8px",backgroundColor:q?E?"#d43d3d":H?"#f05555":"#ea4b4b":"#d1d5db",color:q?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:q?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:q?E?"scale(0.98)":H?"translateY(-2px)":"none":"none",boxShadow:E?"1px 1px 0px black":H&&q?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:S?p?b?J?"Executing Deposit...":h?h.amount?parseFloat(h.amount)>h.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Deposit Batches":"Execute Deposit":"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})};var To="data:image/svg+xml,%3csvg width='108' height='22' viewBox='0 0 108 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1.9916 11.9854V11.2041H3.98379C4.48835 11.2041 4.87897 11.0739 5.15566 10.8135C5.43236 10.5498 5.5707 10.1868 5.5707 9.72461V9.71484C5.5707 9.24935 5.43236 8.88639 5.15566 8.62598C4.87897 8.36556 4.48835 8.23535 3.98379 8.23535H1.9916V7.4541H4.2084C4.65111 7.4541 5.04173 7.5485 5.38027 7.7373C5.71882 7.92611 5.98411 8.18978 6.17617 8.52832C6.37148 8.86686 6.46914 9.25911 6.46914 9.70508V9.71484C6.46914 10.1608 6.37148 10.5547 6.17617 10.8965C5.98411 11.2383 5.71882 11.5052 5.38027 11.6973C5.04173 11.8893 4.65111 11.9854 4.2084 11.9854H1.9916ZM1.55215 14.5V7.4541H2.43106V14.5H1.55215ZM9.51875 14.5928C9.0207 14.5928 8.58939 14.4837 8.2248 14.2656C7.86348 14.0443 7.58353 13.7301 7.38496 13.3232C7.18965 12.9163 7.09199 12.4329 7.09199 11.873V11.8633C7.09199 11.3001 7.18965 10.8151 7.38496 10.4082C7.58353 10.0013 7.86348 9.6888 8.2248 9.4707C8.58939 9.2526 9.0207 9.14355 9.51875 9.14355C10.0201 9.14355 10.4514 9.2526 10.8127 9.4707C11.174 9.6888 11.4523 10.0013 11.6477 10.4082C11.8462 10.8151 11.9455 11.3001 11.9455 11.8633V11.873C11.9455 12.4329 11.8462 12.9163 11.6477 13.3232C11.4523 13.7301 11.174 14.0443 10.8127 14.2656C10.4514 14.4837 10.0201 14.5928 9.51875 14.5928ZM9.51875 13.8408C9.85078 13.8408 10.1324 13.7627 10.3635 13.6064C10.5946 13.4502 10.7704 13.2256 10.8908 12.9326C11.0145 12.6396 11.0764 12.2865 11.0764 11.873V11.8633C11.0764 11.4466 11.0145 11.0918 10.8908 10.7988C10.7704 10.5059 10.5946 10.2829 10.3635 10.1299C10.1324 9.97363 9.85078 9.89551 9.51875 9.89551C9.18672 9.89551 8.90514 9.97363 8.67402 10.1299C8.4429 10.2829 8.26549 10.5059 8.1418 10.7988C8.02135 11.0918 7.96113 11.4466 7.96113 11.8633V11.873C7.96113 12.2865 8.02135 12.6396 8.1418 12.9326C8.26549 13.2256 8.4429 13.4502 8.67402 13.6064C8.90514 13.7627 9.18672 13.8408 9.51875 13.8408ZM13.7842 14.5L12.3096 9.23633H13.1592L14.1943 13.4453H14.2725L15.4492 9.23633H16.2549L17.4316 13.4453H17.5098L18.5449 9.23633H19.3896L17.915 14.5H17.0605L15.8838 10.4277H15.8057L14.6338 14.5H13.7842ZM22.1658 14.5928C21.6645 14.5928 21.2332 14.4821 20.8719 14.2607C20.5138 14.0394 20.2371 13.7269 20.0418 13.3232C19.8497 12.9163 19.7537 12.4378 19.7537 11.8877V11.8828C19.7537 11.3392 19.8497 10.8623 20.0418 10.4521C20.2371 10.042 20.5122 9.72135 20.867 9.49023C21.2218 9.25911 21.6368 9.14355 22.1121 9.14355C22.5906 9.14355 23.0008 9.25423 23.3426 9.47559C23.6876 9.69694 23.9513 10.0062 24.1336 10.4033C24.3191 10.7972 24.4119 11.2562 24.4119 11.7803V12.1123H20.1932V11.4336H23.9773L23.5574 12.0537V11.7168C23.5574 11.3034 23.4956 10.9632 23.3719 10.6963C23.2482 10.4294 23.0773 10.2308 22.8592 10.1006C22.6411 9.96712 22.3904 9.90039 22.1072 9.90039C21.824 9.90039 21.5701 9.97038 21.3455 10.1104C21.1242 10.2471 20.9484 10.4505 20.8182 10.7207C20.688 10.9909 20.6229 11.3229 20.6229 11.7168V12.0537C20.6229 12.4281 20.6863 12.7487 20.8133 13.0156C20.9402 13.2793 21.1209 13.4827 21.3553 13.626C21.5896 13.766 21.8663 13.8359 22.1854 13.8359C22.423 13.8359 22.6297 13.8034 22.8055 13.7383C22.9813 13.6732 23.1261 13.5902 23.24 13.4893C23.354 13.3883 23.4337 13.2858 23.4793 13.1816L23.4988 13.1377H24.3484L24.3387 13.1768C24.2931 13.3558 24.2117 13.5299 24.0945 13.6992C23.9806 13.8652 23.8325 14.0166 23.6502 14.1533C23.4679 14.2868 23.2514 14.3942 23.0008 14.4756C22.7534 14.5537 22.4751 14.5928 22.1658 14.5928ZM25.4303 14.5V9.23633H26.2799V10.0176H26.358C26.4589 9.74089 26.6298 9.52604 26.8707 9.37305C27.1116 9.22005 27.4094 9.14355 27.7643 9.14355C27.8456 9.14355 27.9254 9.14844 28.0035 9.1582C28.0849 9.16471 28.1467 9.17122 28.1891 9.17773V10.0029C28.1012 9.98665 28.0149 9.97526 27.9303 9.96875C27.8489 9.95898 27.761 9.9541 27.6666 9.9541C27.3964 9.9541 27.1572 10.0078 26.9488 10.1152C26.7405 10.2227 26.5761 10.3724 26.4557 10.5645C26.3385 10.7565 26.2799 10.9811 26.2799 11.2383V14.5H25.4303ZM30.9408 14.5928C30.4395 14.5928 30.0082 14.4821 29.6469 14.2607C29.2888 14.0394 29.0121 13.7269 28.8168 13.3232C28.6247 12.9163 28.5287 12.4378 28.5287 11.8877V11.8828C28.5287 11.3392 28.6247 10.8623 28.8168 10.4521C29.0121 10.042 29.2872 9.72135 29.642 9.49023C29.9968 9.25911 30.4118 9.14355 30.8871 9.14355C31.3656 9.14355 31.7758 9.25423 32.1176 9.47559C32.4626 9.69694 32.7263 10.0062 32.9086 10.4033C33.0941 10.7972 33.1869 11.2562 33.1869 11.7803V12.1123H28.9682V11.4336H32.7523L32.3324 12.0537V11.7168C32.3324 11.3034 32.2706 10.9632 32.1469 10.6963C32.0232 10.4294 31.8523 10.2308 31.6342 10.1006C31.4161 9.96712 31.1654 9.90039 30.8822 9.90039C30.599 9.90039 30.3451 9.97038 30.1205 10.1104C29.8992 10.2471 29.7234 10.4505 29.5932 10.7207C29.463 10.9909 29.3979 11.3229 29.3979 11.7168V12.0537C29.3979 12.4281 29.4613 12.7487 29.5883 13.0156C29.7152 13.2793 29.8959 13.4827 30.1303 13.626C30.3646 13.766 30.6413 13.8359 30.9604 13.8359C31.198 13.8359 31.4047 13.8034 31.5805 13.7383C31.7563 13.6732 31.9011 13.5902 32.015 13.4893C32.129 13.3883 32.2087 13.2858 32.2543 13.1816L32.2738 13.1377H33.1234L33.1137 13.1768C33.0681 13.3558 32.9867 13.5299 32.8695 13.6992C32.7556 13.8652 32.6075 14.0166 32.4252 14.1533C32.2429 14.2868 32.0264 14.3942 31.7758 14.4756C31.5284 14.5537 31.2501 14.5928 30.9408 14.5928ZM36.1486 14.5928C35.7059 14.5928 35.3186 14.4805 34.9865 14.2559C34.6545 14.0312 34.3973 13.7155 34.215 13.3086C34.0328 12.8984 33.9416 12.4199 33.9416 11.873V11.8633C33.9416 11.3132 34.0328 10.8346 34.215 10.4277C34.3973 10.0208 34.6529 9.70508 34.9816 9.48047C35.3137 9.25586 35.7027 9.14355 36.1486 9.14355C36.3895 9.14355 36.6158 9.18262 36.8273 9.26074C37.0422 9.33561 37.2326 9.44141 37.3986 9.57812C37.5647 9.71484 37.6949 9.8776 37.7893 10.0664H37.8674V7.14648H38.717V14.5H37.8674V13.6602H37.7893C37.6818 13.8555 37.5467 14.0231 37.384 14.1631C37.2212 14.2998 37.0357 14.4056 36.8273 14.4805C36.619 14.5553 36.3928 14.5928 36.1486 14.5928ZM36.3439 13.8408C36.663 13.8408 36.938 13.7611 37.1691 13.6016C37.4003 13.4421 37.5777 13.2158 37.7014 12.9229C37.8251 12.6266 37.8869 12.2767 37.8869 11.873V11.8633C37.8869 11.4564 37.8251 11.1064 37.7014 10.8135C37.5777 10.5205 37.4003 10.2943 37.1691 10.1348C36.938 9.97526 36.663 9.89551 36.3439 9.89551C36.0249 9.89551 35.7499 9.97526 35.5188 10.1348C35.2909 10.291 35.1151 10.5156 34.9914 10.8086C34.871 11.1016 34.8107 11.4531 34.8107 11.8633V11.873C34.8107 12.2799 34.871 12.6315 34.9914 12.9277C35.1151 13.2207 35.2909 13.4469 35.5188 13.6064C35.7499 13.7627 36.0249 13.8408 36.3439 13.8408ZM45.1775 14.5928C44.9334 14.5928 44.7072 14.5553 44.4988 14.4805C44.2905 14.4056 44.1049 14.2998 43.9422 14.1631C43.7794 14.0231 43.6443 13.8555 43.5369 13.6602H43.4588V14.5H42.6092V7.14648H43.4588V10.0664H43.5369C43.6346 9.8776 43.7648 9.71484 43.9275 9.57812C44.0936 9.44141 44.2824 9.33561 44.4939 9.26074C44.7088 9.18262 44.9367 9.14355 45.1775 9.14355C45.6235 9.14355 46.0109 9.25586 46.3396 9.48047C46.6717 9.70508 46.9288 10.0208 47.1111 10.4277C47.2934 10.8346 47.3846 11.3132 47.3846 11.8633V11.873C47.3846 12.4199 47.2934 12.8984 47.1111 13.3086C46.9288 13.7155 46.6717 14.0312 46.3396 14.2559C46.0109 14.4805 45.6235 14.5928 45.1775 14.5928ZM44.9822 13.8408C45.3045 13.8408 45.5796 13.7627 45.8074 13.6064C46.0353 13.4469 46.2094 13.2207 46.3299 12.9277C46.4536 12.6315 46.5154 12.2799 46.5154 11.873V11.8633C46.5154 11.4531 46.4536 11.1016 46.3299 10.8086C46.2094 10.5156 46.0353 10.291 45.8074 10.1348C45.5796 9.97526 45.3045 9.89551 44.9822 9.89551C44.6632 9.89551 44.3881 9.97526 44.157 10.1348C43.9259 10.2943 43.7485 10.5205 43.6248 10.8135C43.5011 11.1064 43.4393 11.4564 43.4393 11.8633V11.873C43.4393 12.2767 43.5011 12.6266 43.6248 12.9229C43.7485 13.2158 43.9259 13.4421 44.157 13.6016C44.3881 13.7611 44.6632 13.8408 44.9822 13.8408ZM48.6568 16.3457C48.6015 16.3457 48.5396 16.3424 48.4713 16.3359C48.4029 16.3327 48.3395 16.3262 48.2809 16.3164V15.6182C48.3329 15.6279 48.3899 15.6344 48.4518 15.6377C48.5136 15.641 48.5738 15.6426 48.6324 15.6426C48.8733 15.6426 49.0702 15.5807 49.2232 15.457C49.3795 15.3333 49.5048 15.1201 49.5992 14.8174L49.6969 14.5049L47.7486 9.23633H48.6568L50.2779 14.0996L49.941 13.5674H50.3414L50.0045 14.0996L51.6207 9.23633H52.5143L50.4586 14.8223C50.3154 15.2161 50.164 15.5238 50.0045 15.7451C49.845 15.9665 49.6578 16.1211 49.443 16.209C49.2314 16.3001 48.9693 16.3457 48.6568 16.3457Z' fill='%230E0D0B'/%3e%3cpath d='M62.7081 13.27C62.742 13.27 62.7642 13.3057 62.7491 13.3362V13.336L61.1229 16.6083C61.0892 16.6761 60.9926 16.6759 60.959 16.6083L59.3382 13.336C59.3232 13.3057 59.3453 13.27 59.3792 13.27H62.7081Z' fill='%23EA4B4B'/%3e%3cpath d='M61.0026 9.71913C61.0194 9.68524 61.0678 9.68524 61.0845 9.71913L62.747 13.0897C62.762 13.12 62.7399 13.1557 62.706 13.1557H59.3763C59.3424 13.1557 59.3203 13.12 59.3353 13.0897L61.0026 9.71913Z' fill='%23EA4B4B'/%3e%3cpath d='M60.8426 9.63827C60.8766 9.63827 60.8987 9.6741 60.8835 9.70444L59.2164 13.0594C59.1995 13.0932 59.1513 13.0932 59.1345 13.0594L57.5001 9.77047C57.47 9.70962 57.5142 9.63827 57.5821 9.63827H60.8426Z' fill='%23EA4B4B'/%3e%3cpath d='M64.5036 9.63617C64.5715 9.63618 64.6157 9.70753 64.5855 9.76838H64.5854L62.9512 13.0573C62.9344 13.0911 62.8862 13.0912 62.8692 13.0573L61.2021 9.70235C61.187 9.672 61.2091 9.63617 61.2431 9.63617H64.5036Z' fill='%23EA4B4B'/%3e%3cpath d='M62.8284 6.18281C62.862 6.11518 62.9586 6.11518 62.9922 6.18281L64.5855 9.38969C64.6157 9.45054 64.5715 9.52189 64.5036 9.52189H61.2431C61.2091 9.52189 61.187 9.48605 61.2021 9.45571L62.8283 6.18265L62.8284 6.18281Z' fill='%23EA4B4B'/%3e%3cpath d='M62.3131 6.13196C62.381 6.13196 62.4252 6.20331 62.3951 6.26416C62.154 6.74935 61.9128 7.23455 61.6718 7.71975H61.6716C61.4225 8.22125 61.1733 8.72259 60.9242 9.22409C60.9074 9.25799 60.859 9.25799 60.8422 9.22409L60.6305 8.79587C60.6275 8.78957 60.6259 8.78263 60.6259 8.77553V6.22349C60.6259 6.17297 60.6668 6.13196 60.7173 6.13196H62.3131Z' fill='%23EA4B4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M74.8537 10.0096C75.2721 10.0096 75.654 10.1125 75.9993 10.3184C76.3513 10.5177 76.6303 10.8032 76.8361 11.1751C77.0487 11.547 77.1549 11.9953 77.1549 12.52V12.6495C77.1549 13.1675 77.052 13.6158 76.8461 13.9943C76.6402 14.3729 76.3613 14.6618 76.0093 14.861C75.664 15.0603 75.2788 15.1599 74.8537 15.1599C74.515 15.1599 74.2261 15.1134 73.9871 15.0204C73.7546 14.9341 73.5653 14.8212 73.4192 14.6817C73.2731 14.5423 73.1602 14.3995 73.0805 14.2534H72.941V16.9659L72.1541 16.0013V10.1491H72.9211V10.956H73.0352C73.2729 10.6733 73.3893 10.4911 73.6683 10.2985C73.9538 10.1059 74.349 10.0096 74.8537 10.0096ZM74.6445 10.7069C74.1464 10.7069 73.7347 10.8696 73.4092 11.195C73.0905 11.5138 72.9311 11.9621 72.9311 12.5399V12.6296C72.9311 13.2074 73.0905 13.659 73.4092 13.9844C73.7347 14.3032 74.1464 14.4626 74.6445 14.4626C75.1492 14.4626 75.5577 14.3032 75.8698 13.9844C76.1886 13.659 76.348 13.2074 76.348 12.6296V12.5399C76.348 11.9621 76.1886 11.5138 75.8698 11.195C75.5577 10.8696 75.1492 10.7069 74.6445 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M78.5848 11.9583L78.5555 15.4596L77.7681 14.4846V10.9583L78.5848 11.9583Z' fill='%230E0D0B'/%3e%3cpath d='M101.588 10.2986H102.444L103 10.986H101.588V10.9867H100.802L101.588 11.9623V14.1937C101.588 14.3929 101.685 14.4926 101.877 14.4926H102.379L102.928 15.17H101.668C101.389 15.17 101.173 15.0936 101.021 14.9409C100.874 14.7881 100.801 14.5789 100.801 14.3133V10.986H99.8799L99.3217 10.2986H100.801V9.13501H101.588V10.2986Z' fill='%230E0D0B'/%3e%3cpath d='M69.0133 7.90764C69.4848 7.90764 69.9065 7.99068 70.2784 8.15671C70.6569 8.3161 70.9525 8.55517 71.165 8.87395C71.3842 9.18609 71.4938 9.58126 71.4938 10.0594V10.4778H70.667V10.0594C70.667 9.72072 70.5939 9.44842 70.4477 9.24254C70.3083 9.03666 70.1124 8.88392 69.86 8.7843C69.6143 8.68469 69.332 8.63487 69.0133 8.63487C68.555 8.63487 68.1864 8.7378 67.9075 8.94367C67.6286 9.14291 67.4891 9.4285 67.4891 9.80041C67.4891 10.0461 67.5488 10.2453 67.6684 10.3981C67.7879 10.5508 67.9573 10.677 68.1764 10.7767C68.3956 10.8696 68.658 10.9527 68.9635 11.0257L69.4815 11.1552C69.8866 11.2416 70.2485 11.3611 70.5673 11.5138C70.8927 11.6599 71.1517 11.8625 71.3443 12.1215C71.5369 12.3739 71.6332 12.706 71.6332 13.1177C71.6332 13.5295 71.5303 13.8881 71.3244 14.1936C71.1185 14.4991 70.8263 14.7382 70.4477 14.9109C70.0758 15.0769 69.6375 15.1599 69.1328 15.1599C68.6281 15.1599 68.1765 15.0702 67.778 14.8909C67.3795 14.7116 67.0641 14.4426 66.8316 14.084C66.6058 13.7187 66.4929 13.2638 66.4929 12.7192V12.51H67.3197V12.7192C67.3197 13.297 67.4891 13.7287 67.8278 14.0143C68.1665 14.2932 68.6015 14.4327 69.1328 14.4327C69.6774 14.4327 70.0924 14.3098 70.378 14.0641C70.6636 13.8183 70.8064 13.5095 70.8064 13.1376C70.8064 12.8786 70.74 12.6727 70.6072 12.52C70.481 12.3673 70.3017 12.2444 70.0692 12.1514C69.8368 12.0518 69.5645 11.9655 69.2523 11.8924L68.7343 11.7629C68.3292 11.6566 67.9706 11.5271 67.6584 11.3744C67.3463 11.2216 67.1006 11.0224 66.9213 10.7767C66.7486 10.5243 66.6623 10.2022 66.6623 9.81035C66.6623 9.41852 66.7585 9.07981 66.9511 8.79424C67.1504 8.50866 67.426 8.28953 67.778 8.13678C68.1366 7.98404 68.5484 7.90764 69.0133 7.90764Z' fill='%230E0D0B'/%3e%3cpath d='M81.6544 10.0096C82.1193 10.0096 82.5145 10.0959 82.8399 10.2686C83.1719 10.4412 83.431 10.6704 83.6169 10.956C83.8095 11.2415 83.9324 11.5471 83.9855 11.8725L83.2185 12.0318C83.1853 11.7928 83.1056 11.5736 82.9794 11.3744C82.8598 11.1752 82.6905 11.0158 82.4713 10.8962C82.2521 10.7767 81.9832 10.7169 81.6644 10.7169C81.339 10.7169 81.0468 10.7899 80.7877 10.936C80.5354 11.0821 80.3328 11.2914 80.1801 11.5637C80.034 11.836 79.9609 12.1614 79.9609 12.5399V12.6296C79.9609 13.0081 80.034 13.3335 80.1801 13.6058C80.3328 13.8781 80.5354 14.0873 80.7877 14.2334C81.0468 14.3795 81.339 14.4526 81.6644 14.4526C82.1492 14.4526 82.5178 14.3264 82.7702 14.0741C83.0292 13.8217 83.1886 13.5095 83.2483 13.1376L84.0254 13.307C83.9523 13.6257 83.8195 13.9279 83.6269 14.2135C83.4343 14.4991 83.172 14.7282 82.8399 14.9009C82.5145 15.0735 82.1193 15.1599 81.6544 15.1599C81.1829 15.1599 80.7579 15.0603 80.3793 14.861C80.0074 14.6551 79.7119 14.363 79.4927 13.9844C79.2802 13.6059 79.1739 13.1575 79.1739 12.6395V12.5299C79.1739 12.0053 79.2802 11.557 79.4927 11.1851C79.7119 10.8066 80.0074 10.5177 80.3793 10.3184C80.7579 10.1126 81.1829 10.0096 81.6544 10.0096Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M86.7515 10.0096C87.2097 10.0096 87.6149 10.1092 87.9668 10.3084C88.3188 10.501 88.5944 10.78 88.7937 11.1452C88.9929 11.5105 89.0925 11.9389 89.0925 12.4304V12.7889H85.1177C85.1377 13.3136 85.3071 13.7254 85.6258 14.0243C85.9446 14.3165 86.3431 14.4626 86.8212 14.4626C87.2396 14.4626 87.5617 14.3663 87.7875 14.1737C88.0133 13.9811 88.186 13.752 88.3056 13.4863L88.983 13.815C88.8833 14.0209 88.7439 14.2268 88.5646 14.4327C88.3919 14.6386 88.1628 14.8113 87.8772 14.9507C87.5983 15.0902 87.2396 15.1599 86.8013 15.1599C86.3099 15.1599 85.8782 15.057 85.5063 14.8511C85.1344 14.6386 84.8455 14.343 84.6396 13.9645C84.4337 13.5859 84.3307 13.1476 84.3307 12.6495V12.5299C84.3307 12.0252 84.4337 11.5836 84.6396 11.205C84.8455 10.8265 85.1311 10.5342 85.4963 10.3284C85.8616 10.1159 86.28 10.0096 86.7515 10.0096ZM86.7515 10.7069C86.3066 10.7069 85.9413 10.8331 85.6557 11.0855C85.3701 11.3378 85.1941 11.6898 85.1277 12.1414H88.2956C88.269 11.6898 88.113 11.3378 87.8274 11.0855C87.5485 10.8331 87.1898 10.7069 86.7515 10.7069Z' fill='%230E0D0B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M97.1624 10.0096C97.6207 10.0096 98.0258 10.1092 98.3778 10.3084C98.7298 10.501 99.0054 10.78 99.2046 11.1452C99.4039 11.5105 99.5035 11.9389 99.5035 12.4304V12.7889H95.5287C95.5487 13.3136 95.718 13.7254 96.0368 14.0243C96.3555 14.3165 96.754 14.4626 97.2322 14.4626C97.6505 14.4626 97.9727 14.3663 98.1985 14.1737C98.4243 13.9811 98.5969 13.752 98.7165 13.4863L99.3939 13.815C99.2943 14.0209 99.1548 14.2268 98.9755 14.4327C98.8028 14.6386 98.5737 14.8113 98.2881 14.9507C98.0092 15.0902 97.6506 15.1599 97.2123 15.1599C96.7208 15.1599 96.2892 15.057 95.9172 14.8511C95.5453 14.6386 95.2564 14.343 95.0505 13.9645C94.8446 13.5859 94.7417 13.1476 94.7417 12.6495V12.5299C94.7417 12.0252 94.8446 11.5836 95.0505 11.205C95.2564 10.8265 95.542 10.5342 95.9073 10.3284C96.2725 10.1158 96.6909 10.0096 97.1624 10.0096ZM97.1624 10.7069C96.7175 10.7069 96.3522 10.8331 96.0666 11.0855C95.7811 11.3378 95.6051 11.6898 95.5387 12.1414H98.7066C98.68 11.6898 98.5239 11.3378 98.2383 11.0855C97.9594 10.8331 97.6008 10.7069 97.1624 10.7069Z' fill='%230E0D0B'/%3e%3cpath d='M92.2484 10.0594C92.6137 10.0594 92.9391 10.1358 93.2247 10.2885C93.5169 10.4413 93.7494 10.6671 93.9221 10.966C94.0947 11.2648 94.1811 11.6334 94.1811 12.0717V15.1458H93.394V12.1315C93.394 11.6467 93.2712 11.2947 93.0255 11.0755C92.7864 10.8564 92.461 10.7468 92.0492 10.7468C91.5777 10.7468 91.1925 10.8995 90.8936 11.205C90.6014 11.5105 90.4553 11.9655 90.4553 12.5698V15.1458H89.6683V10.1491H90.4354V10.9582H90.5361C90.7355 10.7018 90.8604 10.5342 91.1128 10.3483C91.3718 10.1557 91.7503 10.0594 92.2484 10.0594Z' fill='%230E0D0B'/%3e%3cpath d='M78.5932 10.9581H77.7681V10.1514H78.6L78.5932 10.9581Z' fill='%230E0D0B'/%3e%3c/svg%3e";const At=({isOpen:t,onClose:r,title:i,subtitle:n,children:o,overlayContent:c,styles:a,theme:d,maxWidth:g="522px"})=>{const m=d||De("light");return t?e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:50},children:s("div",{style:{border:"6px solid #E9E9E9",backgroundColor:"white",borderRadius:"12px",width:"100%",padding:"0",display:"flex",flexDirection:"column",maxWidth:g,position:"relative",overflow:"hidden"},children:[c&&e("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:5,pointerEvents:"none",borderRadius:"12px"}}),s("div",{style:{padding:"24px 24px 16px 24px",borderBottom:"1px solid #cdcfd1",position:"relative"},children:[e("button",{onClick:r,style:{position:"absolute",top:"16px",right:"16px",color:"#111827",padding:"8px",backgroundColor:"transparent",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",fontSize:"20px",fontWeight:"600"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e("h2",{style:{fontSize:"23px",fontWeight:"600",color:"#111827",margin:"0",fontFamily:a?.fontFamily||m.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:i})]}),n&&e("div",{style:{padding:"16px 24px 0px 24px",fontSize:"12px",color:"#6b7280",margin:"0 0 2rem 0",lineHeight:"1.4",fontFamily:a?.fontFamily||m.typography.fontFamily||"system-ui, -apple-system, sans-serif"},children:n}),o,s("div",{style:{padding:"0px 28px 8px 28px",margin:0,marginTop:"10px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("img",{src:To,alt:"Powered by SpiceNet",style:{height:"auto",width:"auto",opacity:1,margin:0,display:"block"}}),s("a",{href:"https://spicenet.io/accounts",target:"_blank",rel:"noopener noreferrer",style:{fontSize:"10px",color:"#51514f",textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",fontFamily:a?.fontFamily||m.typography.fontFamily,lineHeight:"1"},children:[e("span",{children:"Learn more about"}),e("span",{style:{color:a?.primaryColor||m.colors.primary,textDecoration:"underline",fontWeight:"500"},children:"Spicenet accounts \u2192"})]})]}),c]})}):null};var lo="data:image/svg+xml,%3csvg width='15' height='15' viewBox='0 0 15 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 7.49993V10.4999M7.5 4.96868V4.96784M14.25 7.5C14.25 11.2279 11.2279 14.25 7.5 14.25C3.77208 14.25 0.75 11.2279 0.75 7.5C0.75 3.77208 3.77208 0.75 7.5 0.75C11.2279 0.75 14.25 3.77208 14.25 7.5Z' stroke='%23ED6969' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const lr=({isOpen:t,onClose:r,title:i="Deposit",maxWidth:n="480px",depositBatches:o,tokenAddress:c,tokenDecimals:a,supportedChains:d,supportedTokens:g,theme:m="light",styles:u,className:l,depositInputHook:A,onDepositSuccess:w,onDepositError:I})=>{const S=De(m),p=b=>{w?.(b)};return e(At,{isOpen:t,onClose:r,title:i,subtitle:s("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e("img",{src:lo,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Use your cross-chain balance to deposit WBTC to earn 6.3% yield, all in one click."})]}),styles:u,theme:S,maxWidth:n,children:e("div",{style:{padding:"0 24px 24px 24px"},children:e(Vo,{depositBatches:o,tokenAddress:c,tokenDecimals:a,supportedChains:d,supportedTokens:g,theme:m,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,depositInputHook:A,onDepositSuccess:p,onDepositError:I})})})},dr=({asset:t,amount:r,onAmountChange:i,onPercentageClick:n,usdValue:o,disabled:c,styles:a,theme:d})=>{const g=t.balanceFormatted??0,m=parseFloat(r)||0,u=g>0?m/g*100:0,[l,A]=C(null),[w,I]=C(null),S=p=>{const b=p.target.value;(b===""||/^\d*\.?\d*$/.test(b))&&i(b)};return e("div",{style:{backgroundColor:"#e9e9e9",border:"0.5px solid #A8A8A7",borderRadius:"6px",padding:"16px",height:"144px",display:"flex",flexDirection:"column",gap:"8px",position:"relative"},children:s("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"100%"},children:s("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e("span",{style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#7d7c7b",lineHeight:"24px"},children:"Amount"}),e("input",{type:"text",value:r,onChange:S,placeholder:"0.00",disabled:c,style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"40px",fontWeight:700,color:c?"rgba(14, 13, 11, 0.16)":r?"#0e0d0b":"#d1d5db",lineHeight:"1.08",letterSpacing:"-1.2px",backgroundColor:"transparent",border:"none",outline:"none",padding:0,width:"100%",maxWidth:"200px"}})]})}),s("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"space-between",height:"100%",gap:"12px"},children:[s("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"},children:[s("span",{style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"12px",fontWeight:500,color:"#71757a",lineHeight:"16px"},children:["Balance: ",g.toFixed(4)]}),e("div",{style:{width:"128px"},children:s("div",{style:{border:"1px solid #CDCFD1",borderRadius:"6px 6px 6px 6px",backgroundColor:"transparent",padding:"8px 12px 8px 8px",display:"flex",alignItems:"center",gap:"8px"},children:[e(dt,{symbol:t.symbol,logoURI:t.logoURI,size:30,theme:d}),e("span",{style:{fontFamily:a?.fontFamily||d.typography.fontFamily,fontSize:"16px",fontWeight:500,color:"#3c3e42",lineHeight:"1.5"},children:t.symbol})]})})]}),e("div",{style:{display:"flex",gap:"10px",height:"14px",alignItems:"center",justifyContent:"flex-end"},children:[0,25,50,75,100].map((p,b)=>{const y=Math.abs(u-p)<1,W=b===4,x=p/100,h=l===p,f=w===p;return e("button",{onClick:()=>n(p),onMouseEnter:()=>A(p),onMouseLeave:()=>{A(null),I(null)},onMouseDown:()=>I(p),onMouseUp:()=>I(null),disabled:c,title:`${p}%`,style:{width:"14px",height:"14px",padding:0,border:"none",backgroundColor:"transparent",cursor:c?"not-allowed":"pointer",opacity:y?1:h?.8:.5,transform:f?"scale(0.85)":h?"scale(1.15)":"scale(1)",transition:"all 0.15s ease"},children:s("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:[e("circle",{cx:"7",cy:"7",r:"6.84375",fill:W?"#ea4b4b":"none",stroke:W?"#ea4b4b":"#3C3E42",strokeWidth:"0.3125"}),!W&&x>0&&e("path",{d:`M 7 7 L 7 0.15625 A 6.84375 6.84375 0 ${x>.5?1:0} 1 ${7+6.84375*Math.sin(x*2*Math.PI)} ${7-6.84375*Math.cos(x*2*Math.PI)} Z`,fill:"#3C3E42"})]})},p)})})]})]})})};var cr="data:image/svg+xml,%3csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.83337 11.0833C8.73287 11.0833 11.0834 8.73275 11.0834 5.83325C11.0834 2.93376 8.73287 0.583252 5.83337 0.583252C2.93388 0.583252 0.583374 2.93376 0.583374 5.83325C0.583374 8.73275 2.93388 11.0833 5.83337 11.0833Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.84329 4.48988C5.18981 4.14336 5.36306 3.97011 5.56285 3.90519C5.73859 3.84809 5.92789 3.84809 6.10363 3.90519C6.30342 3.97011 6.47668 4.14336 6.82319 4.48988L7.17663 4.84331C7.52314 5.18983 7.6964 5.36308 7.76131 5.56287C7.81841 5.73861 7.81841 5.92791 7.76131 6.10365C7.6964 6.30344 7.52314 6.4767 7.17663 6.82321L6.82319 7.17665C6.47668 7.52316 6.30342 7.69642 6.10363 7.76133C5.92789 7.81843 5.73859 7.81843 5.56285 7.76133C5.36306 7.69642 5.18981 7.52316 4.84329 7.17665L4.48986 6.82321C4.14334 6.4767 3.97009 6.30344 3.90517 6.10365C3.84807 5.92791 3.84807 5.73861 3.90517 5.56287C3.97009 5.36308 4.14334 5.18983 4.48986 4.84331L4.84329 4.48988Z' stroke='%23757171' stroke-width='1.16667' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const pr=({isOpen:t,onClose:r,onComplete:i,title:n="Deposit to Spicenet",description:o="Select tokens and enter amounts to deposit to your Spicenet Account",chainId:c,embeddedWalletAddress:a,externalWalletAddress:d,escrowAddress:g="0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",getChainConfig:m,getSupportedTokens:u})=>{const l=De("light"),[A,w]=C(new Map),[I,S]=C(!1),[p,b]=C(null),[y,W]=C([]),[x,h]=C(!1),[f,k]=C(null),[v,R]=C(null),[F,K]=C(!1),[J,oe]=C(!1),{chain:ee}=gt(),{data:Z,isLoading:H}=oo(),{switchChainAsync:N}=Nt(),E=Qe(()=>u(c),[c,u]),{data:V}=In({contracts:E.map(B=>({address:B.address,abi:$t,functionName:"balanceOf",args:[d],chainId:c}))}),_=Qe(()=>{if(!m(c))return[];const B=[];return E.forEach((q,$)=>{const ie=V?.[$],le=ie?.status==="success"?ie.result:BigInt(0),G=Number(le)/Math.pow(10,q.decimals);B.push({address:q.address,symbol:q.symbol,name:q.name,decimals:q.decimals,isNative:!1,chainId:c,balance:le,balanceFormatted:G})}),B},[c,V,E,m]);X(()=>{if(_.length>0&&A.size>0){const B=new Map(A);let q=!1;A.forEach(($,ie)=>{const le=_.find(G=>G.address===ie);le&&le.balanceFormatted!==$.asset.balanceFormatted&&(B.set(ie,{...$,asset:le}),q=!0)}),q&&w(B)}},[_,A]);const ne=m(c),z=B=>{const q=new Map(A);q.has(B.address)?q.delete(B.address):q.set(B.address,{asset:B,amount:""}),w(q),b(null)},se=(B,q)=>{if(q===""||/^\d*\.?\d*$/.test(q)){const $=new Map(A),ie=$.get(B);ie&&($.set(B,{...ie,amount:q}),w($),b(null))}},me=(B,q)=>{const $=A.get(B);if($?.asset.balanceFormatted!==void 0){const ie=$.asset.balanceFormatted*q/100;se(B,ie.toString())}},he=te(async()=>{if(A.size===0){b("Please select at least one asset");return}for(const[q,$]of Array.from(A.entries())){if(!$.amount){b(`Please enter an amount for ${$.asset.symbol}`);return}const ie=parseFloat($.amount);if(isNaN(ie)||ie<=0){b(`Please enter a valid amount for ${$.asset.symbol}`);return}const le=_.find(G=>G.address===q)?.balanceFormatted??$.asset.balanceFormatted;if(le!==void 0&&ie>le){b(`Insufficient ${$.asset.symbol} balance`);return}}if(!Z){b("Wallet not connected. Please reconnect your external wallet.");return}S(!0),b(null);const B=[];try{ee?.id!==c&&await N({chainId:c});for(const[,q]of Array.from(A.entries())){const{asset:$,amount:ie}=q;try{const le=Ge(ie,$.decimals);let G;if($.isNative)G=await Z.sendTransaction({to:g,value:le});else{const T=vt({abi:$t,functionName:"transfer",args:[g,le]});G=await Z.sendTransaction({to:$.address,data:T})}const ge=Je(c),Ae=await ge.waitForTransactionReceipt({hash:G,timeout:12e4,pollingInterval:2e3,confirmations:2});if(Ae.status!=="success")throw new Error(`Transfer to escrow failed for ${$.symbol}`);await ge.getBlockNumber()-Ae.blockNumber<2&&await new Promise(T=>setTimeout(T,3e3)),await we.submitSpiceDeposit({txHash:G,sender:a,tokenAddress:$.address,chainId:c,amount:Ge(ie,$.decimals).toString(),user:a,isDeposit:!0}),B.push({asset:$,txHash:G,success:!0})}catch(le){const G=le;let ge=G?.message||"Deposit failed";G?.code===4001||G?.message?.includes("rejected")?ge="Transaction rejected by user":G?.message?.includes("insufficient funds")&&(ge="Insufficient funds for transaction"),B.push({asset:$,txHash:"",success:!1,error:ge})}}W(B),h(!0)}catch(q){b(q?.message||"Deposit failed")}finally{S(!1)}},[A,Z,ee,c,N,g,_]);X(()=>{t||(w(new Map),b(null),W([]),h(!1),S(!1))},[t]);const ve=te(()=>{W([]),h(!1),b(null)},[]),L=A.size>0&&Array.from(A.values()).every(B=>B.amount&&parseFloat(B.amount)>0)&&!I&&!x&&Z,P=s("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e("img",{src:lo,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:o})]}),ue=I||x&&y.length>0?e(so,{type:"deposit",isOpen:x&&y.length>0,isProcessing:I,onClose:r,onComplete:i,onRetryTx:ve,onNewTx:()=>{},results:y.length>0?y.map(B=>({asset:{symbol:B.asset.symbol,address:B.asset.address},txHash:B.txHash,success:B.success,error:B.error})):void 0,chainName:lt(c),explorerUrl:ne?.blockExplorers?.default?.url,theme:l}):null;return e(At,{isOpen:t,onClose:r,title:n,subtitle:P,theme:l,maxWidth:"480px",children:s("div",{style:{padding:"0 24px 32px 24px",position:"relative"},children:[ue&&e("div",{style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none"},children:e("div",{style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto"},children:ue})}),s("div",{style:{marginBottom:"16px"},children:[s("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:[e("span",{style:{fontSize:"14px",color:"#6b7280"},children:e("img",{src:cr,alt:"Info",style:{width:"10.5px",height:"10.5px",top:"1.75px",left:"1.75px",flexShrink:0}})}),e("label",{style:{fontSize:"12px",fontWeight:590,color:"#374151"},children:"Select Assets to Deposit"})]}),e("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:_.map(B=>{const q=A.has(B.address);return e("button",{onClick:()=>z(B),onMouseEnter:()=>k(B.address),onMouseLeave:()=>{k(null),R(null)},onMouseDown:()=>R(B.address),onMouseUp:()=>R(null),style:{padding:"4px 8px 4px 8px",borderRadius:"8px",border:`1px solid ${q?"#EA4B4B7A":f===B.address?"#F4A5A5":"#e5e7eb"}`,backgroundColor:q?"#FEF2F2":v===B.address?"#f5f5f5":f===B.address?"#fafafa":"white",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",transition:"all 150ms ease",transform:v===B.address?"scale(0.96)":f===B.address?"translateY(-1px)":"none",boxShadow:q?"0 0 0 3px #FBDBDB":v===B.address?"0 1px 2px rgba(0, 0, 0, 0.05)":f===B.address?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:s("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e(dt,{symbol:B.symbol,size:24,theme:l}),e("span",{style:{fontSize:"16px",fontWeight:510,color:"#3C3E42"},children:B.symbol}),B.balanceFormatted!==void 0&&s("span",{style:{fontSize:"10px",fontWeight:500,color:"#939291",fontFamily:'"IBM Plex Mono", monospace'},children:["(",B.balanceFormatted.toFixed(4),")"]})]})},B.address)})})]}),A.size>0&&e("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:Array.from(A.values()).map(({asset:B,amount:q})=>e(dr,{asset:B,amount:q,onAmountChange:$=>se(B.address,$),onPercentageClick:$=>me(B.address,$),theme:l,disabled:I},B.address))}),p&&e("div",{style:{padding:"12px",backgroundColor:"#fef2f2",border:"1px solid #fecaca",borderRadius:"8px",marginTop:"16px"},children:e("p",{style:{fontSize:"14px",color:"#dc2626",margin:0},children:p})}),!x&&e(je,{variant:"outline",fullWidth:!0,onClick:he,onMouseEnter:()=>K(!0),onMouseLeave:()=>{K(!1),oe(!1)},onMouseDown:()=>oe(!0),onMouseUp:()=>oe(!1),disabled:!L,theme:l,style:{width:"100%",padding:"8px ",backgroundColor:L?J?"#d43d3d":F?"#f05555":"#ea4b4b":"#d1d5db",color:L?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:L?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:L?J?"scale(0.98)":F?"translateY(-2px)":"none":"none",boxShadow:J?"1px 1px 0px black":F&&L?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:I?s(qe,{children:[e("div",{style:{width:"18px",height:"18px",border:"2px solid white",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e("span",{children:"PROCESSING..."})]}):H?"CONNECTING WALLET...":Z?A.size===0?"SELECT ASSETS":Array.from(A.values()).every(B=>B.amount)?"DEPOSIT":"ENTER AMOUNTS":"WALLET NOT CONNECTED"}),e("style",{children:`
|
|
39
39
|
@keyframes spin {
|
|
40
40
|
from { transform: rotate(0deg); }
|
|
41
41
|
to { transform: rotate(360deg); }
|
|
42
42
|
}
|
|
43
|
-
`})]})})},ur=[{id:"external",label:"External Wallet"},{id:"embedded",label:"Embedded Wallet"}],No=({withdrawBatches:t,externalWithdrawBatches:r,tokens:i,supportedTokens:n,enableSpiceBalanceUpdate:o=!1,theme:c="light",styles:a,className:d="",withdrawInputHook:g,defaultSelectedAsset:m,filterChains:u,withdrawMode:l="external",onWithdrawModeChange:A,externalWalletAddress:w,embeddedWalletAddress:I,onWithdrawSuccess:S,onWithdrawError:p})=>{const b=De(c),y={...b,typography:{...b.typography,fontFamily:a?.fontFamily||b.typography.fontFamily},colors:{...b.colors,primary:a?.primaryColor||b.colors.primary,primaryHover:a?.primaryColor?`${a.primaryColor}dd`:b.colors.primaryHover}},W=Pt(),{isReady:x,isAuthenticated:h,isConnected:f,address:k,provider:v,actions:R}=W,[F,K]=C(()=>m?{asset:m,amount:""}:null),[J,oe]=C([]),[ee,Z]=C(!1),[H,N]=C(null),E=Qe(()=>!i||i.length===0?[]:!n||n.length===0?i:i.filter(j=>n.some(re=>re.toLowerCase()===j.symbol.toLowerCase())),[i,n]),V=te(async()=>{if(!E||E.length===0||!I){oe([]);return}Z(!0),N(null);try{const j=await Promise.all(E.map(async re=>{try{const Fe=await Je(re.chainId).readContract({address:re.address,abi:$t,functionName:"balanceOf",args:[I]}),He=parseFloat(hn(Fe,re.decimals));return{address:re.address,symbol:re.symbol,name:re.name,decimals:re.decimals,chainId:re.chainId,balance:Fe,balanceFormatted:He,balanceUsd:0,isNative:!1,logoURI:re.logoURI}}catch(Fe){return console.error(`Failed to fetch balance for ${re.symbol}:`,Fe),{address:re.address,symbol:re.symbol,name:re.name,decimals:re.decimals,chainId:re.chainId,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,isNative:!1,logoURI:re.logoURI}}}));oe(j)}catch(j){console.error("Failed to fetch token balances:",j),N(j instanceof Error?j.message:"Failed to fetch token balances")}finally{Z(!1)}},[E,I]);X(()=>{V()},[V]),X(()=>{if(!E||E.length===0)return;const j=setInterval(()=>{V()},3e4);return()=>clearInterval(j)},[V,E]);const _=J.some(j=>j.balanceFormatted>0),[ne,z]=C(!1),[se,me]=C(null),[he,ve]=C(!1),[L,P]=C(!1),[ue,B]=C(!1),[q,$]=C(l),[ie,le]=C(null),[G,ge]=C(null),Ae=Me(null),T=Qe(()=>q==="external"?w:I,[q,w,I]),ae=te(j=>{$(j),A?.(j)},[A]),{intentStatus:ce,startStatusPolling:Ie,clearStatus:Ee}=Wt({checkStepStatus:(j,re)=>we.checkStepStatus(j,re)});X(()=>{if(ce?.overallStatus==="success"&&ce.intentId&&Ae.current!==ce.intentId&&F&&k){const j=ce.steps.find(re=>re.transactionHash);if(j?.transactionHash)if(Ae.current=ce.intentId,o){const re=Ge(F.amount,F.asset.decimals);we.submitSpiceDeposit({user:k,txHash:j.transactionHash,sender:k,tokenAddress:F.asset.address,chainId:F.asset.chainId,amount:re.toString(),isDeposit:!1}).then(()=>{V()}).catch(()=>{Ae.current=null})}else V()}},[ce,k,o]),X(()=>{g&&g.assetAmount!==F?.amount&&F&&K({...F,amount:g.assetAmount})},[g?.assetAmount,F]);const ke=te(()=>{me(null)},[]),Se=j=>{K({asset:j,amount:F?.amount||""}),ke()},pe=te(j=>{F&&(wo(()=>{K({...F,amount:j}),ke()}),g&&g.setAssetAmount(j))},[F,g,ke]),Pe=async()=>{if(!(!F||!k||t.length===0)){if(!T){me(`Please provide a ${q==="external"?"external":"embedded"} wallet address`);return}if(!x||!h){me(`Please authenticate with ${v||"wallet provider"} to continue`);return}z(!0),me(null),B(!0);try{const j=q==="external"&&r?[...t,...r]:[...t],re=[...new Set(j.map(fe=>fe.chainId))],Fe=[];for(const fe of re){const ct=Je(fe),st=mt(fe),wt=await zt(k,ct),et=await R.signAuthorization({contractAddress:st,chainId:fe,nonce:Number(wt)});Fe.push(et)}const He=Vt(j),it=Math.floor(Date.now()/1e3)+60*10,ut=Tt(0n,BigInt(it),He),at=await R.signMessage({raw:ut}),_e=typeof at=="string"?at:at.signature;if(!_e)throw new Error("Failed to sign intent authorization");const Ce={mode:"7702",signatureType:"ecdsa",signature:_e,nbf:0,exp:it,chainBatches:He.map(fe=>({hash:fe.hash,chainId:fe.chainId,tokenTransfers:[{from:"solver",to:k,token:"0x0",amount:Ge("0.01",18)}],calls:fe.calls}))},Le=await we.createAction({user:k,chainAuthorizations:Fe.map(fe=>({...fe,r:fe.r,s:fe.s,yParity:fe.yParity,address:fe.address,chainId:Number(fe.chainId),nonce:Number(fe.nonce)})),intents:[Ce]});if(Le){const fe=Lt(j,et=>`Chain ${et}`),[ct,st]=Le.intentIds[0].split("/"),wt=parseInt(st||"0",10);Ie(Le.intentIds[0],fe);for(let et=0;et<j.length;et++)await we.executeStep(ct,wt,et,{action:"execute"})}}catch(j){const re=j instanceof Error?j.message:"Withdraw failed";me(re),p?.(re)}finally{z(!1)}}},D=Qe(()=>{let j=J;return u&&u.length>0&&(j=j.filter(re=>u.includes(re.chainId))),j},[J,u]),O=F&&F.amount&&parseFloat(F.amount)>0&&parseFloat(F.amount)<=F.asset.balanceFormatted&&f&&!ne&&t.length>0&&!!T,de=H||se,xe={backgroundColor:a?.container?.backgroundColor||a?.primaryBackground||y.colors.background,border:`1px solid ${a?.container?.borderColor||y.colors.border}`,borderRadius:a?.container?.borderRadius||y.borderRadius.lg,padding:a?.container?.padding||y.spacing.md,width:a?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:y.colors.text,fontFamily:y.typography.fontFamily,boxShadow:a?.container?.boxShadow||(y.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},rt=ce?e(so,{type:"withdraw",isOpen:!!ce&&ce.overallStatus!=="processing",isProcessing:ne||ce?.overallStatus==="processing",onRetryTx:()=>{Ee(),B(!1),Pe()},onNewTx:()=>{Ee(),B(!1),K(null),Ae.current=null,V()},onClose:()=>{Ee(),B(!1)},onComplete:()=>{Ee(),B(!1),K(null),Ae.current=null,V()},results:ce?.overallStatus==="success"||ce?.overallStatus==="failed"?ce.steps.map(j=>({asset:{symbol:F?.asset.symbol||"Token",address:F?.asset.address||""},txHash:j.transactionHash||"",success:j.status==="success",amount:F?.amount})):void 0,chainName:F?lt(t[t.length-1].chainId):"Network",explorerUrl:F?Yt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:y}):null;return s("div",{style:{...xe,position:"relative"},className:d,children:[rt&&e("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:rt})}),!ee&&!_&&e("div",{style:{backgroundColor:y.mode==="light"?"#fef3c7":`${y.colors.warning||"#f59e0b"}20`,border:`1px solid ${y.mode==="light"?"#fcd34d":y.colors.warning||"#f59e0b"}`,borderRadius:y.borderRadius.md,padding:y.spacing.md,marginBottom:y.spacing.md,textAlign:"center"}}),s("div",{style:{marginBottom:"16px"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:e("label",{style:{fontSize:"12px",fontWeight:590,color:y.mode==="light"?"#374151":"#d1d5db"},children:"Withdraw To"})}),e("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:ur.map(j=>{const re=q===j.id,Fe=j.id==="external"?w:I,He=Fe?`${Fe.slice(0,6)}...${Fe.slice(-4)}`:null;return s("button",{onClick:()=>ae(j.id),onMouseEnter:()=>le(j.id),onMouseLeave:()=>{le(null),ge(null)},onMouseDown:()=>ge(j.id),onMouseUp:()=>ge(null),style:{padding:"8px 12px",borderRadius:"8px",border:`1px solid ${re?"#EA4B4B7A":ie===j.id?"#F4A5A5":y.mode==="light"?"#e5e7eb":"#374151"}`,backgroundColor:re?y.mode==="light"?"#FEF2F2":"#451a1a":G===j.id?y.mode==="light"?"#f5f5f5":"#2d2d2d":ie===j.id?y.mode==="light"?"#fafafa":"#333333":y.mode==="light"?"white":"#1f1f1f",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",transition:"all 150ms ease",transform:G===j.id?"scale(0.96)":ie===j.id?"translateY(-1px)":"none",boxShadow:re?"0 0 0 3px #FBDBDB":G===j.id?"0 1px 2px rgba(0, 0, 0, 0.05)":ie===j.id?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:[e("span",{style:{fontSize:"14px",fontWeight:510,color:y.mode==="light"?"#3C3E42":"#e5e7eb"},children:j.label}),He&&e("span",{style:{fontSize:"10px",fontWeight:500,color:y.mode==="light"?"#939291":"#6b7280",fontFamily:'"IBM Plex Mono", monospace'},children:He})]},j.id)})})]}),e("div",{style:{marginBottom:y.spacing.sm},children:e(bt,{assets:D,selectedAsset:F||void 0,onAssetSelect:Se,onAmountChange:pe,loading:ee,label:"Amount",showBalance:!0,showMaxButton:!0,theme:y,styles:a})}),de&&e("div",{style:{backgroundColor:a?.errorMessage?.backgroundColor||(y.mode==="light"?"#fef2f2":`${a?.statusDisplay?.errorColor||y.colors.error}20`),border:`1px solid ${a?.errorMessage?.borderColor||(y.mode==="light"?"#fecaca":a?.statusDisplay?.errorColor||y.colors.error)}`,borderRadius:a?.errorMessage?.borderRadius||y.borderRadius.md,padding:a?.errorMessage?.padding||y.spacing.md,marginBottom:y.spacing.sm},children:e("p",{style:{color:a?.errorMessage?.color||a?.statusDisplay?.errorColor||y.colors.error,fontSize:a?.errorMessage?.fontSize||y.typography.fontSize.sm,fontWeight:a?.errorMessage?.fontWeight,fontFamily:a?.errorMessage?.fontFamily||y.typography.fontFamily,margin:0},children:de})}),e("div",{style:{display:"flex",flexDirection:"column",gap:y.spacing.sm},children:e(je,{variant:"outline",fullWidth:!0,onClick:Pe,onMouseEnter:()=>ve(!0),onMouseLeave:()=>{ve(!1),P(!1)},onMouseDown:()=>P(!0),onMouseUp:()=>P(!1),loading:ne,disabled:!O||!f,theme:y,styles:a,style:{width:"100%",padding:"8px",backgroundColor:O?L?"#d43d3d":he?"#f05555":"#ea4b4b":"#d1d5db",color:O?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:O?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:O?L?"scale(0.98)":he?"translateY(-2px)":"none":"none",boxShadow:L?"1px 1px 0px black":he&&O?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:x?h?f?ne?"Executing Withdraw...":F?F.amount?parseFloat(F.amount)>F.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Withdraw Batches":T?"Execute Withdraw":`Set ${q==="external"?"External":"Embedded"} Wallet`:"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})},hr=({isOpen:t,onClose:r,title:i="Withdraw",maxWidth:n="480px",withdrawBatches:o,externalWithdrawBatches:c,tokens:a,supportedTokens:d,enableSpiceBalanceUpdate:g=!1,theme:m="light",styles:u,className:l,withdrawInputHook:A,defaultSelectedAsset:w,filterChains:I,withdrawMode:S,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:y,onWithdrawSuccess:W,onWithdrawError:x})=>{const h=De(m),f=k=>{W?.(k)};return e(At,{isOpen:t,onClose:r,title:i,subtitle:s("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e("img",{src:lo,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Withdraw your vault tokens to your external or embedded wallet."})]}),styles:u,theme:h,maxWidth:n,children:e("div",{style:{padding:"0 24px 24px 24px"},children:e(No,{withdrawBatches:o,externalWithdrawBatches:c,tokens:a,supportedTokens:d,enableSpiceBalanceUpdate:g,theme:m,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,withdrawInputHook:A,defaultSelectedAsset:w,filterChains:I,withdrawMode:S,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:y,onWithdrawSuccess:f,onWithdrawError:x})})})};/**
|
|
43
|
+
`})]})})},ur=[{id:"external",label:"External Wallet"},{id:"embedded",label:"Embedded Wallet"}],No=({withdrawBatches:t,externalWithdrawBatches:r,tokens:i,supportedTokens:n,enableSpiceBalanceUpdate:o=!1,theme:c="light",styles:a,className:d="",withdrawInputHook:g,defaultSelectedAsset:m,filterChains:u,withdrawMode:l="external",onWithdrawModeChange:A,externalWalletAddress:w,embeddedWalletAddress:I,onWithdrawSuccess:S,onWithdrawError:p})=>{const b=De(c),y={...b,typography:{...b.typography,fontFamily:a?.fontFamily||b.typography.fontFamily},colors:{...b.colors,primary:a?.primaryColor||b.colors.primary,primaryHover:a?.primaryColor?`${a.primaryColor}dd`:b.colors.primaryHover}},W=Pt(),{isReady:x,isAuthenticated:h,isConnected:f,address:k,provider:v,actions:R}=W,[F,K]=C(()=>m?{asset:m,amount:""}:null),[J,oe]=C([]),[ee,Z]=C(!1),[H,N]=C(null),E=Qe(()=>!i||i.length===0?[]:!n||n.length===0?i:i.filter(j=>n.some(re=>re.toLowerCase()===j.symbol.toLowerCase())),[i,n]),V=te(async()=>{if(!E||E.length===0||!I){oe([]);return}Z(!0),N(null);try{const j=await Promise.all(E.map(async re=>{try{const Fe=await Je(re.chainId).readContract({address:re.address,abi:$t,functionName:"balanceOf",args:[I]}),He=parseFloat(hn(Fe,re.decimals));return{address:re.address,symbol:re.symbol,name:re.name,decimals:re.decimals,chainId:re.chainId,balance:Fe,balanceFormatted:He,balanceUsd:0,isNative:!1,logoURI:re.logoURI}}catch(Fe){return console.error(`Failed to fetch balance for ${re.symbol}:`,Fe),{address:re.address,symbol:re.symbol,name:re.name,decimals:re.decimals,chainId:re.chainId,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,isNative:!1,logoURI:re.logoURI}}}));oe(j)}catch(j){console.error("Failed to fetch token balances:",j),N(j instanceof Error?j.message:"Failed to fetch token balances")}finally{Z(!1)}},[E,I]);X(()=>{V()},[V]),X(()=>{if(!E||E.length===0)return;const j=setInterval(()=>{V()},3e4);return()=>clearInterval(j)},[V,E]);const _=J.some(j=>j.balanceFormatted>0),[ne,z]=C(!1),[se,me]=C(null),[he,ve]=C(!1),[L,P]=C(!1),[ue,B]=C(!1),[q,$]=C(l),[ie,le]=C(null),[G,ge]=C(null),Ae=Me(null),T=Qe(()=>q==="external"?w:I,[q,w,I]),ae=te(j=>{$(j),A?.(j)},[A]),{intentStatus:ce,startStatusPolling:Ie,clearStatus:Ee}=Wt({checkStepStatus:(j,re)=>we.checkStepStatus(j,re)});X(()=>{if(ce?.overallStatus==="success"&&ce.intentId&&Ae.current!==ce.intentId&&F&&k){const j=ce.steps.find(re=>re.transactionHash);if(j?.transactionHash)if(Ae.current=ce.intentId,o){const re=Ge(F.amount,F.asset.decimals);we.submitSpiceDeposit({user:k,txHash:j.transactionHash,sender:k,tokenAddress:F.asset.address,chainId:F.asset.chainId,amount:re.toString(),isDeposit:!1}).then(()=>{V()}).catch(()=>{Ae.current=null})}else V()}},[ce,k,o]),X(()=>{g&&g.assetAmount!==F?.amount&&F&&K({...F,amount:g.assetAmount})},[g?.assetAmount,F]);const ke=te(()=>{me(null)},[]),Se=j=>{K({asset:j,amount:F?.amount||""}),ke()},pe=te(j=>{F&&(wo(()=>{K({...F,amount:j}),ke()}),g&&g.setAssetAmount(j))},[F,g,ke]),Pe=async()=>{if(!(!F||!k||t.length===0)){if(!T){me(`Please provide a ${q==="external"?"external":"embedded"} wallet address`);return}if(!x||!h){me(`Please authenticate with ${v||"wallet provider"} to continue`);return}z(!0),me(null),B(!0);try{const j=q==="external"&&r?[...t,...r]:[...t],re=[...new Set(j.map(fe=>fe.chainId))],Fe=[];for(const fe of re){const ct=Je(fe),st=mt(fe),wt=await zt(k,ct),et=await R.signAuthorization({contractAddress:st,chainId:fe,nonce:Number(wt)});Fe.push(et)}const He=Vt(j),it=Math.floor(Date.now()/1e3)+60*10,ut=Tt(0n,BigInt(it),He),at=await R.signMessage({raw:ut}),_e=typeof at=="string"?at:at.signature;if(!_e)throw new Error("Failed to sign intent authorization");const Ce={mode:"7702",signatureType:"ecdsa",signature:_e,nbf:0,exp:it,chainBatches:He.map(fe=>({hash:fe.hash,chainId:fe.chainId,tokenTransfers:[{from:"solver",to:k,token:"0x0000000000000000000000000000000000000000",amount:Ge("0.01",18)}],calls:fe.calls}))},Le=await we.createAction({user:k,chainAuthorizations:Fe.map(fe=>({...fe,r:fe.r,s:fe.s,yParity:fe.yParity,address:fe.address,chainId:Number(fe.chainId),nonce:Number(fe.nonce)})),intents:[Ce]});if(Le){const fe=Lt(j,et=>`Chain ${et}`),[ct,st]=Le.intentIds[0].split("/"),wt=parseInt(st||"0",10);Ie(Le.intentIds[0],fe);for(let et=0;et<j.length;et++)await we.executeStep(ct,wt,et,{action:"execute"})}}catch(j){const re=j instanceof Error?j.message:"Withdraw failed";me(re),p?.(re)}finally{z(!1)}}},D=Qe(()=>{let j=J;return u&&u.length>0&&(j=j.filter(re=>u.includes(re.chainId))),j},[J,u]),O=F&&F.amount&&parseFloat(F.amount)>0&&parseFloat(F.amount)<=F.asset.balanceFormatted&&f&&!ne&&t.length>0&&!!T,de=H||se,xe={backgroundColor:a?.container?.backgroundColor||a?.primaryBackground||y.colors.background,border:`1px solid ${a?.container?.borderColor||y.colors.border}`,borderRadius:a?.container?.borderRadius||y.borderRadius.lg,padding:a?.container?.padding||y.spacing.md,width:a?.container?.width||"100%",maxWidth:"28rem",minHeight:"200px",margin:"0 auto",color:y.colors.text,fontFamily:y.typography.fontFamily,boxShadow:a?.container?.boxShadow||(y.mode==="light"?"0 4px 6px -1px rgb(0 0 0 / 0.1)":"0 4px 6px -1px rgb(0 0 0 / 0.3)")},rt=ce?e(so,{type:"withdraw",isOpen:!!ce&&ce.overallStatus!=="processing",isProcessing:ne||ce?.overallStatus==="processing",onRetryTx:()=>{Ee(),B(!1),Pe()},onNewTx:()=>{Ee(),B(!1),K(null),Ae.current=null,V()},onClose:()=>{Ee(),B(!1)},onComplete:()=>{Ee(),B(!1),K(null),Ae.current=null,V()},results:ce?.overallStatus==="success"||ce?.overallStatus==="failed"?ce.steps.map(j=>({asset:{symbol:F?.asset.symbol||"Token",address:F?.asset.address||""},txHash:j.transactionHash||"",success:j.status==="success",amount:F?.amount})):void 0,chainName:F?lt(t[t.length-1].chainId):"Network",explorerUrl:F?Yt(t[t.length-1].chainId,"").replace(/\/tx\/.*$/,""):void 0,theme:y}):null;return s("div",{style:{...xe,position:"relative"},className:d,children:[rt&&e("div",{style:{position:"absolute",top:0,left:"-25px",right:"-25px",bottom:"-16px"},children:e("div",{style:{position:"absolute",width:"100%",height:"100%",pointerEvents:"auto"},children:rt})}),!ee&&!_&&e("div",{style:{backgroundColor:y.mode==="light"?"#fef3c7":`${y.colors.warning||"#f59e0b"}20`,border:`1px solid ${y.mode==="light"?"#fcd34d":y.colors.warning||"#f59e0b"}`,borderRadius:y.borderRadius.md,padding:y.spacing.md,marginBottom:y.spacing.md,textAlign:"center"}}),s("div",{style:{marginBottom:"16px"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},children:e("label",{style:{fontSize:"12px",fontWeight:590,color:y.mode==="light"?"#374151":"#d1d5db"},children:"Withdraw To"})}),e("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"},children:ur.map(j=>{const re=q===j.id,Fe=j.id==="external"?w:I,He=Fe?`${Fe.slice(0,6)}...${Fe.slice(-4)}`:null;return s("button",{onClick:()=>ae(j.id),onMouseEnter:()=>le(j.id),onMouseLeave:()=>{le(null),ge(null)},onMouseDown:()=>ge(j.id),onMouseUp:()=>ge(null),style:{padding:"8px 12px",borderRadius:"8px",border:`1px solid ${re?"#EA4B4B7A":ie===j.id?"#F4A5A5":y.mode==="light"?"#e5e7eb":"#374151"}`,backgroundColor:re?y.mode==="light"?"#FEF2F2":"#451a1a":G===j.id?y.mode==="light"?"#f5f5f5":"#2d2d2d":ie===j.id?y.mode==="light"?"#fafafa":"#333333":y.mode==="light"?"white":"#1f1f1f",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",transition:"all 150ms ease",transform:G===j.id?"scale(0.96)":ie===j.id?"translateY(-1px)":"none",boxShadow:re?"0 0 0 3px #FBDBDB":G===j.id?"0 1px 2px rgba(0, 0, 0, 0.05)":ie===j.id?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"},children:[e("span",{style:{fontSize:"14px",fontWeight:510,color:y.mode==="light"?"#3C3E42":"#e5e7eb"},children:j.label}),He&&e("span",{style:{fontSize:"10px",fontWeight:500,color:y.mode==="light"?"#939291":"#6b7280",fontFamily:'"IBM Plex Mono", monospace'},children:He})]},j.id)})})]}),e("div",{style:{marginBottom:y.spacing.sm},children:e(bt,{assets:D,selectedAsset:F||void 0,onAssetSelect:Se,onAmountChange:pe,loading:ee,label:"Amount",showBalance:!0,showMaxButton:!0,theme:y,styles:a})}),de&&e("div",{style:{backgroundColor:a?.errorMessage?.backgroundColor||(y.mode==="light"?"#fef2f2":`${a?.statusDisplay?.errorColor||y.colors.error}20`),border:`1px solid ${a?.errorMessage?.borderColor||(y.mode==="light"?"#fecaca":a?.statusDisplay?.errorColor||y.colors.error)}`,borderRadius:a?.errorMessage?.borderRadius||y.borderRadius.md,padding:a?.errorMessage?.padding||y.spacing.md,marginBottom:y.spacing.sm},children:e("p",{style:{color:a?.errorMessage?.color||a?.statusDisplay?.errorColor||y.colors.error,fontSize:a?.errorMessage?.fontSize||y.typography.fontSize.sm,fontWeight:a?.errorMessage?.fontWeight,fontFamily:a?.errorMessage?.fontFamily||y.typography.fontFamily,margin:0},children:de})}),e("div",{style:{display:"flex",flexDirection:"column",gap:y.spacing.sm},children:e(je,{variant:"outline",fullWidth:!0,onClick:Pe,onMouseEnter:()=>ve(!0),onMouseLeave:()=>{ve(!1),P(!1)},onMouseDown:()=>P(!0),onMouseUp:()=>P(!1),loading:ne,disabled:!O||!f,theme:y,styles:a,style:{width:"100%",padding:"8px",backgroundColor:O?L?"#d43d3d":he?"#f05555":"#ea4b4b":"#d1d5db",color:O?"#0e0d0b":"#6b7280",border:"1px solid #0e0d0b",fontWeight:500,fontSize:"18px",fontFamily:'"IBM Plex Mono", monospace',lineHeight:"156%",textTransform:"uppercase",cursor:O?"pointer":"not-allowed",marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",transition:"all 150ms ease",transform:O?L?"scale(0.98)":he?"translateY(-2px)":"none":"none",boxShadow:L?"1px 1px 0px black":he&&O?"5px 5px 0px white, 6px 6px 0px black":"3px 3px 0px white, 4px 4px 0px black"},children:x?h?f?ne?"Executing Withdraw...":F?F.amount?parseFloat(F.amount)>F.asset.balanceFormatted?"Insufficient Balance":t.length===0?"No Withdraw Batches":T?"Execute Withdraw":`Set ${q==="external"?"External":"Embedded"} Wallet`:"Enter Amount":"Select Token":"Wallet Not Connected":"Authentication Required":"Loading..."})})]})},hr=({isOpen:t,onClose:r,title:i="Withdraw",maxWidth:n="480px",withdrawBatches:o,externalWithdrawBatches:c,tokens:a,supportedTokens:d,enableSpiceBalanceUpdate:g=!1,theme:m="light",styles:u,className:l,withdrawInputHook:A,defaultSelectedAsset:w,filterChains:I,withdrawMode:S,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:y,onWithdrawSuccess:W,onWithdrawError:x})=>{const h=De(m),f=k=>{W?.(k)};return e(At,{isOpen:t,onClose:r,title:i,subtitle:s("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",backgroundColor:"#f9fafb",border:"1px solid #ed6969",borderRadius:"8px",padding:"10px",margin:"0 0 0 0"},children:[e("img",{src:lo,alt:"Info",style:{width:"14px",height:"14px",marginTop:"2px",flexShrink:0}}),e("p",{style:{fontSize:"13px",color:"#374151",margin:0,lineHeight:"1.5"},children:"Withdraw your vault tokens to your external or embedded wallet."})]}),styles:u,theme:h,maxWidth:n,children:e("div",{style:{padding:"0 24px 24px 24px"},children:e(No,{withdrawBatches:o,externalWithdrawBatches:c,tokens:a,supportedTokens:d,enableSpiceBalanceUpdate:g,theme:m,styles:{...u,container:{...u?.container,boxShadow:"none",borderColor:"transparent",padding:"0",backgroundColor:"transparent"}},className:l,withdrawInputHook:A,defaultSelectedAsset:w,filterChains:I,withdrawMode:S,onWithdrawModeChange:p,externalWalletAddress:b,embeddedWalletAddress:y,onWithdrawSuccess:f,onWithdrawError:x})})})};/**
|
|
44
44
|
* @license lucide-react v0.562.0 - ISC
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the ISC license.
|