@aori/mega-swap-widget 0.1.11 → 0.1.13
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/AssetSelectionMenu-F2JUPXHM.js +2 -0
- package/dist/AssetSelectionMenu-U7S42AGB.cjs +2 -0
- package/dist/ChainSelectionMenu-BGZDH2WA.js +2 -0
- package/dist/ChainSelectionMenu-QGLWZEIZ.cjs +2 -0
- package/dist/SwapFormHorizontal-MEYPUSEU.js +2 -0
- package/dist/SwapFormHorizontal-QI3GS2BO.cjs +2 -0
- package/dist/SwapFormSplit-7VZ7IIJR.js +2 -0
- package/dist/SwapFormSplit-LI3MH5YB.cjs +2 -0
- package/dist/{WidgetWalletPanel-VUT4LF65.js → WidgetWalletPanel-7L7E7IA5.js} +1 -1
- package/dist/{WidgetWalletPanel-HH26O3HT.cjs → WidgetWalletPanel-B3VZ6AIJ.cjs} +1 -1
- package/dist/WidgetWalletTradeHistory-AQOIIO2U.cjs +2 -0
- package/dist/WidgetWalletTradeHistory-ES3FEDM7.js +2 -0
- package/dist/{chunk-D7GULMHE.cjs → chunk-3PGCHNG2.cjs} +1 -1
- package/dist/{chunk-K3RTTHBS.cjs → chunk-4S3B2JQY.cjs} +3 -3
- package/dist/{chunk-LSB5IXLW.js → chunk-6BEXSHIC.js} +1 -1
- package/dist/chunk-E7O7PKZA.cjs +2 -0
- package/dist/{chunk-YO5D6L5W.js → chunk-FWH744XA.js} +1 -1
- package/dist/chunk-GF37SKBJ.js +2 -0
- package/dist/{chunk-TWVI6PZS.cjs → chunk-GIDTBDDC.cjs} +1 -1
- package/dist/{chunk-PSCWQFVY.cjs → chunk-GK3MOEYU.cjs} +1 -1
- package/dist/chunk-HFX3K3RG.cjs +2 -0
- package/dist/{chunk-UR3Q7FG5.js → chunk-MJMI6IZW.js} +1 -1
- package/dist/chunk-MVF5PRDZ.js +2 -0
- package/dist/{chunk-WZCWYOCN.cjs → chunk-N2SES3FP.cjs} +1 -1
- package/dist/{chunk-QAOZRRSH.js → chunk-NNNQNB5T.js} +5 -5
- package/dist/{chunk-UHG7ZIWD.js → chunk-PFQ7GSLH.js} +1 -1
- package/dist/{chunk-EKSQTNKS.cjs → chunk-R36QQMHJ.cjs} +1 -1
- package/dist/{chunk-CNE67IQ3.cjs → chunk-TLVNPEBL.cjs} +1 -1
- package/dist/{chunk-IKTTT66M.js → chunk-W63DXT5E.js} +1 -1
- package/dist/{chunk-GPT4NHM5.js → chunk-XCPMBMS7.js} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/AssetSelectionMenu-CYWW5K6R.js +0 -2
- package/dist/AssetSelectionMenu-TPSIEBBB.cjs +0 -2
- package/dist/ChainSelectionMenu-HFJGI6E5.js +0 -2
- package/dist/ChainSelectionMenu-UNMEPKRI.cjs +0 -2
- package/dist/SwapFormHorizontal-4OU37V6U.js +0 -2
- package/dist/SwapFormHorizontal-WBAPDDJF.cjs +0 -2
- package/dist/SwapFormSplit-I2HXRXPP.cjs +0 -2
- package/dist/SwapFormSplit-UGIUUA5V.js +0 -2
- package/dist/WidgetWalletTradeHistory-NL23HIOJ.cjs +0 -2
- package/dist/WidgetWalletTradeHistory-VAH2FU7S.js +0 -2
- package/dist/chunk-2VOK7L7P.js +0 -2
- package/dist/chunk-46JMXEHJ.cjs +0 -2
- package/dist/chunk-XTJC3IX6.cjs +0 -2
- package/dist/chunk-YIRIKYAW.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as ge}from"./chunk-UHG7ZIWD.js";import{e as he}from"./chunk-YO5D6L5W.js";import{b as ne,c as pe,d as b}from"./chunk-GPT4NHM5.js";import{B as de,C as le,D as ce,K as ue,N as fe,O as D,e as oe,i as R,u as $,v as re,x as ie}from"./chunk-QAOZRRSH.js";import{a as me}from"./chunk-46H44R7V.js";import F,{useCallback as we,useEffect as De,useMemo as A}from"react";import{useShallow as ze}from"zustand/react/shallow";import Re from"react";import{jsx as T,jsxs as z}from"react/jsx-runtime";var Q=Re.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=ce(i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?$(o,i.balance,i.decimals):null;return z("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[z("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[T(D,{asset:o,size:"sm",className:"flex-shrink-0"}),z("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[T("span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),T("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),z("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[T("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),T("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&i.asset.assetInfo?.price===d.asset.assetInfo?.price&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";import{jsx as a,jsxs as c}from"react/jsx-runtime";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=me(),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=b(ze(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=ie(h,300),I=pe(),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=ne(),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=ge(),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=he(),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=A(()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);De(()=>{W?b.getState().setAssetSelectionChain(x[0]):o&&b.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=F.useMemo(()=>{let s=x.length>0?new Set(x):null,r=oe(I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=le(m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=de(),Be=A(()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=A(()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=A(()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=F.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=A(()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=F.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=R(n),t=R(u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=ue(H,I,void 0,C.length>0?C:void 0),ae=F.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=we(e=>{let s=e.target.value.toLowerCase(),r=re(s),n=b.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=we(async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return c("div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&c("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[a("button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),b.getState().setAssetSelectionChain("all")},onMouseEnter:()=>v?.("All Chains"),onMouseLeave:()=>v?.(null),children:"All"}),Ae.map((e,s)=>a("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),b.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>v?.(e.name),onMouseLeave:()=>v?.(null),children:a("div",{className:"mb-px h-4 w-4",children:a(fe,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&a("button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),L()},children:"More"})]}),Te&&a("div",{className:"flex-shrink-0",children:c("div",{className:"relative mt-1",children:[a("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:h,onChange:Me}),h&&a("button",{type:"button",onClick:()=>b.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),c("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>c("div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a("div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),c("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[a("div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),c("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):R(e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?$(N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?$(w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:a(Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),a("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?a("div",{className:"flex items-center justify-center p-8",children:a("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?a("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>c("div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a(D,{asset:e,size:"sm",className:"flex-shrink-0"}),c("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[a("span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),a("span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),c("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[a("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),c("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},ns=Fe;export{ns as a};
|
|
2
|
+
import{a as ge}from"./chunk-PFQ7GSLH.js";import{e as he}from"./chunk-FWH744XA.js";import{b as ne,c as pe,d as b}from"./chunk-XCPMBMS7.js";import{B as de,C as le,D as ce,K as ue,N as fe,O as D,e as oe,i as R,u as $,v as re,x as ie}from"./chunk-NNNQNB5T.js";import{a as me}from"./chunk-46H44R7V.js";import F,{useCallback as we,useEffect as De,useMemo as A}from"react";import{useShallow as ze}from"zustand/react/shallow";import Re from"react";import{jsx as T,jsxs as z}from"react/jsx-runtime";var Q=Re.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=ce(i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?$(o,i.balance,i.decimals):null;return z("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[z("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[T(D,{asset:o,size:"sm",className:"flex-shrink-0"}),z("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[T("span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),T("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),z("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[T("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),T("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&i.asset.assetInfo?.price===d.asset.assetInfo?.price&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";import{jsx as a,jsxs as c}from"react/jsx-runtime";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=me(),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=b(ze(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=ie(h,300),I=pe(),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=ne(),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=ge(),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=he(),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=A(()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);De(()=>{W?b.getState().setAssetSelectionChain(x[0]):o&&b.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=F.useMemo(()=>{let s=x.length>0?new Set(x):null,r=oe(I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=le(m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=de(),Be=A(()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=A(()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=A(()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=F.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=A(()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=F.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=R(n),t=R(u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=ue(H,I,void 0,C.length>0?C:void 0),ae=F.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=we(e=>{let s=e.target.value.toLowerCase(),r=re(s),n=b.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=we(async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return c("div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&c("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[a("button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),b.getState().setAssetSelectionChain("all")},onMouseEnter:()=>v?.("All Chains"),onMouseLeave:()=>v?.(null),children:"All"}),Ae.map((e,s)=>a("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),b.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>v?.(e.name),onMouseLeave:()=>v?.(null),children:a("div",{className:"mb-px h-4 w-4",children:a(fe,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&a("button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),L()},children:"More"})]}),Te&&a("div",{className:"flex-shrink-0",children:c("div",{className:"relative mt-1",children:[a("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:h,onChange:Me}),h&&a("button",{type:"button",onClick:()=>b.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),c("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>c("div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a("div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),c("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[a("div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),c("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):R(e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?$(N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?$(w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:a(Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),a("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?a("div",{className:"flex items-center justify-center p-8",children:a("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?a("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>c("div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a(D,{asset:e,size:"sm",className:"flex-shrink-0"}),c("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[a("span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),a("span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),c("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[a("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),c("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},ns=Fe;export{ns as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{f as F}from"./chunk-GF37SKBJ.js";import{e as _}from"./chunk-FWH744XA.js";import{b as k}from"./chunk-XCPMBMS7.js";import{O as u,W as m,c as g}from"./chunk-NNNQNB5T.js";import Q,{useEffect as R,useState as A}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var q=()=>t("svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),V=()=>t("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),e("path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]});function j(o){if(o===0)return"0";let r=Math.abs(o);return r>=1e9?`${(o/1e9).toFixed(2)}B`:r>=1e6?`${(o/1e6).toFixed(2)}M`:r>=1e4?`${(o/1e3).toFixed(2)}K`:r>=1e3?o.toFixed(1):r>=100?o.toFixed(2):r>=1?o.toFixed(4):o.toFixed(6)}var E=Q.memo(()=>{let[o,r]=A(!1),{liquidityError:L,routingError:S}=F(),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:a}=_(),{quoteLoaderVariant:f,widgetType:T}=k(),p=T==="compact",l=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,x=l>0&&l<1,C=x?1/l:l,v=x?s:a,w=x?a:s,y=s?.price?`\u2248 $${(x?s.price:s.price*l).toFixed(2)}`:"",M=s&&a&&s.chainId!==a.chainId,h=s?g(s.chainId)?.estimatedTimeMs??0:0,$=a?g(a.chainId)?.estimatedTimeMs??0:0,N=(M?h+$:h)/1e3,b=L||S,d=s&&a&&n&&parseFloat(n.toString())&&i;return R(()=>{f==="expanded"&&d&&r(!0)},[f,d]),f==="none"?null:f==="default"?e("div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",v?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",w?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}):b?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>d&&r(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),d&&r(I=>!I))},children:e("div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",v?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",w?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):b?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&d?"120px":"0px",opacity:o&&d?1:0},children:t("div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",s?.price&&i?(s.price*l*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Estimated Time"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:N>0?`${N.toFixed(2)}s`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),t("div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Route"}),t("a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[e(V,{}),"Aori",e(q,{})]})]})]})})]})});E.displayName="QuoteLoader";var O=E;export{O as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunkGIDTBDDCcjs = require('./chunk-GIDTBDDC.cjs');var _chunk3PGCHNG2cjs = require('./chunk-3PGCHNG2.cjs');var _chunk4S3B2JQYcjs = require('./chunk-4S3B2JQY.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var P=({toggle:D,side:y,onChainSelect:u,onChainHover:p,containerHeight:E})=>{let[i,m]=_react.useState.call(void 0, ""),l=_chunk4S3B2JQYcjs.x.call(void 0, i,300),x=_chunk3PGCHNG2cjs.c.call(void 0, ),s=_chunk4S3B2JQYcjs.e.call(void 0, x),{effectivePrioritizedInputChains:w}=_chunkGIDTBDDCcjs.a.call(void 0, ),n=y==="base"?w:[],d=_react.useMemo.call(void 0, ()=>{if(n.length===0)return s;let e=new Set(n),r=new Map(n.map((o,c)=>[o,c])),S=s.filter(o=>e.has(o.id)).sort((o,c)=>(_nullishCoalesce(r.get(o.id), () => (0)))-(_nullishCoalesce(r.get(c.id), () => (0)))),I=s.filter(o=>!e.has(o.id));return[...S,...I]},[s,n]),f=_react2.default.useMemo(()=>{if(!l)return d;let e=l.toLowerCase();return d.filter(r=>r.displayName.toLowerCase().includes(e)||r.name.toLowerCase().includes(e)||r.id.toString().includes(e))},[d,l]),N=_react.useCallback.call(void 0, e=>u(e),[u]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative mt-3",children:[_jsxruntime.jsx.call(void 0, "input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search chains by name or chain ID...",autoComplete:"off",value:i,onChange:e=>m(e.target.value.toLowerCase())}),i&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>m(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 min-h-0 overflow-auto mt-2 pb-4",style:{backgroundColor:"var(--widget-background)"},children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:i?"Search Results":"Available Chains"}),f.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Chain Not Found"}):f.map(e=>_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>N(e.id),onMouseEnter:()=>_optionalChain([p, 'optionalCall', _ => _(e.displayName)]),onMouseLeave:()=>_optionalChain([p, 'optionalCall', _2 => _2(null)]),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.N,{chain:e.id,size:"md"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:e.displayName})]}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},F= exports.a =P;exports.a = F;
|